@evoscientist/webui 0.0.9 → 0.0.10
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/dist/.next/BUILD_ID +1 -1
- package/dist/.next/build-manifest.json +3 -3
- package/dist/.next/server/app/_global-error.html +1 -1
- package/dist/.next/server/app/_global-error.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.html +1 -1
- package/dist/.next/server/app/_not-found.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/.next/server/app/index.html +1 -1
- package/dist/.next/server/app/index.rsc +2 -2
- package/dist/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/dist/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0wd7vkh._.js +2 -2
- package/dist/.next/server/middleware-build-manifest.js +3 -3
- package/dist/.next/server/pages/404.html +1 -1
- package/dist/.next/server/pages/500.html +1 -1
- package/dist/.next/static/chunks/{0r0k~7apz1g3~.js → 143yn1~y.nunv.js} +2 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
- /package/dist/.next/static/{_leTiU4W6HEDdB5K1SmTt → Bt8CaAVvU3jBI-gY3KExJ}/_buildManifest.js +0 -0
- /package/dist/.next/static/{_leTiU4W6HEDdB5K1SmTt → Bt8CaAVvU3jBI-gY3KExJ}/_clientMiddlewareManifest.js +0 -0
- /package/dist/.next/static/{_leTiU4W6HEDdB5K1SmTt → Bt8CaAVvU3jBI-gY3KExJ}/_ssgManifest.js +0 -0
|
@@ -67,9 +67,9 @@ data: ${JSON.stringify(t)}
|
|
|
67
67
|
`));e.enqueue(i.encode("event: end\n\n")),e.close()}}),mw.fromReadableStream(o)}async *_streamEventsV2(e,t,r){let n,a=new m2({...r,autoClose:!1}),i=mg(t),o=i.runId??y5();i.runId=o;let s=i.callbacks;if(void 0===s)i.callbacks=[a];else if(Array.isArray(s))i.callbacks=s.concat(a);else{let e=s.copy();e.addHandler(a,!0),i.callbacks=e}let l=new AbortController,u=this,c=async function(){let r,n=null;try{t?.signal?"any"in AbortSignal?r=AbortSignal.any([l.signal,t.signal]):(r=t.signal,n=()=>{l.abort()},t.signal.addEventListener("abort",n,{once:!0})):r=l.signal;let s=await u.stream(e,{...i,signal:r});for await(let e of a.tapOutputIterable(o,s))if(l.signal.aborted)break}finally{await a.finish(),r&&n&&r.removeEventListener("abort",n)}}(),d=!1;try{for await(let t of a){if(!d){t.data.input=e,d=!0,n=t.run_id,yield t;continue}t.run_id===n&&t.event.endsWith("_end")&&t.data?.input&&delete t.data.input,yield t}}finally{l.abort(),await c}}async *_streamEventsV1(e,t,r){let n,a=!1,i=mg(t),o=i.tags??[],s=i.metadata??{},l=i.runName??this.getName(),u=new mY({...r,autoClose:!1,_schemaFormat:"streaming_events"}),c=new hi({...r});for await(let t of this._streamLog(e,u,i)){if(void 0===(n=n?n.concat(t):mq.fromRunLogPatch(t)).state)throw Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!a){a=!0;let t={...n.state},r={run_id:t.id,event:`on_${t.type}_start`,name:l,tags:o,metadata:s,data:{input:e}};c.includeEvent(r,t.type)&&(yield r)}for(let e of[...new Set(t.ops.filter(e=>e.path.startsWith("/logs/")).map(e=>e.path.split("/")[2]))]){let t,r={},a=n.state.logs[e];if("start"==(t=void 0===a.end_time?a.streamed_output.length>0?"stream":"start":"end"))void 0!==a.inputs&&(r.input=a.inputs);else if("end"===t)void 0!==a.inputs&&(r.input=a.inputs),r.output=a.final_output;else if("stream"===t){let e=a.streamed_output.length;if(1!==e)throw Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${a.name}"`);r={chunk:a.streamed_output[0]},a.streamed_output=[]}yield{event:`on_${a.type}_${t}`,name:a.name,run_id:a.id,tags:a.tags,metadata:a.metadata,data:r}}let{state:r}=n;if(r.streamed_output.length>0){let e=r.streamed_output.length;if(1!==e)throw Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${r.name}"`);let t={chunk:r.streamed_output[0]};r.streamed_output=[];let n={event:`on_${r.type}_stream`,run_id:r.id,tags:o,metadata:s,name:l,data:t};c.includeEvent(n,r.type)&&(yield n)}}let d=n?.state;if(void 0!==d){let e={event:`on_${d.type}_end`,name:l,run_id:d.id,tags:o,metadata:s,data:{output:d.final_output}};c.includeEvent(e,d.type)&&(yield e)}}static isRunnable(e){return ha(e)}withListeners({onStart:e,onEnd:t,onError:r}){return new vo({bound:this,config:{},configFactories:[n=>({callbacks:[new hn({config:n,onStart:e,onEnd:t,onError:r})]})]})}asTool(e){var t,r,n,a,i;let o,s;return t=this,o=(r=e).name??t.getName(),s=r.description??(h9(n=r.schema)?h6.get(n)?.description:h8(n)||"description"in n&&"string"==typeof n.description?n.description:void 0),new vg(!(!(i=a=r.schema)||"object"!=typeof i||Array.isArray(i))&&(h9(i)||h8(i))&&(h8(a)?"ZodString"===a._def.typeName:!!h9(a)&&"string"===a._zod.def.type)?{name:o,description:s,schema:vn.object({input:vn.string()}).transform(e=>e.input),bound:t}:{name:o,description:s,schema:r.schema,bound:t})}},vo=class e extends vi{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let t=mm(this.config,...e);return mm(t,...this.configFactories?await Promise.all(this.configFactories.map(async e=>await e(t))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new vs({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,t){return this.bound.invoke(e,await this._mergeConfig(t,this.kwargs))}async batch(e,t,r){let n=Array.isArray(t)?await Promise.all(t.map(async e=>this._mergeConfig(mg(e),this.kwargs))):await this._mergeConfig(mg(t),this.kwargs);return this.bound.batch(e,n,r)}_concatOutputChunks(e,t){return this.bound._concatOutputChunks(e,t)}async *_streamIterator(e,t){yield*this.bound._streamIterator(e,await this._mergeConfig(mg(t),this.kwargs))}async stream(e,t){return this.bound.stream(e,await this._mergeConfig(mg(t),this.kwargs))}async *transform(e,t){yield*this.bound.transform(e,await this._mergeConfig(mg(t),this.kwargs))}streamEvents(e,t,r){let n=this,a=async function*(){yield*n.bound.streamEvents(e,{...await n._mergeConfig(mg(t),n.kwargs),version:t.version},r)};return mw.fromAsyncGenerator(a())}static isRunnableBinding(e){return e.bound&&vi.isRunnable(e.bound)}withListeners({onStart:t,onEnd:r,onError:n}){return new e({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[e=>({callbacks:[new hn({config:e,onStart:t,onEnd:r,onError:n})]})]})}},vs=class extends vo{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(e){super(e),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,t,r){let n=e>1?`retry:attempt:${e}`:void 0;return mb(t,{callbacks:r?.getChild(n)})}async _invoke(e,t,r){return m7(n=>super.invoke(e,this._patchConfigForRetry(n,t,r)),{onFailedAttempt:({error:t})=>this.onFailedAttempt(t,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async _batch(e,t,r,n){let a={};try{await m7(async i=>{let o,s=e.map((e,t)=>t).filter(e=>void 0===a[e.toString()]||a[e.toString()]instanceof Error),l=s.map(t=>e[t]),u=s.map(e=>this._patchConfigForRetry(i,t?.[e],r?.[e])),c=await super.batch(l,u,{...n,returnExceptions:!0});for(let e=0;e<c.length;e+=1){let t=c[e],r=s[e];t instanceof Error&&void 0===o&&((o=t).input=l[e]),a[r.toString()]=t}if(o)throw o;return c},{onFailedAttempt:({error:e})=>this.onFailedAttempt(e,e.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(e){if(n?.returnExceptions!==!0)throw e}return Object.keys(a).sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>a[parseInt(e,10)])}async batch(e,t,r){return this._batchWithConfig(this._batch.bind(this),e,t,r)}},vl=class e extends vi{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,t){let r,n=mg(t),a=await mf(n),i=await a?.handleChainStart(this.toJSON(),va(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let o=e;try{let e=[this.first,...this.middle];for(let r=0;r<e.length;r+=1){let a=e[r].invoke(o,mb(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${r+1}`)}));o=await mv(a,t?.signal)}if(t?.signal?.aborted)throw m_(t.signal);r=await this.last.invoke(o,mb(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(e){throw await i?.handleChainError(e),e}return await i?.handleChainEnd(va(r,"output")),r}async batch(e,t,r){let n=this._getOptionsList(t??{},e.length),a=await Promise.all(n.map(mf)),i=await Promise.all(a.map(async(t,r)=>{let a=await t?.handleChainStart(this.toJSON(),va(e[r],"input"),n[r].runId,void 0,void 0,void 0,n[r].runName);return delete n[r].runId,a})),o=e;try{for(let e=0;e<this.steps.length;e+=1){let t=this.steps[e].batch(o,i.map((t,r)=>{let a=t?.getChild(this.omitSequenceTags?void 0:`seq:step:${e+1}`);return mb(n[r],{callbacks:a})}),r);o=await mv(t,n[0]?.signal)}}catch(e){throw await Promise.all(i.map(t=>t?.handleChainError(e))),e}return await Promise.all(i.map(e=>e?.handleChainEnd(va(o,"output")))),o}_concatOutputChunks(e,t){return this.last._concatOutputChunks(e,t)}async *_streamIterator(e,t){let r,n=await mf(t),{runId:a,...i}=t??{},o=await n?.handleChainStart(this.toJSON(),va(e,"input"),a,void 0,void 0,void 0,i?.runName),s=[this.first,...this.middle,this.last],l=!0;async function*u(){yield e}try{let e=s[0].transform(u(),mb(i,{callbacks:o?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let t=1;t<s.length;t+=1){let r=s[t];e=await r.transform(e,mb(i,{callbacks:o?.getChild(this.omitSequenceTags?void 0:`seq:step:${t+1}`)}))}for await(let n of e)if(t?.signal?.throwIfAborted(),yield n,l)if(void 0===r)r=n;else try{r=this._concatOutputChunks(r,n)}catch{r=void 0,l=!1}}catch(e){throw await o?.handleChainError(e),e}await o?.handleChainEnd(va(r,"output"))}getGraph(e){let t=new y6,r=null;return this.steps.forEach((n,a)=>{let i=n.getGraph(e);0!==a&&i.trimFirstNode(),a!==this.steps.length-1&&i.trimLastNode(),t.extend(i);let o=i.firstNode();if(!o)throw Error(`Runnable ${n} has no first node`);r&&t.addEdge(r,o),r=i.lastNode()}),t}pipe(t){return new e(e.isRunnableSequence(t)?{first:this.first,middle:this.middle.concat([this.last,t.first,...t.middle]),last:t.last,name:this.name??t.name}:{first:this.first,middle:[...this.middle,this.last],last:vf(t),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&vi.isRunnable(e)}static from([t,...r],n){let a={};return"string"==typeof n?a.name=n:void 0!==n&&(a=n),new e({...a,first:vf(t),middle:r.slice(0,-1).map(vf),last:vf(r[r.length-1])})}},vu=class e extends vi{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){for(const[t,r]of(super(e),this.steps={},Object.entries(e.steps)))this.steps[t]=vf(r)}static from(t){return new e({steps:t})}async invoke(e,t){let r=mg(t),n=await mf(r),a=await n?.handleChainStart(this.toJSON(),{input:e},r.runId,void 0,void 0,void 0,r?.runName);delete r.runId;let i={};try{let n=Object.entries(this.steps).map(async([t,n])=>{i[t]=await n.invoke(e,mb(r,{callbacks:a?.getChild(`map:key:${t}`)}))});await mv(Promise.all(n),t?.signal)}catch(e){throw await a?.handleChainError(e),e}return await a?.handleChainEnd(i),i}async *_transform(e,t,r){let n={...this.steps},a=mE(e,Object.keys(n).length),i=new Map(Object.entries(n).map(([e,n],i)=>{let o=n.transform(a[i],mb(r,{callbacks:t?.getChild(`map:key:${e}`)}));return[e,o.next().then(t=>({key:e,gen:o,result:t}))]}));for(;i.size;){let e=Promise.race(i.values()),{key:t,result:n,gen:a}=await mv(e,r?.signal);i.delete(t),n.done||(yield{[t]:n.value},i.set(t,a.next().then(e=>({key:t,gen:a,result:e}))))}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vc=class e extends vi{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!f3(e.func))throw Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,t){let[r]=this._getOptionsList(t??{},1),n=await mf(r);return mv(this.func(mb(r,{callbacks:n}),e),r?.signal)}async *_streamIterator(e,t){let[r]=this._getOptionsList(t??{},1),n=await this.invoke(e,t);if(ve(n)){for await(let e of n)r?.signal?.throwIfAborted(),yield e;return}if(null!=n&&"object"==typeof n&&"next"in n&&"function"==typeof n.next){for(;;){r?.signal?.throwIfAborted();let e=n.next();if(e.done)break;yield e.value}return}yield n}static from(t){return new e({func:t})}},vd=class e extends vi{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(f3(e.func))return vc.from(e.func);super(e),function(e){if(f3(e))throw Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}(e.func),this.func=e.func}static from(t){return new e({func:t})}async _invoke(e,t,r){return new Promise((n,a)=>{let i=mb(t,{callbacks:r?.getChild(),recursionLimit:(t?.recursionLimit??25)-1});mp.runWithConfig(my(i),async()=>{try{let r=await this.func(e,{...i});if(r&&vi.isRunnable(r)){if(t?.recursionLimit===0)throw Error("Recursion limit reached.");r=await r.invoke(e,{...i,recursionLimit:(i.recursionLimit??25)-1})}else if(ve(r)){let e;for await(let n of vr(i,r))if(t?.signal?.throwIfAborted(),void 0===e)e=n;else try{e=this._concatOutputChunks(e,n)}catch{e=n}r=e}else if(y7(r)){let e;for(let n of vt(i,r))if(t?.signal?.throwIfAborted(),void 0===e)e=n;else try{e=this._concatOutputChunks(e,n)}catch{e=n}r=e}n(r)}catch(e){a(e)}})})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async *_transform(e,t,r){let n;for await(let t of e)if(void 0===n)n=t;else try{n=this._concatOutputChunks(n,t)}catch{n=t}let a=mb(r,{callbacks:t?.getChild(),recursionLimit:(r?.recursionLimit??25)-1}),i=await new Promise((e,t)=>{mp.runWithConfig(my(a),async()=>{try{let t=await this.func(n,{...a,config:a});e(t)}catch(e){t(e)}})});if(i&&vi.isRunnable(i)){if(r?.recursionLimit===0)throw Error("Recursion limit reached.");for await(let e of(await i.stream(n,a)))yield e}else if(ve(i))for await(let e of vr(a,i))r?.signal?.throwIfAborted(),yield e;else if(y7(i))for(let e of vt(a,i))r?.signal?.throwIfAborted(),yield e;else yield i}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vp=class extends vi{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(e){super(e),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){for(let e of(yield this.runnable,this.fallbacks))yield e}async invoke(e,t){let r=mg(t),n=await mf(r),{runId:a,...i}=r,o=await n?.handleChainStart(this.toJSON(),va(e,"input"),a,void 0,void 0,void 0,i?.runName),s=mb(i,{callbacks:o?.getChild()});return await mp.runWithConfig(s,async()=>{let t;for(let n of this.runnables()){r?.signal?.throwIfAborted();try{let t=await n.invoke(e,s);return await o?.handleChainEnd(va(t,"output")),t}catch(e){void 0===t&&(t=e)}}if(void 0===t)throw Error("No error stored at end of fallback.");throw await o?.handleChainError(t),t})}async *_streamIterator(e,t){let r,n,a,i=mg(t),o=await mf(i),{runId:s,...l}=i,u=await o?.handleChainStart(this.toJSON(),va(e,"input"),s,void 0,void 0,void 0,l?.runName);for(let t of this.runnables()){i?.signal?.throwIfAborted();let a=mb(l,{callbacks:u?.getChild()});try{let r=await t.stream(e,a);n=vr(a,r);break}catch(e){void 0===r&&(r=e)}}if(void 0===n){let e=r??Error("No error stored at end of fallback.");throw await u?.handleChainError(e),e}try{for await(let e of n){yield e;try{a=void 0===a?a:this._concatOutputChunks(a,e)}catch{a=void 0}}}catch(e){throw await u?.handleChainError(e),e}await u?.handleChainEnd(va(a,"output"))}async batch(e,t,r){let n;if(r?.returnExceptions)throw Error("Not implemented.");let a=this._getOptionsList(t??{},e.length),i=await Promise.all(a.map(e=>mf(e))),o=await Promise.all(i.map(async(t,r)=>{let n=await t?.handleChainStart(this.toJSON(),va(e[r],"input"),a[r].runId,void 0,void 0,void 0,a[r].runName);return delete a[r].runId,n}));for(let t of this.runnables()){a[0].signal?.throwIfAborted();try{let n=await t.batch(e,o.map((e,t)=>mb(a[t],{callbacks:e?.getChild()})),r);return await Promise.all(o.map((e,t)=>e?.handleChainEnd(va(n[t],"output")))),n}catch(e){void 0===n&&(n=e)}}if(!n)throw Error("No error stored at end of fallbacks.");throw await Promise.all(o.map(e=>e?.handleChainError(n))),n}};function vf(e){if("function"==typeof e)return new vd({func:e});if(vi.isRunnable(e))return e;if(Array.isArray(e)||"object"!=typeof e)throw Error(`Expected a Runnable, function or object.
|
|
68
68
|
Instead got an unsupported type.`);{let t={};for(let[r,n]of Object.entries(e))t[r]=vf(n);return new vu({steps:t})}}var vm=class extends vi{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(e){e instanceof vu&&(e={mapper:e}),super(e),this.mapper=e.mapper}async invoke(e,t){let r=await this.mapper.invoke(e,t);return{...e,...r}}async *_transform(e,t,r){let n=this.mapper.getStepsKeys(),[a,i]=mE(e),o=this.mapper.transform(i,mb(r,{callbacks:t?.getChild()})),s=o.next();for await(let e of a){if("object"!=typeof e||Array.isArray(e))throw Error(`RunnableAssign can only be used with objects as input, got ${typeof e}`);let t=Object.fromEntries(Object.entries(e).filter(([e])=>!n.includes(e)));Object.keys(t).length>0&&(yield t)}for await(let e of(yield(await s).value,o))yield e}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vh=class extends vi{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(e){("string"==typeof e||Array.isArray(e))&&(e={keys:e}),super(e),this.keys=e.keys}async _pick(e){if("string"==typeof this.keys)return e[this.keys];{let t=this.keys.map(t=>[t,e[t]]).filter(e=>void 0!==e[1]);return 0===t.length?void 0:Object.fromEntries(t)}}async invoke(e,t){return this._callWithConfig(this._pick.bind(this),e,t)}async *_transform(e){for await(let t of e){let e=await this._pick(t);void 0!==e&&(yield e)}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vg=class extends vo{name;description;schema;constructor(e){super({bound:vl.from([vd.from(async e=>{let t;if(cz(e))try{t=await h7(this.schema,e.args)}catch{throw new cB("Received tool input did not match expected schema",JSON.stringify(e.args))}else t=e;return t}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name}),config:e.config??{}}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}};let vb=(e,t)=>{let r=[...new Set(t?.map(e=>{if("string"==typeof e)return e;let t=new e({});if(!("getType"in t)||"function"!=typeof t.getType)throw Error("Invalid type provided.");return t.getType()}))],n=e.getType();return r.some(e=>e===n)};function vy(e,t){return Array.isArray(e)?vv(e,t):vd.from(t=>vv(t,e))}function vv(e,t={}){let{includeNames:r,excludeNames:n,includeTypes:a,excludeTypes:i,includeIds:o,excludeIds:s}=t,l=[];for(let t of e)if(!(n&&t.name&&n.includes(t.name))){if(i&&vb(t,i))continue;if(s&&t.id&&s.includes(t.id))continue;a||o||r?r&&t.name&&r.some(e=>e===t.name)||a&&vb(t,a)?l.push(t):o&&t.id&&o.some(e=>e===t.id)&&l.push(t):l.push(t)}return l}function v_(e){return Array.isArray(e)?vw(e):vd.from(vw)}function vw(e){if(!e.length)return[];let t=[];for(let r of e){let e=t.pop();if(e)if("tool"===r.getType()||r.getType()!==e.getType())t.push(e,r);else{let n=dt(e),a=dt(r),i=n.concat(a);"string"==typeof n.content&&"string"==typeof a.content&&(i.content=`${n.content}
|
|
69
69
|
${a.content}`),t.push(function(e){let t,r=e.getType(),n=Object.fromEntries(Object.entries(e).filter(([e])=>!["type","tool_call_chunks"].includes(e)&&!e.startsWith("lc_")));if(r in vT&&(t=vA(r,n)),!t)throw Error(`Unrecognized message chunk class ${r}. Supported classes are ${Object.keys(vT)}`);return t}(i))}else t.push(r)}return t}function vE(e,t){if(!Array.isArray(e))return vd.from(t=>vx(t,e)).withConfig({runName:"trim_messages"});if(!t)throw Error("Options parameter is required when providing messages.");return vx(e,t)}async function vx(e,t){let r,{maxTokens:n,tokenCounter:a,strategy:i="last",allowPartial:o=!1,endOn:s,startOn:l,includeSystem:u=!1,textSplitter:c}=t;if(l&&"first"===i)throw Error("`startOn` should only be specified if `strategy` is 'last'.");if(u&&"first"===i)throw Error("`includeSystem` should only be specified if `strategy` is 'last'.");r="getNumTokens"in a?async e=>(await Promise.all(e.map(e=>a.getNumTokens(e.content)))).reduce((e,t)=>e+t,0):async e=>a(e);let d=vN;if(c&&(d="splitText"in c?c.splitText:async e=>c(e)),"first"===i)return vS(e,{maxTokens:n,tokenCounter:r,textSplitter:d,partialStrategy:o?"first":void 0,endOn:s});if("last"===i)return vk(e,{maxTokens:n,tokenCounter:r,textSplitter:d,allowPartial:o,includeSystem:u,startOn:l,endOn:s});throw Error(`Unrecognized strategy: '${i}'. Must be one of 'first' or 'last'.`)}async function vS(e,t){let{maxTokens:r,tokenCounter:n,textSplitter:a,partialStrategy:i,endOn:o}=t,s=[...e],l=0;for(let e=0;e<s.length;e+=1){let t=e>0?s.slice(0,-e):s;if(await n(t)<=r){l=s.length-e;break}}if(l<s.length&&i){let e=!1;if(Array.isArray(s[l].content)){let t=s[l];if("string"==typeof t.content)throw Error("Expected content to be an array.");let a=t.content.length,o="last"===i?[...t.content].reverse():t.content;for(let u=1;u<=a;u+=1){let a="first"===i?o.slice(0,u):o.slice(-u),c=Object.fromEntries(Object.entries(t).filter(([e])=>"type"!==e&&!e.startsWith("lc_"))),d=vA(t.getType(),{...c,content:a}),p=[...s.slice(0,l),d];if(await n(p)<=r)s=p,l+=1,e=!0;else break}e&&"last"===i&&(t.content=[...o].reverse())}if(!e){let e,t=s[l];if(Array.isArray(t.content)&&t.content.some(e=>"string"==typeof e||"text"===e.type)){let r=t.content.find(e=>"text"===e.type&&e.text);e=r?.text}else"string"==typeof t.content&&(e=t.content);if(e){let o=await a(e),u=o.length;"last"===i&&o.reverse();for(let e=0;e<u-1;e+=1)if(o.pop(),t.content=o.join(""),await n([...s.slice(0,l),t])<=r){"last"===i&&(t.content=[...o].reverse().join("")),s=[...s.slice(0,l),t],l+=1;break}}}}if(o){let e=Array.isArray(o)?o:[o];for(;l>0&&!vb(s[l-1],e);)l-=1}return s.slice(0,l)}async function vk(e,t){let{allowPartial:r=!1,includeSystem:n=!1,endOn:a,startOn:i,...o}=t,s=e.map(e=>{let t=Object.fromEntries(Object.entries(e).filter(([e])=>"type"!==e&&!e.startsWith("lc_")));return vA(e.getType(),t,cp(e))});if(a){let e=Array.isArray(a)?a:[a];for(;s.length>0&&!vb(s[s.length-1],e);)s=s.slice(0,-1)}let l=n&&s[0]?.getType()==="system",u=l?s.slice(0,1).concat(s.slice(1).reverse()):s.reverse();return(u=await vS(u,{...o,partialStrategy:r?"last":void 0,endOn:i}),l)?[u[0],...u.slice(1).reverse()]:u.reverse()}let vT={human:{message:cC,messageChunk:cR},ai:{message:cQ,messageChunk:c2},system:{message:cD,messageChunk:cM},developer:{message:cD,messageChunk:cM},tool:{message:cb,messageChunk:cy},function:{message:cT,messageChunk:cA},generic:{message:cE,messageChunk:cx},remove:{message:cP,messageChunk:cP}};function vA(e,t,r){let n,a;switch(e){case"human":r?n=new cR(t):a=new cC(t);break;case"ai":if(r){let e={...t};"tool_calls"in e&&(e={...e,tool_call_chunks:e.tool_calls?.map(e=>({...e,type:"tool_call_chunk",index:void 0,args:JSON.stringify(e.args)}))}),n=new c2(e)}else a=new cQ(t);break;case"system":r?n=new cM(t):a=new cD(t);break;case"developer":r?n=new cM({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}}):a=new cD({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in t)r?n=new cy(t):a=new cb(t);else throw Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new cA(t);else{if(!t.name)throw Error("FunctionMessage must have a 'name' field");a=new cT(t)}break;case"generic":if("role"in t)r?n=new cx(t):a=new cE(t);else throw Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw Error(`Unrecognized message type ${e}`)}if(r&&n)return n;if(a)return a;throw Error(`Unrecognized message type ${e}`)}function vN(e){let t=e.split("\n");return Promise.resolve([...t.slice(0,-1).map(e=>`${e}
|
|
70
|
-
`),t[t.length-1]])}let vI=["text","reasoning","tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result","image","video","audio","text-plain","file"];uR({},{AIMessage:()=>cQ,AIMessageChunk:()=>c2,BaseMessage:()=>cn,BaseMessageChunk:()=>cu,ChatMessage:()=>cE,ChatMessageChunk:()=>cx,DEFAULT_MERGE_IGNORE_KEYS:()=>ci,FunctionMessage:()=>cT,FunctionMessageChunk:()=>cA,HumanMessage:()=>cC,HumanMessageChunk:()=>cR,KNOWN_BLOCK_TYPES:()=>vI,RemoveMessage:()=>cP,SystemMessage:()=>cD,SystemMessageChunk:()=>cM,ToolMessage:()=>cb,ToolMessageChunk:()=>cy,_isMessageFieldWithRole:()=>cc,_mergeDicts:()=>co,_mergeLists:()=>cs,_mergeObj:()=>cl,_mergeStatus:()=>cr,coerceMessageLikeToMessage:()=>c6,collapseToolCallChunks:()=>dr,convertToChunk:()=>dt,convertToOpenAIImageBlock:()=>uj,convertToProviderContentBlock:()=>uU,defaultTextSplitter:()=>vN,defaultToolCallParser:()=>cv,filterMessages:()=>vy,getBufferString:()=>c9,iife:()=>c4,isAIMessage:()=>c0,isAIMessageChunk:()=>c1,isBase64ContentBlock:()=>uP,isBaseMessage:()=>cd,isBaseMessageChunk:()=>cp,isChatMessage:()=>cS,isChatMessageChunk:()=>ck,isDataContentBlock:()=>uO,isDirectToolOutput:()=>cg,isFunctionMessage:()=>cN,isFunctionMessageChunk:()=>cI,isHumanMessage:()=>cO,isHumanMessageChunk:()=>cL,isIDContentBlock:()=>uM,isMessage:()=>uz,isOpenAIToolCallArray:()=>ca,isPlainTextContentBlock:()=>uD,isSystemMessage:()=>cj,isSystemMessageChunk:()=>cF,isToolMessage:()=>c_,isToolMessageChunk:()=>cw,isURLContentBlock:()=>uL,mapChatMessagesToStoredMessages:()=>de,mapStoredMessageToChatMessage:()=>c8,mapStoredMessagesToChatMessages:()=>c7,mergeContent:()=>ct,mergeMessageRuns:()=>v_,mergeResponseMetadata:()=>cf,mergeUsageMetadata:()=>ch,parseBase64DataUrl:()=>u$,parseMimeType:()=>uF,trimMessages:()=>vE});var vC=class{chunks={};constructor(){this.chunks={}}add(e,t){e.type.endsWith("MessageChunk")&&(e.type=e.type.slice(0,-12).toLowerCase());let r="remove"===e.type&&null!=e.id?new cP({...e,id:e.id}):c6(e),n=function(e){try{return dt(e)}catch{return null}}(r),{id:a}=n??r;if(!a)return console.warn("No message ID found for chunk, ignoring in state",e),null;if(this.chunks[a]??={},this.chunks[a].metadata=t??this.chunks[a].metadata,n){let e=this.chunks[a].chunk;this.chunks[a].chunk=(cp(e)?e:null)?.concat(n)??n}else this.chunks[a].chunk=r;return a}clear(){this.chunks={}}get(e,t){return null==e||null==this.chunks[e]?null:(null!=t&&(this.chunks[e].index??=t),this.chunks[e])}};let vR=e=>{let{type:t,data:r}=e.toDict();return{...r,type:t}};var vO=class extends Error{constructor(e){super(e.message),this.name=e.name??e.error??"StreamError"}static isStructuredError(e){return"object"==typeof e&&null!=e&&"message"in e}},vL=class{abortRef=new AbortController;messages;listeners=new Set;state;constructor(e){this.messages=e,this.state={isLoading:!1,values:null,error:void 0}}setState=e=>{this.state={...this.state,...e},this.notifyListeners()};notifyListeners=()=>{this.listeners.forEach(e=>e())};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;get isLoading(){return this.state.isLoading}get values(){return this.state.values?.[0]??null}get error(){return this.state.error}setStreamValues=(e,t="stream")=>{if("function"==typeof e){let[r,n]=this.state.values??[null,"stream"],a=e(r,n);this.setState({values:null!=a?[a,t]:null})}else this.setState({values:null!=e?[e,t]:null})};getMutateFn=(e,t)=>r=>{let n={...t,...(this.state.values??[null,"stream"])[0]},a="function"==typeof r?r(n):r;this.setStreamValues({...n,...a},e)};matchEventType=(e,t,r)=>e===t||t.startsWith(`${e}|`);start=async(e,t)=>{if(!this.state.isLoading)try{let r;for await(let{event:n,data:a}of(this.setState({isLoading:!0,error:void 0}),this.abortRef=new AbortController,await e(this.abortRef.signal))){if("error"===n){r=new vO(a);break}let e=n.includes("|")?n.split("|").slice(1):void 0,i=this.getMutateFn("stream",t.initialValues);if("metadata"===n&&t.callbacks.onMetadataEvent?.(a),"events"===n&&t.callbacks.onLangChainEvent?.(a),this.matchEventType("updates",n,a)&&t.callbacks.onUpdateEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("custom",n,a)&&t.callbacks.onCustomEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("checkpoints",n,a)&&t.callbacks.onCheckpointEvent?.(a,{namespace:e}),this.matchEventType("tasks",n,a)&&t.callbacks.onTaskEvent?.(a,{namespace:e}),this.matchEventType("debug",n,a)&&t.callbacks.onDebugEvent?.(a,{namespace:e}),"values"===n&&("__interrupt__"in a?this.setStreamValues(e=>({...e,...a})):this.setStreamValues(a)),this.matchEventType("messages",n,a)){let[e,r]=a,n=this.messages.add(e,r);if(!n){console.warn("Failed to add message to manager, no message ID found");continue}this.setStreamValues(e=>{let r={...t.initialValues,...e},a=t.getMessages(r).slice(),{chunk:i,index:o}=this.messages.get(n,a.length)??{};return i&&null!=o?("remove"===i.getType()?a.splice(o,1):a[o]=vR(i),t.setMessages(r,a)):r})}}if(null!=r)throw r;let n=await t.onSuccess?.();void 0!==n&&this.setStreamValues(n)}catch(e){e instanceof Error&&("AbortError"===e.name||"TimeoutError"===e.name)||(console.error(e),this.setState({error:e}),await t.onError?.(e))}finally{this.setState({isLoading:!1}),this.abortRef=new AbortController,t.onFinish?.()}};stop=async(e,t)=>{this.abortRef.abort(),this.abortRef=new AbortController,t.onStop?.({mutate:this.getMutateFn("stop",e)})};clear=()=>{this.abortRef.abort(),this.abortRef=new AbortController,this.setState({error:void 0,values:null,isLoading:!1}),this.messages.clear()}};let vP=e=>{let[t,r]=(0,Q.useState)(e?.threadId??null),n=(0,Q.useRef)(e?.onThreadId);n.current=e?.onThreadId;let a=(0,Q.useCallback)(e=>{r(e),n.current?.(e)},[]);return e&&"threadId"in e?[e.threadId??null,a]:[t,a]};function vD(e,t,r){return[e["~configHash"],t,r].join(":")}function vM(e){let[t]=(0,Q.useState)("transport"in e);return t?function(e){let[t]=(0,Q.useState)(()=>new vC),[r]=(0,Q.useState)(()=>new vL(t));(0,Q.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot);let[n,a]=vP(e),i=(0,Q.useRef)(n);(0,Q.useEffect)(()=>{i.current!==n&&(i.current=n,r.clear())},[n,r]);let o=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},s=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},l=e.initialValues??{},u=async(t,u)=>{let c,d=n;r.setStreamValues(()=>u?.optimisticValues!=null?{...l,..."function"==typeof u.optimisticValues?u.optimisticValues(l):u.optimisticValues}:{...l}),await r.start(async r=>{if(d||(i.current=d=crypto.randomUUID(),a(d)),!d)throw Error("Failed to obtain valid thread ID.");return e.transport.stream({input:t,context:u?.context,command:u?.command,signal:r,config:{...u?.config,configurable:{thread_id:d,...u?.config?.configurable}}})},{getMessages:o,setMessages:s,initialValues:{},callbacks:e,onSuccess:()=>void 0,onError(t){e.onError?.(t,c)}})};return{get values(){return r.values??{}},error:r.error,isLoading:r.isLoading,stop:()=>r.stop(l,{onStop:e.onStop}),submit:u,get interrupt(){if(null!=r.values&&"__interrupt__"in r.values&&Array.isArray(r.values.__interrupt__)){let e=r.values.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}return},get messages(){if(!r.values)return[];return o(r.values)}}}(e):function(e){let t,r=(0,Q.useRef)(e.reconnectOnMount),n=(0,Q.useMemo)(()=>{if("u"<typeof window)return null;let e=r.current;return!0===e?window.sessionStorage:"function"==typeof e?e():null},[]),a=(0,Q.useMemo)(()=>e.client??new nP({apiUrl:e.apiUrl,apiKey:e.apiKey,callerOptions:e.callerOptions,defaultHeaders:e.defaultHeaders}),[e.client,e.apiKey,e.apiUrl,e.callerOptions,e.defaultHeaders]),[i]=(0,Q.useState)(()=>new vC),[o]=(0,Q.useState)(()=>new vL(i));(0,Q.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot);let[s,l]=vP(e),u=(0,Q.useRef)([]),c=(0,Q.useCallback)((...e)=>{let t=u.current;for(let r of e)t.includes(r)||t.push(r)},[]),d=null!=e.onUpdateEvent,p=null!=e.onCustomEvent,f=null!=e.onLangChainEvent,m=null!=e.onDebugEvent,h=null!=e.onCheckpointEvent,g=null!=e.onTaskEvent,b=(0,Q.useMemo)(()=>{let e=[];return d&&e.push("updates"),p&&e.push("custom"),f&&e.push("events"),m&&e.push("debug"),h&&e.push("checkpoints"),g&&e.push("tasks"),e},[d,p,f,m,h,g]);(0,Q.useRef)(null).current=o.clear;let y=(0,Q.useRef)(s),v=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{y.current!==s&&(y.current=s,o.clear())},[s,o]);let _="object"==typeof e.fetchStateHistory&&null!=e.fetchStateHistory?e.fetchStateHistory.limit??!1:e.fetchStateHistory??!1,w=function(e,t,r,n){let a=vD(e,t,r),[i,o]=(0,Q.useState)(()=>({key:void 0,data:void 0,error:void 0,isLoading:null!=t})),s=(0,Q.useRef)(e);s.current=e;let l=(0,Q.useRef)(n?.onError);l.current=n?.onError;let u=(0,Q.useCallback)((e,t)=>{if(n.passthrough)return Promise.resolve([]);let r=s.current,a=vD(r,e,t);return null!=e?(o(e=>e.key===a?{...e,isLoading:!0}:{key:a,data:void 0,error:void 0,isLoading:!0}),(function(e,t,r){if(r?.limit===!1)return e.threads.getState(t).then(e=>null==e.checkpoint?[]:[e]);let n="number"==typeof r?.limit?r.limit:10;return e.threads.getHistory(t,{limit:n})})(r,e,{limit:t}).then(e=>(o(t=>t.key!==a?t:{key:a,data:e,error:void 0,isLoading:!1}),e),e=>(o(t=>t.key!==a?t:{key:a,data:t.data,error:e,isLoading:!1}),l.current?.(e),Promise.reject(e)))):(o({key:a,data:void 0,error:void 0,isLoading:!1}),Promise.resolve([]))},[n.passthrough]);return(0,Q.useEffect)(()=>{(null==n.submittingRef.current||n.submittingRef.current!==t)&&u(t,r)},[u,a]),{data:i.data,error:i.error,isLoading:i.isLoading,mutate:e=>u(e??t,r)}}(a,s,_,{passthrough:null!=e.experimental_thread,submittingRef:v,onError:e.onError}),E=e.experimental_thread??w,x=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},S=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},[k,T]=(0,Q.useState)(""),A=function(e,t){let{rootSequence:r,paths:n}=function(e){let t=new Set,r={};if(e.length<=1)return{rootSequence:{type:"sequence",items:e.map(e=>({type:"node",value:e,path:[]}))},paths:[]};e.forEach(e=>{let n=e.parent_checkpoint?.checkpoint_id??"$";r[n]??=[],r[n].push(e),e.checkpoint?.checkpoint_id!=null&&t.add(e.checkpoint.checkpoint_id)});let n=(...e)=>e.filter(e=>null!=e).sort((e,t)=>e.localeCompare(t)).at(-1),a=null==r.$?Object.keys(r).filter(e=>!t.has(e)).map(e=>{let t=[e],a=new Set,i=e;for(;t.length>0;){let e=t.shift();if(a.has(e))continue;a.add(e);let o=(r[e]??[]).flatMap(e=>e.checkpoint?.checkpoint_id??[]);i=n(i,...o),t.push(...o)}return{parentId:e,lastId:i}}).sort((e,t)=>e.lastId.localeCompare(t.lastId)).at(-1)?.parentId:void 0;null!=a&&(r.$=r[a]);let i={type:"sequence",items:[]},o=[{id:"$",sequence:i,path:[]}],s=[],l=new Set;for(;o.length>0;){let e,t=o.shift();if(l.has(t.id))continue;l.add(t.id);let n=r[t.id];if(null!=n&&0!==n.length)for(let r of(n.length>1&&(e={type:"fork",items:[]},t.sequence.items.push(e)),n)){let n=r.checkpoint?.checkpoint_id;if(null==n)continue;let{sequence:a}=t,{path:i}=t;null!=e&&(a={type:"sequence",items:[]},e.items.unshift(a),(i=i.slice()).push(n),s.push(i)),a.items.push({type:"node",value:r,path:i}),o.push({id:n,sequence:a,path:i})}}return{rootSequence:i,paths:s}}(t??[]),{history:a,branchByCheckpoint:i}=function(e,t,r){let n=r.split(">"),a={};for(let e of t){let t=e.at(-2)??"$";a[t]??=[],a[t].unshift(e)}let i=[],o={},s=n.slice(),l=[...e.items];for(;l.length>0;){let e=l.shift();if("node"===e.type){i.push(e.value);let t=e.value.checkpoint?.checkpoint_id;if(null==t)continue;o[t]={branch:e.path.join(">"),branchOptions:(e.path.length>0?a[e.path.at(-2)??"$"]??[]:[]).map(e=>e.join(">"))}}if("fork"===e.type){let t=s.shift(),r=null!=t?e.items.findIndex(e=>{let r=e.items.at(0);return!!r&&"node"===r.type&&r.value.checkpoint?.checkpoint_id===t}):-1,n=e.items.at(r)?.items??[];l.push(...n)}}return{history:i,branchByCheckpoint:o}}(r,n,e);return{branchTree:r,flatHistory:a,branchByCheckpoint:i,threadHead:a.at(-1)}}(k,E.data??void 0),N=A.threadHead?.values??e.initialValues??{},I=(()=>{let e=A.threadHead?.tasks?.at(-1)?.error;if(null!=e){try{let t=JSON.parse(e);if(vO.isStructuredError(t))return new vO(t);return t}catch{}return e}})(),C=(t=new Set,x(N).map((e,r)=>{let n=e.id??r,a=function(e,t){for(let r=e.length-1;r>=0;r-=1)if(t(e[r]))return e[r]}(E.data??[],e=>x(e.values).map((e,t)=>e.id??t).includes(n)),i=a?.checkpoint?.checkpoint_id,o=null!=i?A.branchByCheckpoint[i]:void 0;o?.branch?.length||(o=void 0);let s=o?.branchOptions?.flat(2).join(",");return s&&(t.has(s)&&(o=void 0),t.add(s)),{messageId:n.toString(),firstSeenState:a,branch:o?.branch,branchOptions:o?.branchOptions}})),R=async(t,r)=>{let i,c,d=r?.checkpoint?.checkpoint_id;T(null!=d?A.branchByCheckpoint[d]?.branch??"":"");let p=!0===_||"number"==typeof _,f=null!=e.onFinish||p;o.setStreamValues(()=>{let e=f?N:{...N,...o.values};return r?.optimisticValues!=null?{...e,..."function"==typeof r.optimisticValues?r.optimisticValues(e):r.optimisticValues}:{...e}});let m=s;await o.start(async o=>{if(m||(y.current=m=(await a.threads.create({threadId:r?.threadId,metadata:r?.metadata})).thread_id,v.current=m,l(m)),!m)throw Error("Failed to obtain valid thread ID.");v.current=m;let s=[...new Set([...r?.streamMode??[],...u.current,...b])],d=r?.checkpoint??(p?A.threadHead?.checkpoint:void 0)??void 0;r?.checkpoint===null&&(d=void 0),null!=d&&delete d.thread_id;let f=r?.streamResumable??!!n;return a.runs.stream(m,e.assistantId,{input:t,config:r?.config,context:r?.context,command:r?.command,interruptBefore:r?.interruptBefore,interruptAfter:r?.interruptAfter,metadata:r?.metadata,multitaskStrategy:r?.multitaskStrategy,onCompletion:r?.onCompletion,onDisconnect:r?.onDisconnect??(f?"continue":"cancel"),signal:o,checkpoint:d,streamMode:s,streamSubgraphs:r?.streamSubgraphs,streamResumable:f,durability:r?.durability,onRunCreated(t){i={run_id:t.run_id,thread_id:t.thread_id??m},n&&(c=`lg:stream:${m}`,n.setItem(c,i.run_id)),e.onCreated?.(i)}})},{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){if(c&&n?.removeItem(c),f){let t=await E.mutate(m),r=t?.at(0);if(r)return e.onFinish?.(r,i),null}},onError(t){e.onError?.(t,i)},onFinish(){v.current=null}})},O=async(t,r,i)=>{if(r??="-1",!s)return;let l={thread_id:s,run_id:t};await o.start(async e=>(v.current=s,a.runs.joinStream(s,t,{signal:e,lastEventId:r,streamMode:i?.streamMode})),{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){n?.removeItem(`lg:stream:${s}`);let t=await E.mutate(s),r=t?.at(0);r&&e.onFinish?.(r,l)},onError(t){e.onError?.(t,l)},onFinish(){v.current=null}})},L=(0,Q.useMemo)(()=>{if(!n||o.isLoading||"u"<typeof window)return;let e=n?.getItem(`lg:stream:${s}`);if(e)return{runId:e,threadId:s}},[n,o.isLoading,s]),P=!!n,D=(0,Q.useRef)({threadId:s,shouldReconnect:P}),M=(0,Q.useRef)(O);M.current=O,(0,Q.useEffect)(()=>{D.current.threadId!==s&&(D.current={threadId:s,shouldReconnect:P})},[s,P]),(0,Q.useEffect)(()=>{L&&D.current.shouldReconnect&&(D.current.shouldReconnect=!1,M.current?.(L.runId))},[L]);let j=o.error??I??E.error,F=o.values??N;return{get values(){return c("values"),F},client:a,assistantId:e.assistantId,error:j,isLoading:o.isLoading,stop:()=>o.stop(N,{onStop:t=>{if(n&&s){let e=n.getItem(`lg:stream:${s}`);e&&a.runs.cancel(s,e),n.removeItem(`lg:stream:${s}`)}e.onStop?.(t)}}),submit:R,joinStream:O,branch:k,setBranch:T,get history(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `history`");return A.flatHistory},isThreadLoading:E.isLoading&&null==E.data,get experimental_branchTree(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `experimental_branchTree`");return A.branchTree},get interrupt(){if(null!=F&&"__interrupt__"in F&&Array.isArray(F.__interrupt__)){let e=F.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}if(o.isLoading)return;let e=A.threadHead?.tasks?.at(-1)?.interrupts;if(null==e||0===e.length){if(!(A.threadHead?.next??[]).length||null!=j)return;return{when:"breakpoint"}}return e.at(-1)},get messages(){return c("messages-tuple","values"),x(F)},getMessagesMetadata(e,t){c("values");let r=i.get(e.id)?.metadata,n=C?.find(r=>r.messageId===(e.id??t));if(null!=r||null!=n)return{...n,streamMetadata:r}}}}(e)}let vj="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vF=new Uint8Array(16),v$=[];for(let e=0;e<256;++e)v$.push((e+256).toString(16).slice(1));let vU=function(e,t,r){if(vj&&!t&&!e)return vj();let n=(e=e||{}).random||(e.rng||function(){if(!d&&!(d="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return d(vF)})();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return v$[e[t+0]]+v$[e[t+1]]+v$[e[t+2]]+v$[e[t+3]]+"-"+v$[e[t+4]]+v$[e[t+5]]+"-"+v$[e[t+6]]+v$[e[t+7]]+"-"+v$[e[t+8]]+v$[e[t+9]]+"-"+v$[e[t+10]]+v$[e[t+11]]+v$[e[t+12]]+v$[e[t+13]]+v$[e[t+14]]+v$[e[t+15]]}(n)};function vz(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>e&&"object"==typeof e&&"text"in e?String(e.text??""):"").join(""):""}function vB(e){return"string"==typeof e.content?e.content:Array.isArray(e.content)?e.content.filter(e=>"object"==typeof e&&null!==e&&"type"in e&&"text"===e.type||"string"==typeof e).map(e=>"string"==typeof e?e:"object"==typeof e&&null!==e&&"text"in e&&e.text||"").join(""):""}function vH(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){if(e.description&&"string"==typeof e.description)return e.description;if(e.prompt&&"string"==typeof e.prompt)return e.prompt;if(e.result&&"string"==typeof e.result)return e.result}return JSON.stringify(e,null,2)}function vG(e){let t=0;for(let r of e){let e=r.content;if("string"==typeof e)t+=e.length;else if(Array.isArray(e))for(let r of e){let e=r?.text;"string"==typeof e&&(t+=e.length)}}return t}function vV(e){if(!e||"object"!=typeof e)return null;try{return JSON.stringify(e.value??null)}catch{return null}}function vq({children:e,activeAssistant:t,onHistoryRevalidate:r,thread:n}){let a=function({activeAssistant:e,onHistoryRevalidate:t,thread:r}){let[n,a]=ec("threadId"),i=nj(),[o,s]=(0,Q.useState)({}),l=vM({assistantId:e?.assistant_id||"",client:i??void 0,reconnectOnMount:!0,threadId:n??null,onThreadId:a,defaultHeaders:{"x-auth-scheme":"langsmith"},fetchStateHistory:!0,onFinish:t,onError:t,onCreated:t,onUpdateEvent:(e,t)=>{let r=t?.namespace;if(!r||0===r.length)return;let n=function(e){let t=[];if(!e||"object"!=typeof e)return t;for(let r of Object.values(e)){let e=r?.messages;if(Array.isArray(e))for(let r of e)if("ai"===r.type&&r.tool_calls&&r.tool_calls.length>0)for(let e of r.tool_calls)t.push({kind:"tool_call",id:e.id??"",name:e.name??"tool",args:e.args&&"object"==typeof e.args?e.args:{}});else if("ai"===r.type){let e=vz(r.content).trim();e&&t.push({kind:"text",text:e})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()})}return t}(e);if(0===n.length)return;let a=r.join("|");s(e=>({...e,[a]:[...e[a]??[],...n]}))},experimental_thread:r}),[u,c]=(0,Q.useState)(void 0),[d,p]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e;if(!n){c(void 0),m(null),p(null);return}let t=l.messages.length,r=!1,a=0,o=async()=>{a+=1;try{let s=await i.threads.getState(n);if(r)return;let u=s.values?.messages,d=s.tasks?.at(-1)?.interrupts,f=Array.isArray(d)&&d.length>0?d[d.length-1]:void 0,h=Array.isArray(s.next)&&s.next.length>0;Array.isArray(u)&&u.length>t&&m(u);let g=function(e){if(!e||"object"!=typeof e)return;let t=e.value;if(!t||"object"!=typeof t)return;let r={...t};return"action_requests"in t&&!Array.isArray(t.action_requests)&&(r.action_requests=[]),"review_configs"in t&&!Array.isArray(t.review_configs)&&(r.review_configs=[]),{...e,value:r}}(f);if(g){c(g),p(null),Array.isArray(u)&&m(u);return}if(!h){c(void 0),p(vV(l.interrupt)),Array.isArray(u)&&m(u);return}h&&a<15&&!r&&(e=setTimeout(o,1e3))}catch{!r&&a<15&&(e=setTimeout(o,1e3))}};return o(),()=>{r=!0,e&&clearTimeout(e)}},[n,l.interrupt,l.isLoading,i]);let h=l.interrupt,g=h&&(null===d||vV(h)!==d)?h:u??void 0,b=f&&(f.length>l.messages.length||!l.isLoading&&f.length===l.messages.length&&vG(f)>vG(l.messages))?f:l.messages,y=(0,Q.useCallback)(r=>{c(void 0),m(null),p(null);let n={id:vU(),type:"human",content:r};l.submit({messages:[n]},{optimisticValues:e=>({messages:[...e.messages??[],n]}),config:{...e?.config??{},recursion_limit:100},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,e?.config,t]),v=(0,Q.useCallback)(async e=>{n&&await i.threads.updateState(n,{values:{files:e}})},[i,n]),_=(0,Q.useCallback)(e=>{c(void 0),m(null),p(null),l.submit(null,{command:{resume:e},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,t]),w=(0,Q.useCallback)(()=>{l.stop()},[l]);return{stream:l,todos:l.values.todos??[],files:l.values.files??{},email:l.values.email,asyncTasks:l.values.async_tasks??{},summarizationEvent:function(e){if(!e||"object"!=typeof e)return null;let t=e.summary_message,r="string"==typeof t?.content?t.content:"";if(!r)return null;let n=e.cutoff_index,a=e.file_path;return{cutoffIndex:"number"==typeof n&&n>=0?n:0,content:r,filePath:"string"==typeof a?a:null}}(l.values._summarization_event),ui:l.values.ui,setFiles:v,messages:b,isLoading:l.isLoading,isThreadLoading:l.isThreadLoading,interrupt:g,sendMessage:y,stopStream:w,resumeInterrupt:_,subAgentActivity:o}}({activeAssistant:t,onHistoryRevalidate:r,thread:n});return(0,J.jsx)(vW.Provider,{value:a,children:e})}let vW=(0,Q.createContext)(void 0);function vZ(){let e=(0,Q.useContext)(vW);if(void 0===e)throw Error("useChatContext must be used within a ChatProvider");return e}let vK=ro("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),vY=ro("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),vX=ro("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),vJ=ro("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),vQ=ro("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),v0=ro("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),v1=ro("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),v2=ro("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),v4=ro("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),v3=ro("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),v5=ro("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),v6=ro("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),v9=Q.default.memo(({subAgent:e,onClick:t,isExpanded:r=!0})=>{let n="pending"===e.status;return(0,J.jsx)("div",{className:"w-fit max-w-[70vw] overflow-hidden rounded-lg bg-card",children:(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:t,className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left",children:[(0,J.jsx)("span",{className:"bg-[var(--brand)]/10 flex size-5 shrink-0 items-center justify-center rounded-md text-[var(--brand)]",children:n?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(v6,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("span",{className:"truncate text-sm font-semibold text-foreground",children:e.subAgentName}),(0,J.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:"subagent"}),r?(0,J.jsx)(li,{size:14,className:"ml-auto shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"ml-auto shrink-0 text-muted-foreground"})]})})});v9.displayName="SubAgentIndicator";let v8=ro("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),v7=ro("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),_e=ro("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),_t=Q.createContext(null);function _r(){let e=Q.useContext(_t);if(!e)throw Error("useStreamContext must be used within a LoadExternalComponent");return new Proxy(e,{get:(e,t)=>"meta"===t?e.meta:e.stream[t]})}let _n=new class{cache={};boundCache={};callbacks={};respond(e,t,r){this.cache[e]={comp:t,target:r},this.callbacks[e]?.forEach(e=>e(t,r))}getBoundStore(e){return this.boundCache[e]??={subscribe:t=>(this.callbacks[e]??=[],this.callbacks[e].push(t),()=>{this.callbacks[e]=this.callbacks[e].filter(e=>e!==t)}),getSnapshot:()=>this.cache[e]},this.boundCache[e]}},_a=Symbol.for("LGUI_EXT_STORE"),_i=Symbol.for("LGUI_REQUIRE"),_o=Symbol.for("LGUI_REQUIRE_EXTRA");function _s({stream:e,namespace:t,message:r,meta:n,fallback:a,components:i,...o}){let s=Q.useRef(null),l=Q.useId(),u=`child-shadow-${l}`,c=Q.useMemo(()=>_n.getBoundStore(u),[u]),d=Q.useSyncExternalStore(c.subscribe,c.getSnapshot),p=i?.[r.name],f=null!=p,m=null;(e=>!!Q.isValidElement(e)||null==e||"string"==typeof e||"number"==typeof e||"bigint"==typeof e||"boolean"==typeof e||null!=e&&"object"==typeof e&&Symbol.iterator in e||null!=e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then)(a)?m=a:"object"==typeof a&&null!=a&&(m=a?.[r.name]);let h=t??e.assistantId,g=e.client["~ui"];return(Q.useEffect(()=>{f||g.getComponent(h,r.name).then(e=>{let t=s.current;if(!t)return;let r=t.shadowRoot??t.attachShadow({mode:"open"}),n=document.createRange().createContextualFragment(e.replace("{{shadowRootId}}",u));r.appendChild(n)})},[g,h,r.name,u,f]),f)?(0,J.jsx)(_t.Provider,{value:{stream:e,meta:n},children:Q.createElement(p,r.props)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{id:u,ref:s,...o}),(0,J.jsx)(_t.Provider,{value:{stream:e,meta:n},children:d?.target!=null?ek.createPortal(Q.createElement(d.comp,r.props),d.target):m})]})}"u">typeof window&&(window[_a]=_n,window[_i]=e=>{if("react"===e)return Q;if("react-dom"===e)return ek;if("react/jsx-runtime"===e)return J;if("@langchain/langgraph-sdk/react"===e)return{useStream:vM};if("@langchain/langgraph-sdk/react-ui"===e)return{useStreamContext:_r,LoadExternalComponent:()=>{throw Error("Nesting LoadExternalComponent is not supported")}};if(null!=window[_o]&&"object"==typeof window[_o]&&e in window[_o])return window[_o][e];throw Error(`Unknown module...: ${e}`)});let _l=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)("textarea",{className:rZ("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));function _u({actionRequest:e,reviewConfig:t,onResume:r,isLoading:n,onSubmitted:a}){let[i,o]=(0,Q.useState)(""),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)({}),[d,p]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(!1),h=t?.allowedDecisions??t?.allowed_decisions??["approve","reject","edit"],g=e=>{(0,ek.flushSync)(()=>{m(!0),a&&a()}),r(e)};return f?null:(0,J.jsxs)("div",{className:"w-full rounded-md border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(v7,{size:16,className:"text-yellow-600 dark:text-yellow-400"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Approval Required"})]}),e.description&&(0,J.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:e.description}),(0,J.jsxs)("div",{className:"mb-4 rounded-sm border border-border bg-background p-3",children:[(0,J.jsxs)("div",{className:"mb-2",children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool"}),(0,J.jsx)("p",{className:"mt-1 font-mono text-sm font-medium text-foreground",children:e.name})]}),s?(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Edit Arguments"}),(0,J.jsx)("div",{className:"mt-2 space-y-3",children:Object.entries(e.args).map(([e,t])=>(0,J.jsxs)("div",{children:[(0,J.jsx)("label",{className:"mb-1 block text-xs font-medium text-foreground",children:e}),(0,J.jsx)(_l,{value:void 0!==u[e]?"string"==typeof u[e]?u[e]:JSON.stringify(u[e],null,2):"string"==typeof t?t:JSON.stringify(t,null,2),onChange:t=>((e,t)=>{try{let r=t.trim().startsWith("{")||t.trim().startsWith("[")?JSON.parse(t):t;c(t=>({...t,[e]:r}))}catch{c(r=>({...r,[e]:t}))}})(e,t.target.value),className:"font-mono text-xs",rows:"string"==typeof t&&t.length<100?2:4,disabled:n})]},e))})]}):(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("pre",{className:"mt-2 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs text-foreground",children:JSON.stringify(e.args,null,2)})]})]}),d&&!s&&(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("label",{className:"mb-2 block text-xs font-medium text-foreground",children:"Rejection Message (optional)"}),(0,J.jsx)(_l,{value:i,onChange:e=>o(e.target.value),placeholder:"Explain why you're rejecting this action…",className:"text-sm",rows:2,disabled:n})]}),(0,J.jsx)("div",{className:"flex flex-wrap gap-2",children:s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!1),c({})},disabled:n,children:"Cancel"}),(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{s&&(g({decisions:[{type:"edit",edited_action:{name:e.name,args:u}}]}),l(!1),c({}))},disabled:n,className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",children:[(0,J.jsx)(ln,{size:14}),n?"Saving…":"Save & Approve"]})]}):d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{p(!1),o("")},disabled:n,children:"Cancel"}),(0,J.jsx)(na,{type:"button",variant:"destructive",size:"sm",onClick:()=>{g({decisions:[{type:"reject",message:i.trim()}]})},disabled:n,children:n?"Rejecting…":"Confirm Reject"})]}):(0,J.jsxs)(J.Fragment,{children:[h.includes("reject")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{d?g({decisions:[{type:"reject",message:i.trim()}]}):p(!0)},disabled:n,className:"text-destructive hover:bg-destructive/10",children:[(0,J.jsx)(rs,{size:14}),"Reject"]}),h.includes("edit")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!0),c(JSON.parse(JSON.stringify(e.args))),p(!1)},disabled:n,children:[(0,J.jsx)(a4,{size:14}),"Edit"]}),h.includes("approve")&&(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{g({decisions:[{type:"approve"}]})},disabled:n,className:rZ("bg-green-600 text-white hover:bg-green-700","dark:bg-green-600 dark:hover:bg-green-700"),children:[(0,J.jsx)(ln,{size:14}),n?"Approving…":"Approve"]})]})})]})}_l.displayName="Textarea";let _c=Q.default.memo(({toolCall:e,uiComponent:t,stream:r,graphId:n,actionRequest:a,actionRequestKey:i,actionRequestSubmitted:o,onActionRequestSubmitted:s,reviewConfig:l,onResume:u,isLoading:c,autoApprove:d,compact:p=!1})=>{let[f,m]=(0,Q.useState)(()=>!!t||!!a&&!d),[h,g]=(0,Q.useState)({}),b=(0,Q.useMemo)(()=>a?`${e.id}:${a.name}:${JSON.stringify(a.args)}`:null,[a,e.id]),y=i??b,[v,_]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{y?_(e=>e&&e!==y?null:e):_(null)},[y]),(0,Q.useEffect)(()=>{t&&m(!0)},[t]);let w=(0,Q.useRef)(a);(0,Q.useEffect)(()=>{let e=!!w.current,t=!!a;!t||e||d?!t&&e&&m(!1):m(!0),w.current=a},[a,d]);let{name:E,args:x,result:S,status:k}=(0,Q.useMemo)(()=>{let t=e.args;return{name:function(e,t){if(!e)return"Unknown Tool";if("ToolSelectionResponse"===e)return"Adaptive tool selection";let r=e.toLowerCase();if("think_tool"===r)return"Reflection";if("read_file"===r||"write_file"===r||"edit_file"===r){let e,n=function(e){if(e&&"object"==typeof e)return e;if("string"==typeof e)try{let t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch{}return{}}(t),a=String(n.path??n.file_path??"");if("/memories"===(e=(a||"").trim())||e.startsWith("/memories/"))return"read_file"===r?"Reading memory":"Updating memory";if("read_file"===r){let e=function(e){let t=(e||"").trim();if(!t.startsWith("/skills/"))return"";let[r]=t.slice(8).split("/");return r||""}(a);if(e)return`Skill: ${e}`}}return e}(e.name,t),args:t&&"object"==typeof t?t:{},result:e.result,status:e.status||"completed"}},[e]),T=(0,Q.useMemo)(()=>{switch(k){case"completed":return(0,J.jsx)(vX,{});case"error":return(0,J.jsx)(v7,{size:14,className:"text-destructive"});case"pending":return(0,J.jsx)(a1,{size:14,className:"animate-spin"});case"interrupted":return(0,J.jsx)(_e,{size:14,className:"text-orange-500"});default:return(0,J.jsx)(v8,{size:14,className:"text-muted-foreground"})}},[k]),A=(0,Q.useCallback)(()=>{m(e=>!e)},[]),N=(0,Q.useCallback)(e=>{g(t=>({...t,[e]:!t[e]}))},[]),I=S||Object.keys(x).length>0,C=o??v===y,R=a&&u&&(!y||!C);return(0,J.jsxs)("div",{className:rZ("w-full overflow-hidden rounded-lg border-none shadow-none outline-none transition-colors duration-200 focus-within:ring-2 focus-within:ring-ring hover:bg-accent",p&&"rounded-md",f&&I&&"bg-accent"),children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",onClick:A,className:rZ("flex w-full items-center justify-between gap-2 border-none px-2 py-2 text-left shadow-none outline-none disabled:cursor-default",p&&"h-auto min-h-8 py-1.5"),disabled:!I,children:(0,J.jsxs)("div",{className:"flex w-full items-center justify-between gap-2",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[T,(0,J.jsx)("span",{className:rZ("text-[15px] font-medium tracking-[-0.6px] text-foreground",p&&"text-xs tracking-normal"),children:E})]}),I&&(f?(0,J.jsx)(li,{size:14,className:"shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"shrink-0 text-muted-foreground"}))]})}),f&&I&&(0,J.jsx)("div",{className:rZ("px-4 pb-4",p&&"px-2 pb-2"),children:t&&r&&n?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_s,{stream:r,message:t,namespace:n,meta:{status:k,args:x,result:S??"No Result Yet"}},t.id)}):R?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_u,{actionRequest:a,reviewConfig:l,onResume:u,isLoading:c,onSubmitted:()=>{_(y),y&&s?.(y),m(!1)}})}):(0,J.jsxs)(J.Fragment,{children:[Object.keys(x).length>0&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("div",{className:"space-y-2",children:Object.entries(x).map(([e,t])=>(0,J.jsxs)("div",{className:"rounded-sm border border-border",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>N(e),className:"flex w-full items-center justify-between bg-muted/30 p-2 text-left text-xs font-medium transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,J.jsx)("span",{className:"font-mono",children:e}),h[e]?(0,J.jsx)(li,{size:12,className:"text-muted-foreground"}):(0,J.jsx)(la,{size:12,className:"text-muted-foreground"})]}),h[e]&&(0,J.jsx)("div",{className:rZ("border-t border-border bg-muted/20 p-2",p&&"p-1.5"),children:(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all font-mono text-xs leading-6 text-foreground",p&&"text-[11px] leading-5"),children:"string"==typeof t?t:JSON.stringify(t,null,2)})})]},e))})]}),S&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Result"}),(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs leading-7 text-foreground",p&&"p-1.5 text-[11px] leading-5"),children:"string"==typeof S?S:JSON.stringify(S,null,2)})]})]})})]})});function _d(){}function _p(){}_c.displayName="ToolCallBox";let _f=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_m=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_h={};function _g(e,t){return((t||_h).jsx?_m:_f).test(e)}let _b=/[ \t\n\f\r]/g;function _y(e){return""===e.replace(_b,"")}class _v{constructor(e,t){this.attribute=t,this.property=e}}_v.prototype.attribute="",_v.prototype.booleanish=!1,_v.prototype.boolean=!1,_v.prototype.commaOrSpaceSeparated=!1,_v.prototype.commaSeparated=!1,_v.prototype.defined=!1,_v.prototype.mustUseProperty=!1,_v.prototype.number=!1,_v.prototype.overloadedBoolean=!1,_v.prototype.property="",_v.prototype.spaceSeparated=!1,_v.prototype.space=void 0;let __=0,_w=_N(),_E=_N(),_x=_N(),_S=_N(),_k=_N(),_T=_N(),_A=_N();function _N(){return 2**++__}e.s(["boolean",0,_w,"booleanish",0,_E,"commaOrSpaceSeparated",0,_A,"commaSeparated",0,_T,"number",0,_S,"overloadedBoolean",0,_x,"spaceSeparated",0,_k],744);var _I=e.i(744);let _C=Object.keys(_I);class _R extends _v{constructor(e,t,r,n){let a=-1;if(super(e,t),function(e,t,r){r&&(e[t]=r)}(this,"space",n),"number"==typeof r)for(;++a<_C.length;){const e=_C[a];!function(e,t,r){r&&(e[t]=r)}(this,_C[a],(r&_I[e])===_I[e])}}}function _O(e){return e.toLowerCase()}_R.prototype.defined=!0;let _L=/[A-Z]/g,_P=/-[a-z]/g,_D=/^data[-\w.:]+$/i;function _M(e){return"-"+e.toLowerCase()}function _j(e){return e.charAt(1).toUpperCase()}let _F={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class _${constructor(e,t,r){this.normal=t,this.property=e,r&&(this.space=r)}}function _U(e,t){let r={},n={};for(let t of e)Object.assign(r,t.property),Object.assign(n,t.normal);return new _$(r,n,t)}function _z(e){let t={},r={};for(let[n,a]of Object.entries(e.properties)){let i=new _R(n,e.transform(e.attributes||{},n),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[_O(n)]=n,r[_O(i.attribute)]=n}return new _$(t,r,e.space)}_$.prototype.normal={},_$.prototype.property={},_$.prototype.space=void 0;let _B=_z({properties:{ariaActiveDescendant:null,ariaAtomic:_E,ariaAutoComplete:null,ariaBusy:_E,ariaChecked:_E,ariaColCount:_S,ariaColIndex:_S,ariaColSpan:_S,ariaControls:_k,ariaCurrent:null,ariaDescribedBy:_k,ariaDetails:null,ariaDisabled:_E,ariaDropEffect:_k,ariaErrorMessage:null,ariaExpanded:_E,ariaFlowTo:_k,ariaGrabbed:_E,ariaHasPopup:null,ariaHidden:_E,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_k,ariaLevel:_S,ariaLive:null,ariaModal:_E,ariaMultiLine:_E,ariaMultiSelectable:_E,ariaOrientation:null,ariaOwns:_k,ariaPlaceholder:null,ariaPosInSet:_S,ariaPressed:_E,ariaReadOnly:_E,ariaRelevant:null,ariaRequired:_E,ariaRoleDescription:_k,ariaRowCount:_S,ariaRowIndex:_S,ariaRowSpan:_S,ariaSelected:_E,ariaSetSize:_S,ariaSort:null,ariaValueMax:_S,ariaValueMin:_S,ariaValueNow:_S,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function _H(e,t){return t in e?e[t]:t}function _G(e,t){return _H(e,t.toLowerCase())}let _V=_z({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_T,acceptCharset:_k,accessKey:_k,action:null,allow:null,allowFullScreen:_w,allowPaymentRequest:_w,allowUserMedia:_w,alt:null,as:null,async:_w,autoCapitalize:null,autoComplete:_k,autoFocus:_w,autoPlay:_w,blocking:_k,capture:null,charSet:null,checked:_w,cite:null,className:_k,cols:_S,colSpan:null,content:null,contentEditable:_E,controls:_w,controlsList:_k,coords:_S|_T,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_w,defer:_w,dir:null,dirName:null,disabled:_w,download:_x,draggable:_E,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_w,formTarget:null,headers:_k,height:_S,hidden:_x,high:_S,href:null,hrefLang:null,htmlFor:_k,httpEquiv:_k,id:null,imageSizes:null,imageSrcSet:null,inert:_w,inputMode:null,integrity:null,is:null,isMap:_w,itemId:null,itemProp:_k,itemRef:_k,itemScope:_w,itemType:_k,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_w,low:_S,manifest:null,max:null,maxLength:_S,media:null,method:null,min:null,minLength:_S,multiple:_w,muted:_w,name:null,nonce:null,noModule:_w,noValidate:_w,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_w,optimum:_S,pattern:null,ping:_k,placeholder:null,playsInline:_w,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_w,referrerPolicy:null,rel:_k,required:_w,reversed:_w,rows:_S,rowSpan:_S,sandbox:_k,scope:null,scoped:_w,seamless:_w,selected:_w,shadowRootClonable:_w,shadowRootDelegatesFocus:_w,shadowRootMode:null,shape:null,size:_S,sizes:null,slot:null,span:_S,spellCheck:_E,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_S,step:null,style:null,tabIndex:_S,target:null,title:null,translate:null,type:null,typeMustMatch:_w,useMap:null,value:_E,width:_S,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_k,axis:null,background:null,bgColor:null,border:_S,borderColor:null,bottomMargin:_S,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_w,declare:_w,event:null,face:null,frame:null,frameBorder:null,hSpace:_S,leftMargin:_S,link:null,longDesc:null,lowSrc:null,marginHeight:_S,marginWidth:_S,noResize:_w,noHref:_w,noShade:_w,noWrap:_w,object:null,profile:null,prompt:null,rev:null,rightMargin:_S,rules:null,scheme:null,scrolling:_E,standby:null,summary:null,text:null,topMargin:_S,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_S,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_w,disableRemotePlayback:_w,prefix:null,property:null,results:_S,security:null,unselectable:null},space:"html",transform:_G}),_q=_z({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:_A,accentHeight:_S,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_S,amplitude:_S,arabicForm:null,ascent:_S,attributeName:null,attributeType:null,azimuth:_S,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_S,by:null,calcMode:null,capHeight:_S,className:_k,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:_S,diffuseConstant:_S,direction:null,display:null,dur:null,divisor:_S,dominantBaseline:null,download:_w,dx:null,dy:null,edgeMode:null,editable:null,elevation:_S,enableBackground:null,end:null,event:null,exponent:_S,externalResourcesRequired:null,fill:null,fillOpacity:_S,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_T,g2:_T,glyphName:_T,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_S,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_S,horizOriginX:_S,horizOriginY:_S,id:null,ideographic:_S,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_S,k:_S,k1:_S,k2:_S,k3:_S,k4:_S,kernelMatrix:_A,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_S,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:_S,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:_S,overlineThickness:_S,paintOrder:null,panose1:null,path:null,pathLength:_S,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_k,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_S,pointsAtY:_S,pointsAtZ:_S,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_A,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_A,rev:_A,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_A,requiredFeatures:_A,requiredFonts:_A,requiredFormats:_A,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:_S,specularExponent:_S,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_S,strikethroughThickness:_S,string:null,stroke:null,strokeDashArray:_A,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_S,strokeOpacity:_S,strokeWidth:null,style:null,surfaceScale:_S,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_A,tabIndex:_S,tableValues:null,target:null,targetX:_S,targetY:_S,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_A,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_S,underlineThickness:_S,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_S,values:null,vAlphabetic:_S,vMathematical:_S,vectorEffect:null,vHanging:_S,vIdeographic:_S,version:null,vertAdvY:_S,vertOriginX:_S,vertOriginY:_S,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_S,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_H}),_W=_z({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),_Z=_z({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_G}),_K=_z({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),_Y=_U([_B,_V,_W,_Z,_K],"html"),_X=_U([_B,_q,_W,_Z,_K],"svg");var _J=e.i(15511);let _Q=_1("end"),_0=_1("start");function _1(e){return function(t){let r=t&&t.position&&t.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function _2(e){return e&&"object"==typeof e?"position"in e||"type"in e?_3(e.position):"start"in e||"end"in e?_3(e):"line"in e||"column"in e?_4(e):"":""}function _4(e){return _5(e&&e.line)+":"+_5(e&&e.column)}function _3(e){return _4(e&&e.start)+"-"+_4(e&&e.end)}function _5(e){return e&&"number"==typeof e?e:1}class _6 extends Error{constructor(e,t,r){super(),"string"==typeof t&&(r=t,t=void 0);let n="",a={},i=!1;if(t&&(a="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!a.cause&&e&&(i=!0,n=e.message,a.cause=e),!a.ruleId&&!a.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){const e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=o?o.line:void 0,this.name=_2(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=i&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_6.prototype.file="",_6.prototype.name="",_6.prototype.reason="",_6.prototype.message="",_6.prototype.stack="",_6.prototype.column=void 0,_6.prototype.line=void 0,_6.prototype.ancestors=void 0,_6.prototype.cause=void 0,_6.prototype.fatal=void 0,_6.prototype.place=void 0,_6.prototype.ruleId=void 0,_6.prototype.source=void 0;let _9={}.hasOwnProperty,_8=new Map,_7=/[A-Z]/g,we=new Set(["table","tbody","thead","tfoot","tr"]),wt=new Set(["td","th"]),wr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wn(e,t,r){var n,a,i,o,s,l,u,c,d;let p,f,m,h,g,b,y,v,_,w,E;return"element"===t.type?(n=e,a=t,i=r,f=p=n.schema,"svg"===a.tagName.toLowerCase()&&"html"===p.space&&(n.schema=_X),n.ancestors.push(a),m=ws(n,a.tagName,!1),h=function(e,t){let r,n,a={};for(n in t.properties)if("children"!==n&&_9.call(t.properties,n)){let i=function(e,t,r){let n=function(e,t){let r=_O(t),n=t,a=_v;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&_D.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(_P,_j);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_P.test(e)){let r=e.replace(_L,_M);"-"!==r.charAt(0)&&(r="-"+r),t="data"+r}}a=_R}return new a(n,t)}(e.schema,t);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){var a;let t;if(Array.isArray(r)&&(r=n.commaSeparated?(t={},(""===(a=r)[a.length-1]?[...a,""]:a).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):r.join(" ").trim()),"style"===n.property){let t="object"==typeof r?r:function(e,t){try{return(0,_J.default)(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};let t=new _6("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=wr+"#cannot-parse-style-attribute",t}}(e,String(r));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,r={};for(t in e)_9.call(e,t)&&(r[function(e){let t=e.replace(_7,wu);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return r}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&n.space?_F[n.property]||n.property:n.attribute,r]}}(e,n,t.properties[n]);if(i){let[n,o]=i;e.tableCellAlignToStyle&&"align"===n&&"string"==typeof o&&wt.has(t.tagName)?r=o:a[n]=o}}return r&&((a.style||(a.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),a}(n,a),g=wo(n,a),we.has(a.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&_y(e.value):_y(e))})),wa(n,h,m,a),wi(h,g),n.ancestors.pop(),n.schema=p,n.create(a,m,h,i)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return _d("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}wl(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=r,y=b=o.schema,"svg"===s.name&&"html"===b.space&&(o.schema=_X),o.ancestors.push(s),v=null===s.name?o.Fragment:ws(o,s.name,!0),_=function(e,t){let r={};for(let n of t.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&e.evaluater){let t=n.data.estree.body[0];_d("ExpressionStatement"===t.type);let a=t.expression;_d("ObjectExpression"===a.type);let i=a.properties[0];_d("SpreadElement"===i.type),Object.assign(r,e.evaluater.evaluateExpression(i.argument))}else wl(e,t.position);else{let a,i=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&e.evaluater){let t=n.value.data.estree.body[0];_d("ExpressionStatement"===t.type),a=e.evaluater.evaluateExpression(t.expression)}else wl(e,t.position);else a=null===n.value||n.value;r[i]=a}return r}(o,s),w=wo(o,s),wa(o,_,v,s),wi(_,w),o.ancestors.pop(),o.schema=b,o.create(s,v,_,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wl(e,t.position)}(e,t):"root"===t.type?(u=e,c=t,d=r,wi(E={},wo(u,c)),u.create(c,u.Fragment,E,d)):"text"===t.type?t.value:void 0}function wa(e,t,r,n){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(t.node=n)}function wi(e,t){if(t.length>0){let r=t.length>1?t:t[0];r&&(e.children=r)}}function wo(e,t){let r=[],n=-1,a=e.passKeys?new Map:_8;for(;++n<t.children.length;){let i,o=t.children[n];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=a.get(e)||0;i=e+"-"+t,a.set(e,t+1)}}let s=wn(e,o,i);void 0!==s&&r.push(s)}return r}function ws(e,t,r){let n;if(r)if(t.includes(".")){let e,r=t.split("."),a=-1;for(;++a<r.length;){let t=_g(r[a])?{type:"Identifier",name:r[a]}:{type:"Literal",value:r[a]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(a&&"Literal"===t.type),optional:!1}:t}_d(e,"always a result"),n=e}else n=_g(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else n={type:"Literal",value:t};if("Literal"===n.type){let t=n.value;return _9.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(n);wl(e)}function wl(e,t){let r=new _6("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=wr+"#cannot-handle-mdx-estrees-without-createevaluater",r}function wu(e){return"-"+e.toLowerCase()}let wc={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},wd={};function wp(e,t){let r=t||wd;return wf(e,"boolean"!=typeof r.includeImageAlt||r.includeImageAlt,"boolean"!=typeof r.includeHtml||r.includeHtml)}function wf(e,t,r){var n;if((n=e)&&"object"==typeof n){if("value"in e)return"html"!==e.type||r?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wm(e.children,t,r)}return Array.isArray(e)?wm(e,t,r):""}function wm(e,t,r){let n=[],a=-1;for(;++a<e.length;)n[a]=wf(e[a],t,r);return n.join("")}function wh(e,t,r,n){let a,i=e.length,o=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,r=r>0?r:0,n.length<1e4)(a=Array.from(n)).unshift(t,r),e.splice(...a);else for(r&&e.splice(t,r);o<n.length;)(a=n.slice(o,o+1e4)).unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function wg(e,t){return e.length>0?(wh(e,e.length,0,t),e):t}let wb={}.hasOwnProperty;function wy(e){let t={},r=-1;for(;++r<e.length;)!function(e,t){let r;for(r in t){let n,a=(wb.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];if(i)for(n in i){wb.call(a,n)||(a[n]=[]);let e=i[n];!function(e,t){let r=-1,n=[];for(;++r<t.length;)("after"===t[r].add?e:n).push(t[r]);wh(e,0,0,n)}(a[n],Array.isArray(e)?e:e?[e]:[])}}}(t,e[r]);return t}let wv=wR(/[A-Za-z]/),w_=wR(/[\dA-Za-z]/),ww=wR(/[#-'*+\--9=?A-Z^-~]/);function wE(e){return null!==e&&(e<32||127===e)}let wx=wR(/\d/),wS=wR(/[\dA-Fa-f]/),wk=wR(/[!-/:-@[-`{-~]/);function wT(e){return null!==e&&e<-2}function wA(e){return null!==e&&(e<0||32===e)}function wN(e){return -2===e||-1===e||32===e}let wI=wR(/\p{P}|\p{S}/u),wC=wR(/\s/);function wR(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wO(e,t,r,n){let a=n?n-1:1/0,i=0;return function(n){return wN(n)?(e.enter(r),function n(o){return wN(o)&&i++<a?(e.consume(o),n):(e.exit(r),t(o))}(n)):t(n)}}let wL={tokenize:function(e){let t,r=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(n){let a=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=a),t=a,function t(n){if(null===n){e.exit("chunkText"),e.exit("paragraph"),e.consume(n);return}return wT(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),t)}(n)}(r)});return r}},wP={tokenize:function(e){let t,r,n,a=this,i=[],o=0;return s;function s(t){if(o<i.length){let r=i[o];return a.containerState=r[1],e.attempt(r[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,a.containerState._closeFlow){let r;a.containerState._closeFlow=void 0,t&&b();let n=a.events.length,i=n;for(;i--;)if("exit"===a.events[i][0]&&"chunkFlow"===a.events[i][1].type){r=a.events[i][1].end;break}g(o);let s=n;for(;s<a.events.length;)a.events[s][1].end={...r},s++;return wh(a.events,i+1,0,a.events.slice(n)),a.events.length=s,u(e)}return s(e)}function u(r){if(o===i.length){if(!t)return p(r);if(t.currentConstruct&&t.currentConstruct.concrete)return m(r);a.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(wD,c,d)(r)}function c(e){return t&&b(),g(o),p(e)}function d(e){return a.parser.lazy[a.now().line]=o!==i.length,n=a.now().offset,m(e)}function p(t){return a.containerState={},e.attempt(wD,f,m)(t)}function f(e){return o++,i.push([a.currentConstruct,a.containerState]),p(e)}function m(n){if(null===n){t&&b(),g(0),e.consume(n);return}return t=t||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:r}),function t(r){if(null===r){h(e.exit("chunkFlow"),!0),g(0),e.consume(r);return}return wT(r)?(e.consume(r),h(e.exit("chunkFlow")),o=0,a.interrupt=void 0,s):(e.consume(r),t)}(n)}function h(e,i){let s=a.sliceStream(e);if(i&&s.push(null),e.previous=r,r&&(r.next=e),r=e,t.defineSkip(e.start),t.write(s),a.parser.lazy[e.start.line]){let e,r,i=t.events.length;for(;i--;)if(t.events[i][1].start.offset<n&&(!t.events[i][1].end||t.events[i][1].end.offset>n))return;let s=a.events.length,l=s;for(;l--;)if("exit"===a.events[l][0]&&"chunkFlow"===a.events[l][1].type){if(e){r=a.events[l][1].end;break}e=!0}for(g(o),i=s;i<a.events.length;)a.events[i][1].end={...r},i++;wh(a.events,l+1,0,a.events.slice(s)),a.events.length=i}}function g(t){let r=i.length;for(;r-- >t;){let t=i[r];a.containerState=t[1],t[0].exit.call(a,e)}i.length=t}function b(){t.write([null]),r=void 0,t=void 0,a.containerState._closeFlow=void 0}}},wD={tokenize:function(e,t,r){return wO(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},wM={partial:!0,tokenize:function(e,t,r){return function(t){return wN(t)?wO(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||wT(e)?t(e):r(e)}}};class wj{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let r=null==t?1/0:t;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){this.setCursor(Math.trunc(e));let n=this.right.splice(this.right.length-(t||0),1/0);return r&&wF(this.left,r),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),wF(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wF(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);wF(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wF(this.left,t.reverse())}}}function wF(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function w$(e){let t,r,n,a,i,o,s,l={},u=-1,c=new wj(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((n=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[n][1].type&&(n+=2),n<o.length&&"content"===o[n][1].type))for(;++n<o.length&&"content"!==o[n][1].type;)"chunkText"===o[n][1].type&&(o[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let r,n,a=e.get(t)[1],i=e.get(t)[2],o=t-1,s=[],l=a._tokenizer;!l&&(l=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},p=-1,f=a,m=0,h=0,g=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(r=i.sliceStream(f),f.next||r.push(null),n&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(r),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),n=f,f=f.next}for(f=a;++p<u.length;)"exit"===u[p][0]&&"enter"===u[p-1][0]&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(h=p+1,g.push(h),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),p=g.length;p--;){let t=u.slice(g[p],g[p+1]),r=s.pop();c.push([r,r+t.length-1]),e.splice(r,2,t)}for(c.reverse(),p=-1;++p<c.length;)d[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return d}(c,u)),u=l[u],s=!0);else if(t[1]._container){for(n=u,r=void 0;n--;)if("lineEnding"===(a=c.get(n))[1].type||"lineEndingBlank"===a[1].type)"enter"===a[0]&&(r&&(c.get(r)[1].type="lineEndingBlank"),a[1].type="lineEnding",r=n);else if("linePrefix"===a[1].type||"listItemIndent"===a[1].type);else break;r&&(t[1].end={...c.get(r)[1].start},(i=c.slice(r,u)).unshift(t),c.splice(r,u-r+1,i))}}return wh(e,0,1/0,c.slice(0)),!s}let wU={resolve:function(e){return w$(e),e},tokenize:function(e,t){let r;return function(t){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?a(t):wT(t)?e.check(wz,i,a)(t):(e.consume(t),n)}function a(r){return e.exit("chunkContent"),e.exit("content"),t(r)}function i(t){return e.consume(t),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}},wz={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,a,"linePrefix")};function a(a){if(null===a||wT(a))return r(a);let i=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(a):e.interrupt(n.parser.constructs.flow,r,t)(a)}}},wB={tokenize:function(e){let t=this,r=e.attempt(wM,function(n){return null===n?void e.consume(n):(e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,n,wO(e,e.attempt(this.parser.constructs.flow,n,e.attempt(wU,n)),"linePrefix")));return r;function n(n){return null===n?void e.consume(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,r)}}},wH={resolveAll:wW()},wG=wq("string"),wV=wq("text");function wq(e){return{resolveAll:wW("text"===e?wZ:void 0),tokenize:function(t){let r=this,n=this.parser.constructs[e],a=t.attempt(n,i,o);return i;function i(e){return l(e)?a(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),a(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=n[e],a=-1;if(t)for(;++a<t.length;){let e=t[a];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function wW(e){return function(t,r){let n,a=-1;for(;++a<=t.length;)void 0===n?t[a]&&"data"===t[a][1].type&&(n=a,a++):t[a]&&"data"===t[a][1].type||(a!==n+2&&(t[n][1].end=t[a-1][1].end,t.splice(n+2,a-n-2),a=n+2),n=void 0);return e?e(t,r):t}}function wZ(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let n,a=e[r-1][1],i=t.sliceStream(a),o=i.length,s=-1,l=0;for(;o--;){let e=i[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)n=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){let i={type:r===e.length||n||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:a.start._bufferIndex+s,_index:a.start._index+o,line:a.end.line,column:a.end.column-l,offset:a.end.offset-l},end:{...a.end}};a.end={...i.start},a.start.offset===a.end.offset?Object.assign(a,i):(e.splice(r,0,["enter",i,t],["exit",i,t]),r+=2)}r++}return e}function wK(e){return null===e||wA(e)||wC(e)?1:wI(e)?2:void 0}function wY(e,t,r){let n=[],a=-1;for(;++a<e.length;){let i=e[a].resolveAll;i&&!n.includes(i)&&(t=i(t,r),n.push(i))}return t}let wX={name:"attention",resolveAll:function(e,t){let r,n,a,i,o,s,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(r=c;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[r][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[r][1].end},p={...e[c][1].start};wJ(d,-s),wJ(p,s),i={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:p},a={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[c][1].start}},n={type:s>1?"strong":"emphasis",start:{...i.start},end:{...o.end}},e[r][1].end={...i.start},e[c][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=wg(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=wg(l,[["enter",n,t],["enter",i,t],["exit",i,t],["enter",a,t]]),l=wg(l,wY(t.parser.constructs.insideSpan.null,e.slice(r+1,c),t)),l=wg(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",n,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=wg(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,wh(e,r-1,c-r+3,l),c=r+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,a=this.previous,i=wK(a);return function(o){return r=o,e.enter("attentionSequence"),function o(s){if(s===r)return e.consume(s),o;let l=e.exit("attentionSequence"),u=wK(s),c=!u||2===u&&i||n.includes(s),d=!i||2===i&&u||n.includes(a);return l._open=!!(42===r?c:c&&(i||!d)),l._close=!!(42===r?d:d&&(u||!c)),t(s)}(o)}}};function wJ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let wQ={continuation:{tokenize:function(e,t,r){let n=this;return function(t){return wN(t)?wO(e,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):a(t)};function a(n){return e.attempt(wQ,t,r)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,r){let n=this;return function(t){if(62===t){let r=n.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),a}return r(t)};function a(r){return wN(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}},w0={name:"characterEscape",tokenize:function(e,t,r){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return wk(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(n)}}},w1=document.createElement("i");function w2(e){let t="&"+e+";";w1.innerHTML=t;let r=w1.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==t&&r}let w4={name:"characterReference",tokenize:function(e,t,r){let n,a,i=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),n=31,a=w_,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),n=6,a=wS,u):(e.enter("characterReferenceValue"),n=7,a=wx,u(t))}function u(s){if(59===s&&o){let n=e.exit("characterReferenceValue");return a!==w_||w2(i.sliceSerialize(n))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):r(s)}return a(s)&&o++<n?(e.consume(s),u):r(s)}}},w3={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return null===t?r(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},w5={concrete:!0,name:"codeFenced",tokenize:function(e,t,r){let n,a=this,i={partial:!0,tokenize:function(e,t,r){let i=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),wN(t)?wO(e,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===n?(e.enter("codeFencedFenceSequence"),function t(a){return a===n?(i++,e.consume(a),t):i>=s?(e.exit("codeFencedFenceSequence"),wN(a)?wO(e,u,"whitespace")(a):u(a)):r(a)}(t)):r(t)}function u(n){return null===n||wT(n)?(e.exit("codeFencedFence"),t(n)):r(n)}}},o=0,s=0;return function(t){var i;let u;return i=t,o=(u=a.events[a.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,n=i,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(a){return a===n?(s++,e.consume(a),t):s<3?r(a):(e.exit("codeFencedFenceSequence"),wN(a)?wO(e,l,"whitespace")(a):l(a))}(i)};function l(i){return null===i||wT(i)?(e.exit("codeFencedFence"),a.interrupt?t(i):e.check(w3,c,m)(i)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wT(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(a)):wN(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wO(e,u,"whitespace")(a)):96===a&&a===n?r(a):(e.consume(a),t)}(i))}function u(t){return null===t||wT(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wT(a)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(a)):96===a&&a===n?r(a):(e.consume(a),t)}(t))}function c(t){return e.attempt(i,m,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return o>0&&wN(t)?wO(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||wT(t)?e.check(w3,c,m)(t):(e.enter("codeFlowValue"),function t(r){return null===r||wT(r)?(e.exit("codeFlowValue"),f(r)):(e.consume(r),t)}(t))}function m(r){return e.exit("codeFenced"),t(r)}}},w6={name:"codeIndented",tokenize:function(e,t,r){let n=this;return function(t){return e.enter("codeIndented"),wO(e,a,"linePrefix",5)(t)};function a(t){let a=n.events[n.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?function t(r){return null===r?i(r):wT(r)?e.attempt(w9,t,i)(r):(e.enter("codeFlowValue"),function r(n){return null===n||wT(n)?(e.exit("codeFlowValue"),t(n)):(e.consume(n),r)}(r))}(t):r(t)}function i(r){return e.exit("codeIndented"),t(r)}}},w9={partial:!0,tokenize:function(e,t,r){let n=this;return a;function a(t){return n.parser.lazy[n.now().line]?r(t):wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):wO(e,i,"linePrefix",5)(t)}function i(e){let i=n.events[n.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):wT(e)?a(e):r(e)}}};function w8(e,t,r,n,a,i,o,s,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(n),e.enter(a),e.enter(i),e.consume(t),e.exit(i),d):null===t||32===t||41===t||wE(t)?r(t):(e.enter(n),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),m(t))};function d(r){return 62===r?(e.enter(i),e.consume(r),e.exit(i),e.exit(a),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(r))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||wT(t)?r(t):(e.consume(t),92===t?f:p)}function f(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function m(a){return!c&&(null===a||41===a||wA(a))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(n),t(a)):c<u&&40===a?(e.consume(a),c++,m):41===a?(e.consume(a),c--,m):null===a||32===a||40===a||wE(a)?r(a):(e.consume(a),92===a?h:m)}function h(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function w7(e,t,r,n,a,i){let o,s=this,l=0;return function(t){return e.enter(n),e.enter(a),e.consume(t),e.exit(a),e.enter(i),u};function u(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?r(d):93===d?(e.exit(i),e.enter(a),e.consume(d),e.exit(a),e.exit(n),t):wT(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||wT(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!wN(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function Ee(e,t,r,n,a,i){let o;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(a),e.consume(t),e.exit(a),o=40===t?41:t,s):r(t)};function s(r){return r===o?(e.enter(a),e.consume(r),e.exit(a),e.exit(n),t):(e.enter(i),l(r))}function l(t){return t===o?(e.exit(i),s(o)):null===t?r(t):wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||wT(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===o||92===t?(e.consume(t),u):u(t)}}function Et(e,t){let r;return function n(a){return wT(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,n):wN(a)?wO(e,n,r?"linePrefix":"lineSuffix")(a):t(a)}}function Er(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let En={partial:!0,tokenize:function(e,t,r){return function(t){return wA(t)?Et(e,n)(t):r(t)};function n(t){return Ee(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function a(t){return wN(t)?wO(e,i,"whitespace")(t):i(t)}function i(e){return null===e||wT(e)?t(e):r(e)}}},Ea=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ei=["pre","script","style","textarea"],Eo={partial:!0,tokenize:function(e,t,r){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(wM,t,r)}}},Es={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):r(t)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},El={name:"labelEnd",resolveAll:function(e){let t=-1,r=[];for(;++t<e.length;){let n=e[t][1];if(r.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let e="labelImage"===n.type?4:2;n.type="data",t+=e}}return e.length!==r.length&&wh(e,0,e.length,r),e},resolveTo:function(e,t){let r,n,a,i,o=e.length,s=0;for(;o--;)if(r=e[o][1],n){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[o][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(a){if("enter"===e[o][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(n=o,"labelLink"!==r.type)){s=2;break}}else"labelEnd"===r.type&&(a=o);let l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[n][1].start},end:{...e[a][1].end}},c={type:"labelText",start:{...e[n+s+2][1].end},end:{...e[a-2][1].start}};return i=wg(i=[["enter",l,t],["enter",u,t]],e.slice(n+1,n+s+3)),i=wg(i,[["enter",c,t]]),i=wg(i,wY(t.parser.constructs.insideSpan.null,e.slice(n+s+4,a-3),t)),i=wg(i,[["exit",c,t],e[a-2],e[a-1],["exit",u,t]]),i=wg(i,e.slice(a+1)),i=wg(i,[["exit",l,t]]),wh(e,n,e.length,i),e},tokenize:function(e,t,r){let n,a,i=this,o=i.events.length;for(;o--;)if(("labelImage"===i.events[o][1].type||"labelLink"===i.events[o][1].type)&&!i.events[o][1]._balanced){n=i.events[o][1];break}return function(t){return n?n._inactive?c(t):(a=i.parser.defined.includes(Er(i.sliceSerialize({start:n.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):r(t)};function s(t){return 40===t?e.attempt(Eu,u,a?u:c)(t):91===t?e.attempt(Ec,u,a?l:c)(t):a?u(t):c(t)}function l(t){return e.attempt(Ed,u,c)(t)}function u(e){return t(e)}function c(e){return n._balanced=!0,r(e)}}},Eu={tokenize:function(e,t,r){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return wA(t)?Et(e,a)(t):a(t)}function a(t){return 41===t?u(t):w8(e,i,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function i(t){return wA(t)?Et(e,s)(t):u(t)}function o(e){return r(e)}function s(t){return 34===t||39===t||40===t?Ee(e,l,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return wA(t)?Et(e,u)(t):u(t)}function u(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):r(n)}}},Ec={tokenize:function(e,t,r){let n=this;return function(t){return w7.call(n,e,a,i,"reference","referenceMarker","referenceString")(t)};function a(e){return n.parser.defined.includes(Er(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):r(e)}function i(e){return r(e)}}},Ed={tokenize:function(e,t,r){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):r(n)}}},Ep={name:"labelStartImage",resolveAll:El.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),a};function a(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),i):r(t)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Ef={name:"labelStartLink",resolveAll:El.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),a};function a(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Em={name:"lineEnding",tokenize:function(e,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),wO(e,t,"linePrefix")}}},Eh={name:"thematicBreak",tokenize:function(e,t,r){let n,a=0;return function(i){var o;return e.enter("thematicBreak"),n=o=i,function i(o){return o===n?(e.enter("thematicBreakSequence"),function t(r){return r===n?(e.consume(r),a++,t):(e.exit("thematicBreakSequence"),wN(r)?wO(e,i,"whitespace")(r):i(r))}(o)):a>=3&&(null===o||wT(o))?(e.exit("thematicBreak"),t(o)):r(o)}(o)}}},Eg={continuation:{tokenize:function(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(wM,function(r){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,wO(e,t,"listItemIndent",n.containerState.size+1)(r)},function(r){return n.containerState.furtherBlankLines||!wN(r)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(r)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Ey,t,a)(r))});function a(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,wO(e,e.attempt(Eg,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,r){let n=this,a=n.events[n.events.length-1],i=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,o=0;return function(t){let a=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===a?!n.containerState.marker||t===n.containerState.marker:wx(t)){if(n.containerState.type||(n.containerState.type=a,e.enter(a,{_container:!0})),"listUnordered"===a)return e.enter("listItemPrefix"),42===t||45===t?e.check(Eh,r,s)(t):s(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(a){return wx(a)&&++o<10?(e.consume(a),t):(!n.interrupt||o<2)&&(n.containerState.marker?a===n.containerState.marker:41===a||46===a)?(e.exit("listItemValue"),s(a)):r(a)}(t)}return r(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(wM,n.interrupt?r:l,e.attempt(Eb,c,u))}function l(e){return n.containerState.initialBlankLine=!0,i++,c(e)}function u(t){return wN(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):r(t)}function c(r){return n.containerState.size=i+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(r)}}},Eb={partial:!0,tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return!wN(e)&&a&&"listItemPrefixWhitespace"===a[1].type?t(e):r(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Ey={partial:!0,tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return a&&"listItemIndent"===a[1].type&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?t(e):r(e)},"listItemIndent",n.containerState.size+1)}},Ev={name:"setextUnderline",resolveTo:function(e,t){let r,n,a,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){r=i;break}"paragraph"===e[i][1].type&&(n=i)}else"content"===e[i][1].type&&e.splice(i,1),a||"definition"!==e[i][1].type||(a=i);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",a?(e.splice(n,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,r){let n,a=this;return function(t){var o;let s,l=a.events.length;for(;l--;)if("lineEnding"!==a.events[l][1].type&&"linePrefix"!==a.events[l][1].type&&"content"!==a.events[l][1].type){s="paragraph"===a.events[l][1].type;break}return!a.parser.lazy[a.now().line]&&(a.interrupt||s)?(e.enter("setextHeadingLine"),n=t,o=t,e.enter("setextHeadingLineSequence"),function t(r){return r===n?(e.consume(r),t):(e.exit("setextHeadingLineSequence"),wN(r)?wO(e,i,"lineSuffix")(r):i(r))}(o)):r(t)};function i(n){return null===n||wT(n)?(e.exit("setextHeadingLine"),t(n)):r(n)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,r){let n,a=this;return function(t){var n;return e.enter("definition"),n=t,w7.call(a,e,i,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function i(t){return(n=Er(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):r(t)}function o(t){return wA(t)?Et(e,s)(t):s(t)}function s(t){return w8(e,l,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(En,u,u)(t)}function u(t){return wN(t)?wO(e,c,"whitespace")(t):c(t)}function c(i){return null===i||wT(i)?(e.exit("definition"),a.parser.defined.push(n),t(i)):r(i)}}}},"disable",0,{null:[]},"document",0,{42:Eg,43:Eg,45:Eg,48:Eg,49:Eg,50:Eg,51:Eg,52:Eg,53:Eg,54:Eg,55:Eg,56:Eg,57:Eg,62:wQ},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let r,n,a=e.length-2,i=3;return"whitespace"===e[3][1].type&&(i+=2),a-2>i&&"whitespace"===e[a][1].type&&(a-=2),"atxHeadingSequence"===e[a][1].type&&(i===a-1||a-4>i&&"whitespace"===e[a-2][1].type)&&(a-=i+1===a?2:4),a>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[a][1].end},n={type:"chunkText",start:e[i][1].start,end:e[a][1].end,contentType:"text"},wh(e,i,a-i+1,[["enter",r,t],["enter",n,t],["exit",n,t],["exit",r,t]])),e},tokenize:function(e,t,r){let n=0;return function(a){var i;return e.enter("atxHeading"),i=a,e.enter("atxHeadingSequence"),function a(i){return 35===i&&n++<6?(e.consume(i),a):null===i||wA(i)?(e.exit("atxHeadingSequence"),function r(n){return 35===n?(e.enter("atxHeadingSequence"),function t(n){return 35===n?(e.consume(n),t):(e.exit("atxHeadingSequence"),r(n))}(n)):null===n||wT(n)?(e.exit("atxHeading"),t(n)):wN(n)?wO(e,r,"whitespace")(n):(e.enter("atxHeadingText"),function t(n){return null===n||35===n||wA(n)?(e.exit("atxHeadingText"),r(n)):(e.consume(n),t)}(n))}(i)):r(i)}(i)}}},42:Eh,45:[Ev,Eh],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,r){let n,a,i,o,s,l=this;return function(t){var r;return r=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),u};function u(o){return 33===o?(e.consume(o),c):47===o?(e.consume(o),a=!0,f):63===o?(e.consume(o),n=3,l.interrupt?t:O):wv(o)?(e.consume(o),i=String.fromCharCode(o),m):r(o)}function c(a){return 45===a?(e.consume(a),n=2,d):91===a?(e.consume(a),n=5,o=0,p):wv(a)?(e.consume(a),n=4,l.interrupt?t:O):r(a)}function d(n){return 45===n?(e.consume(n),l.interrupt?t:O):r(n)}function p(n){let a="CDATA[";return n===a.charCodeAt(o++)?(e.consume(n),o===a.length)?l.interrupt?t:S:p:r(n)}function f(t){return wv(t)?(e.consume(t),i=String.fromCharCode(t),m):r(t)}function m(o){if(null===o||47===o||62===o||wA(o)){let s=47===o,u=i.toLowerCase();return!s&&!a&&Ei.includes(u)?(n=1,l.interrupt?t(o):S(o)):Ea.includes(i.toLowerCase())?(n=6,s)?(e.consume(o),h):l.interrupt?t(o):S(o):(n=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(o):a?function t(r){return wN(r)?(e.consume(r),t):E(r)}(o):g(o))}return 45===o||w_(o)?(e.consume(o),i+=String.fromCharCode(o),m):r(o)}function h(n){return 62===n?(e.consume(n),l.interrupt?t:S):r(n)}function g(t){return 47===t?(e.consume(t),E):58===t||95===t||wv(t)?(e.consume(t),b):wN(t)?(e.consume(t),g):E(t)}function b(t){return 45===t||46===t||58===t||95===t||w_(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),v):wN(t)?(e.consume(t),y):g(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),s=t,_):wN(t)?(e.consume(t),v):function t(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||wA(r)?y(r):(e.consume(r),t)}(t)}function _(t){return t===s?(e.consume(t),s=null,w):null===t||wT(t)?r(t):(e.consume(t),_)}function w(e){return 47===e||62===e||wN(e)?g(e):r(e)}function E(t){return 62===t?(e.consume(t),x):r(t)}function x(t){return null===t||wT(t)?S(t):wN(t)?(e.consume(t),x):r(t)}function S(t){return 45===t&&2===n?(e.consume(t),N):60===t&&1===n?(e.consume(t),I):62===t&&4===n?(e.consume(t),L):63===t&&3===n?(e.consume(t),O):93===t&&5===n?(e.consume(t),R):wT(t)&&(6===n||7===n)?(e.exit("htmlFlowData"),e.check(Eo,P,k)(t)):null===t||wT(t)?(e.exit("htmlFlowData"),k(t)):(e.consume(t),S)}function k(t){return e.check(Es,T,P)(t)}function T(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return null===t||wT(t)?k(t):(e.enter("htmlFlowData"),S(t))}function N(t){return 45===t?(e.consume(t),O):S(t)}function I(t){return 47===t?(e.consume(t),i="",C):S(t)}function C(t){if(62===t){let r=i.toLowerCase();return Ei.includes(r)?(e.consume(t),L):S(t)}return wv(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),C):S(t)}function R(t){return 93===t?(e.consume(t),O):S(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===n?(e.consume(t),O):S(t)}function L(t){return null===t||wT(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),L)}function P(r){return e.exit("htmlFlow"),t(r)}}},61:Ev,95:Eh,96:w5,126:w5},"flowInitial",0,{[-2]:w6,[-1]:w6,32:w6},"insideSpan",0,{null:[wX,wH]},"string",0,{38:w4,92:w0},"text",0,{[-5]:Em,[-4]:Em,[-3]:Em,33:Ep,38:w4,42:wX,60:[{name:"autolink",tokenize:function(e,t,r){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a};function a(t){return wv(t)?(e.consume(t),i):64===t?r(t):s(t)}function i(t){return 43===t||45===t||46===t||w_(t)?(n=1,function t(r){return 58===r?(e.consume(r),n=0,o):(43===r||45===r||46===r||w_(r))&&n++<32?(e.consume(r),t):(n=0,s(r))}(t)):s(t)}function o(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||wE(n)?r(n):(e.consume(n),o)}function s(t){return 64===t?(e.consume(t),l):ww(t)?(e.consume(t),s):r(t)}function l(a){return w_(a)?function a(i){return 46===i?(e.consume(i),n=0,l):62===i?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(i),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(i){if((45===i||w_(i))&&n++<63){let r=45===i?t:a;return e.consume(i),r}return r(i)}(i)}(a):r(a)}}},{name:"htmlText",tokenize:function(e,t,r){let n,a,i,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),_):63===t?(e.consume(t),y):wv(t)?(e.consume(t),E):r(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),a=0,f):wv(t)?(e.consume(t),b):r(t)}function u(t){return 45===t?(e.consume(t),p):r(t)}function c(t){return null===t?r(t):45===t?(e.consume(t),d):wT(t)?(i=c,C(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),p):c(t)}function p(e){return 62===e?I(e):45===e?d(e):c(e)}function f(t){let n="CDATA[";return t===n.charCodeAt(a++)?(e.consume(t),a===n.length?m:f):r(t)}function m(t){return null===t?r(t):93===t?(e.consume(t),h):wT(t)?(i=m,C(t)):(e.consume(t),m)}function h(t){return 93===t?(e.consume(t),g):m(t)}function g(t){return 62===t?I(t):93===t?(e.consume(t),g):m(t)}function b(t){return null===t||62===t?I(t):wT(t)?(i=b,C(t)):(e.consume(t),b)}function y(t){return null===t?r(t):63===t?(e.consume(t),v):wT(t)?(i=y,C(t)):(e.consume(t),y)}function v(e){return 62===e?I(e):y(e)}function _(t){return wv(t)?(e.consume(t),w):r(t)}function w(t){return 45===t||w_(t)?(e.consume(t),w):function t(r){return wT(r)?(i=t,C(r)):wN(r)?(e.consume(r),t):I(r)}(t)}function E(t){return 45===t||w_(t)?(e.consume(t),E):47===t||62===t||wA(t)?x(t):r(t)}function x(t){return 47===t?(e.consume(t),I):58===t||95===t||wv(t)?(e.consume(t),S):wT(t)?(i=x,C(t)):wN(t)?(e.consume(t),x):I(t)}function S(t){return 45===t||46===t||58===t||95===t||w_(t)?(e.consume(t),S):function t(r){return 61===r?(e.consume(r),k):wT(r)?(i=t,C(r)):wN(r)?(e.consume(r),t):x(r)}(t)}function k(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),n=t,T):wT(t)?(i=k,C(t)):wN(t)?(e.consume(t),k):(e.consume(t),A)}function T(t){return t===n?(e.consume(t),n=void 0,N):null===t?r(t):wT(t)?(i=T,C(t)):(e.consume(t),T)}function A(t){return null===t||34===t||39===t||60===t||61===t||96===t?r(t):47===t||62===t||wA(t)?x(t):(e.consume(t),A)}function N(e){return 47===e||62===e||wA(e)?x(e):r(e)}function I(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):r(n)}function C(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return wN(t)?wO(e,O,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),i(t)}}}],91:Ef,92:[{name:"hardBreakEscape",tokenize:function(e,t,r){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return wT(n)?(e.exit("hardBreakEscape"),t(n)):r(n)}}},w0],93:El,95:wX,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,r,n=e.length-4,a=3;if(("lineEnding"===e[3][1].type||"space"===e[a][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=a;++t<n;)if("codeTextData"===e[t][1].type){e[a][1].type="codeTextPadding",e[n][1].type="codeTextPadding",a+=2,n-=2;break}}for(t=a-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="codeTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e},tokenize:function(e,t,r){let n,a,i=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(r){return 96===r?(e.consume(r),i++,t):(e.exit("codeTextSequence"),o(r))}(t)};function o(l){return null===l?r(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(a=e.enter("codeTextSequence"),n=0,function r(o){return 96===o?(e.consume(o),n++,r):n===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(a.type="codeTextData",s(o))}(l)):wT(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||wT(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var E_=e.i(4127);let Ew=/[\0\t\n\r]/g;function EE(e,t){let r=Number.parseInt(e,t);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let Ex=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ES(e,t,r){if(t)return t;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),t=120===e||88===e;return EE(r.slice(t?2:1),t?16:10)}return w2(r)||e}let Ek={}.hasOwnProperty;function ET(e){return{line:e.line,column:e.column,offset:e.offset}}function EA(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+_2({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_2({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+_2({start:t.start,end:t.end})+") is still open")}function EN(e){let t=this;t.parser=function(r){var n,a;let i,o,s,l;return"object"==typeof(n={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(a=n,n=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(b),autolinkProtocol:u,autolinkEmail:u,atxHeading:n(m),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:n(f),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:n(f,a),codeText:n(function(){return{type:"inlineCode",value:""}},a),codeTextData:u,data:u,codeFlowValue:u,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(h),hardBreakTrailing:n(h),htmlFlow:n(g,a),htmlFlowData:u,htmlText:n(g,a),htmlTextData:u,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:a,link:n(b),listItem:n(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(y),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:n(m),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,r=this.sliceSerialize(e),n=this.data.characterReferenceType;n?(t=EE(r,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):t=w2(r);let a=this.stack[this.stack.length-1];a.value+=t},characterReference:function(e){this.stack.pop().position.end=ET(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Er(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=t},labelText:function(e){let t=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=t.replace(Ex,ES),r.identifier=Er(t).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=ET(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(r.type)&&(u.call(this,e),c.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,r){let n=-1;for(;++n<r.length;){let a=r[n];Array.isArray(a)?e(t,a):function(e,t){let r;for(r in t)if(Ek.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n)}}}(t,a)}}(t,(e||{}).mdastExtensions||[]);let r={};return function(e){let n={type:"root",children:[]},o={stack:[n],tokenStack:[],config:t,enter:i,exit:s,buffer:a,resume:l,data:r},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,r){let n,a,i,o,s=t-1,l=-1,u=!1;for(;++s<=r;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!n||o||l||i||(i=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let o=s;for(a=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;a&&(e[a][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",a=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}i&&(!a||i<a)&&(n._spread=!0),n.end=Object.assign({},a?e[a][1].start:t[1].end),e.splice(a||s,0,["exit",n,t[2]]),s++,r++}if("listItemPrefix"===t[1].type){let a={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};n=a,e.splice(s,0,["enter",a,t[2]]),s++,r++,i=void 0,o=!0}}}return e[t][1]._spread=u,r}(e,u.pop(),c));for(c=-1;++c<e.length;){let r=t[e[c][0]];Ek.call(r,e[c][1].type)&&r[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},o),e[c][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||EA).call(o,void 0,e[0])}for(n.position={start:ET(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ET(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)n=t.transforms[c](n)||n;return n};function n(e,t){return function(r){i.call(this,e(r),r),t&&t.call(this,r)}}function a(){this.stack.push({type:"fragment",children:[]})}function i(e,t,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,r||void 0]),e.position={start:ET(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let r=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==e.type&&(t?t.call(this,e,n[0]):(n[1]||EA).call(this,e,n[0]));else throw Error("Cannot close `"+e.type+"` ("+_2({start:e.start,end:e.end})+"): it’s not open");r.position.end=ET(e.end)}function l(){return wp(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,r=t[t.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:ET(e.start),end:void 0},t.push(r)),this.stack.push(r)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ET(e.end)}function d(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function m(){return{type:"heading",depth:0,children:[]}}function h(){return{type:"break"}}function g(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(a)(function(e){for(;!w$(e););return e}((function(e){let t={constructs:wy([E_,...(e||{}).extensions||[]]),content:r(wL),defined:[],document:r(wP),flow:r(wB),lazy:{},string:r(wG),text:r(wV)};return t;function r(e){return function(r){return function(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},a={},i=[],o=[],s=[],l={attempt:m(function(e,t){h(e,t.from)}),check:m(f),consume:function(e){wT(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,g()):-1!==e&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=e},enter:function(e,t){let r=t||{};return r.type=e,r.start=p(),u.events.push(["enter",r,u]),s.push(r),r},exit:function(e){let t=s.pop();return t.end=p(),u.events.push(["exit",t,u]),t},interrupt:m(f,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){a[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let r,n=-1,a=[];for(;++n<e.length;){let i,o=e[n];if("string"==typeof o)i=o;else switch(o){case -5:i="\r";break;case -4:i="\n";break;case -3:i="\r\n";break;case -2:i=t?" ":" ";break;case -1:if(!t&&r)continue;i=" ";break;default:i=String.fromCharCode(o)}r=-2===o,a.push(i)}return a.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=wg(o,e),function(){let e;for(;n._index<o.length;){let r=o[n._index];if("string"==typeof r)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;){var t;t=r.charCodeAt(n._bufferIndex),c=c(t)}else c=c(r)}}(),null!==o[o.length-1])?[]:(h(t,0),u.events=wY(i,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function d(e){return function(e,t){let r,n=t.start._index,a=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;if(n===i)r=[e[n].slice(a,o)];else{if(r=e.slice(n,i),a>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(a):r.shift()}o>0&&r.push(e[i].slice(0,o))}return r}(o,e)}function p(){let{_bufferIndex:e,_index:t,line:r,column:a,offset:i}=n;return{_bufferIndex:e,_index:t,line:r,column:a,offset:i}}function f(e,t){t.restore()}function m(e,t){return function(r,a,i){var o;let c,d,f,m;return Array.isArray(r)?h(r):"tokenize"in r?h([r]):(o=r,function(e){let t=null!==e&&o[e],r=null!==e&&o.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function h(e){return(c=e,d=0,0===e.length)?i:b(e[d])}function b(e){return function(r){let a,i,o,c,d;return(a=p(),i=u.previous,o=u.currentConstruct,c=u.events.length,d=Array.from(s),m={from:c,restore:function(){n=a,u.previous=i,u.currentConstruct=o,u.events.length=c,s=d,g()}},f=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?v(r):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,y,v)(r)}}function y(t){return e(f,m),a}function v(e){return(m.restore(),++d<c.length)?b(c[d]):i}}}function h(e,t){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&wh(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){n.line in a&&n.column<2&&(n.column=a[n.line],n.offset+=a[n.line]-1)}}(t,e,r)}}})(a).document().write((o=1,s="",l=!0,function(e,t,r){let n,a,u,c,d,p=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,s="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(Ew.lastIndex=u,c=(n=Ew.exec(e))&&void 0!==n.index?n.index:e.length,d=e.charCodeAt(c),!n){s=e.slice(u);break}if(10===d&&u===c&&i)p.push(-3),i=void 0;else switch(i&&(p.push(-5),i=void 0),u<c&&(p.push(e.slice(u,c)),o+=c-u),d){case 0:p.push(65533),o++;break;case 9:for(a=4*Math.ceil(o/4),p.push(-2);o++<a;)p.push(-1);break;case 10:p.push(-4),o=1;break;default:i=!0,o=1}u=c+1}return r&&(i&&p.push(-5),s&&p.push(s),p.push(null)),p})(r,n,!0))))}}let EI="object"==typeof self?self:globalThis,EC=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new EI[e](t)},ER=e=>{var t;let r,n;return(t=new Map,r=(e,r)=>(t.set(r,e),e),n=a=>{if(t.has(a))return t.get(a);let[i,o]=e[a];switch(i){case 0:case -1:return r(o,a);case 1:{let e=r([],a);for(let t of o)e.push(n(t));return e}case 2:{let e=r({},a);for(let[t,r]of o)e[n(t)]=n(r);return e}case 3:return r(new Date(o),a);case 4:{let{source:e,flags:t}=o;return r(new RegExp(e,t),a)}case 5:{let e=r(new Map,a);for(let[t,r]of o)e.set(n(t),n(r));return e}case 6:{let e=r(new Set,a);for(let t of o)e.add(n(t));return e}case 7:{let{name:e,message:t}=o;return r(EC(e,t),a)}case 8:return r(BigInt(o),a);case"BigInt":return r(Object(BigInt(o)),a);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return r(new DataView(e),o)}}return r(EC(i,o),a)})(0)},{toString:EO}={},{keys:EL}=Object,EP=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let r=EO.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,r]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},ED=([e,t])=>0===e&&("function"===t||"symbol"===t),EM=(e,{json:t,lossy:r}={})=>{var n,a,i;let o,s,l=[];return(n=!(t||r),a=!!t,i=new Map,o=(e,t)=>{let r=l.push(e)-1;return i.set(t,r),r},s=e=>{if(i.has(e))return i.get(e);let[t,r]=EP(e);switch(t){case 0:{let a=e;switch(r){case"bigint":t=8,a=e.toString();break;case"function":case"symbol":if(n)throw TypeError("unable to serialize "+r);a=null;break;case"undefined":return o([-1],e)}return o([t,a],e)}case 1:{if(r){let t=e;return"DataView"===r?t=new Uint8Array(e.buffer):"ArrayBuffer"===r&&(t=new Uint8Array(e)),o([r,[...t]],e)}let n=[],a=o([t,n],e);for(let t of e)n.push(s(t));return a}case 2:{if(r)switch(r){case"BigInt":return o([r,e.toString()],e);case"Boolean":case"Number":case"String":return o([r,e.valueOf()],e)}if(a&&"toJSON"in e)return s(e.toJSON());let i=[],l=o([t,i],e);for(let t of EL(e))(n||!ED(EP(e[t])))&&i.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:r,flags:n}=e;return o([t,{source:r,flags:n}],e)}case 5:{let r=[],a=o([t,r],e);for(let[t,a]of e)(n||!(ED(EP(t))||ED(EP(a))))&&r.push([s(t),s(a)]);return a}case 6:{let r=[],a=o([t,r],e);for(let t of e)(n||!ED(EP(t)))&&r.push(s(t));return a}}let{message:l}=e;return o([t,{name:r,message:l}],e)})(e),l},Ej="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?ER(EM(e,t)):structuredClone(e):(e,t)=>ER(EM(e,t));function EF(e){let t=[],r=-1,n=0,a=0;for(;++r<e.length;){let i=e.charCodeAt(r),o="";if(37===i&&w_(e.charCodeAt(r+1))&&w_(e.charCodeAt(r+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){let t=e.charCodeAt(r+1);i<56320&&t>56319&&t<57344?(o=String.fromCharCode(i,t),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+a+1,o=""),a&&(r+=a,a=0)}return t.join("")+e.slice(n)}function E$(e,t){let r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function EU(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let Ez=function(e){var t,r;if(null==e)return EH;if("function"==typeof e)return EB(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],r=-1;for(;++r<e.length;)t[r]=Ez(e[r]);return EB(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}(e):(t=e,EB(function(e){let r;for(r in t)if(e[r]!==t[r])return!1;return!0}))}if("string"==typeof e){return r=e,EB(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function EB(e){return function(t,r,n){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function EH(){return!0}let EG=[];function EV(e,t,r,n){let a;"function"==typeof t&&"function"!=typeof r?(n=r,r=t):a=t;let i=Ez(a),o=n?-1:1;(function e(a,s,l){let u=a&&"object"==typeof a?a:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return c;function c(){var u;let c,d,p,f=EG;if((!t||i(a,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(u=r(a,l))?u:"number"==typeof u?[!0,u]:null==u?EG:[u])[0])return f;if("children"in a&&a.children&&a.children&&"skip"!==f[0])for(d=(n?a.children.length:-1)+o,p=l.concat(a);d>-1&&d<a.children.length;){if(!1===(c=e(a.children[d],d,p)())[0])return c;d="number"==typeof c[1]?c[1]:d+o}return f}})(e,void 0,[])()}function Eq(e,t,r,n){let a,i,o;"function"==typeof t&&"function"!=typeof r?(i=void 0,o=t,a=r):(i=t,o=r,a=n),EV(e,i,function(e,t){let r=t[t.length-1],n=r?r.children.indexOf(e):void 0;return o(e,n,r)},a)}function EW(e,t){let r=t.referenceType,n="]";if("collapsed"===r?n+="[]":"full"===r&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];let a=e.all(t),i=a[0];i&&"text"===i.type?i.value="["+i.value:a.unshift({type:"text",value:"["});let o=a[a.length-1];return o&&"text"===o.type?o.value+=n:a.push({type:"text",value:n}),a}function EZ(e){let t=e.spread;return null==t?e.children.length>1:t}function EK(e,t,r){let n=0,a=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(r){let t=e.codePointAt(a-1);for(;9===t||32===t;)a--,t=e.codePointAt(a-1)}return a>n?e.slice(n,a):""}let EY={blockquote:function(e,t){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)},break:function(e,t){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:"\n"}]},code:function(e,t){let r=t.value?t.value+"\n":"",n={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(n.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i={type:"element",tagName:"pre",properties:{},children:[i=e.applyData(t,i)]},e.patch(t,i),i},delete:function(e,t){let r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},emphasis:function(e,t){let r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},footnoteReference:function(e,t){let r,n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),i=EF(a.toLowerCase()),o=e.footnoteOrder.indexOf(a),s=e.footnoteCounts.get(a);void 0===s?(s=0,e.footnoteOrder.push(a),r=e.footnoteOrder.length):r=o+1,s+=1,e.footnoteCounts.set(a,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},html:function(e,t){if(e.options.allowDangerousHtml){let r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}},imageReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EW(e,t);let a={src:EF(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)},image:function(e,t){let r={src:EF(t.url)};null!==t.alt&&void 0!==t.alt&&(r.alt=t.alt),null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){let r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EW(e,t);let a={href:EF(n.url||"")};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},link:function(e,t){let r={href:EF(t.url)};null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,r){let n=e.all(t),a=r?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let r=e.children,n=-1;for(;!t&&++n<r.length;)t=EZ(r[n])}return t}(r):EZ(t),i={},o=[];if("boolean"==typeof t.checked){let e,r=n[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},n.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let e=n[s];(a||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||a?o.push(e):o.push(...e.children)}let l=n[n.length-1];l&&(a||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let r={},n=e.all(t),a=-1;for("number"==typeof t.start&&1!==t.start&&(r.start=t.start);++a<n.length;){let e=n[a];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,i),e.applyData(t,i)},paragraph:function(e,t){let r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},root:function(e,t){let r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)},strong:function(e,t){let r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},table:function(e,t){let r=e.all(t),n=r.shift(),a=[];if(n){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],r),a.push(r)}if(r.length>0){let n={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},i=_0(t.children[1]),o=_Q(t.children[t.children.length-1]);i&&o&&(n.position={start:i,end:o}),a.push(n)}let i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)},tableCell:function(e,t){let r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},tableRow:function(e,t,r){let n=r?r.children:void 0,a=0===(n?n.indexOf(t):1)?"th":"td",i=r&&"table"===r.type?r.align:void 0,o=i?i.length:t.children.length,s=-1,l=[];for(;++s<o;){let r=t.children[s],n={},o=i?i[s]:void 0;o&&(n.align=o);let u={type:"element",tagName:a,properties:n,children:[]};r&&(u.children=e.all(r),e.patch(r,u),u=e.applyData(r,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let r={type:"text",value:function(e){let t=String(e),r=/\r?\n|\r/g,n=r.exec(t),a=0,i=[];for(;n;)i.push(EK(t.slice(a,n.index),a>0,!0),n[0]),a=n.index+n[0].length,n=r.exec(t);return i.push(EK(t.slice(a),a>0,!1)),i.join("")}(String(t.value))};return e.patch(t,r),e.applyData(t,r)},thematicBreak:function(e,t){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)},toml:EX,yaml:EX,definition:EX,footnoteDefinition:EX};function EX(){}let EJ={}.hasOwnProperty,EQ={};function E0(e,t){e.position&&(t.position=function(e){let t=_0(e),r=_Q(e);if(t&&r)return{start:t,end:r}}(e))}function E1(e,t){let r=t;if(e&&e.data){let t=e.data.hName,n=e.data.hChildren,a=e.data.hProperties;"string"==typeof t&&("element"===r.type?r.tagName=t:r={type:"element",tagName:t,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&a&&Object.assign(r.properties,Ej(a)),"children"in r&&r.children&&null!=n&&(r.children=n)}return r}function E2(e,t){let r=[],n=-1;for(t&&r.push({type:"text",value:"\n"});++n<e.length;)n&&r.push({type:"text",value:"\n"}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:"\n"}),r}function E4(e){let t=0,r=e.charCodeAt(t);for(;9===r||32===r;)t++,r=e.charCodeAt(t);return e.slice(t)}function E3(e,t){let r,n,a,i,o=(r=t||EQ,n=new Map,a=new Map,i={all:function(e){let t=[];if("children"in e){let r=e.children,n=-1;for(;++n<r.length;){let a=i.one(r[n],e);if(a){if(n&&"break"===r[n-1].type&&(Array.isArray(a)||"text"!==a.type||(a.value=E4(a.value)),!Array.isArray(a)&&"element"===a.type)){let e=a.children[0];e&&"text"===e.type&&(e.value=E4(e.value))}Array.isArray(a)?t.push(...a):t.push(a)}}}return t},applyData:E1,definitionById:n,footnoteById:a,footnoteCounts:new Map,footnoteOrder:[],handlers:{...EY,...r.handlers},one:function(e,t){let r=e.type,n=i.handlers[r];if(EJ.call(i.handlers,r)&&n)return n(i,e,t);if(i.options.passThrough&&i.options.passThrough.includes(r)){if("children"in e){let{children:t,...r}=e,n=Ej(r);return n.children=i.all(e),n}return Ej(e)}return(i.options.unknownHandler||function(e,t){let r=t.data||{},n="value"in t&&!(EJ.call(r,"hProperties")||EJ.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)})(i,e,t)},options:r,patch:E0,wrap:E2},Eq(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?n:a,r=String(e.identifier).toUpperCase();t.has(r)||t.set(r,e)}}),i),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||E$,n=e.options.footnoteBackLabel||EU,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let a=e.footnoteById.get(e.footnoteOrder[l]);if(!a)continue;let i=e.all(a),o=String(a.identifier).toUpperCase(),u=EF(o.toLowerCase()),c=0,d=[],p=e.footnoteCounts.get(o);for(;void 0!==p&&++c<=p;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof r?r:r(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=i[i.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else i.push(...d);let m={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(i,!0)};e.patch(a,m),s.push(m)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ej(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(_d("children"in u),u.children.push({type:"text",value:"\n"},l)),u}function E5(e,t){return e&&"run"in e?async function(r,n){let a=E3(r,{file:n,...t});await e.run(a,n)}:function(r,n){return E3(r,{file:n,...e||t})}}function E6(e){if(e)throw e}var E9=e.i(2073);function E8(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let E7=function(e,t){let r;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');xn(e);let n=0,a=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else o<0&&(r=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(a=i):(s=-1,a=o));return n===a?a=o:a<0&&(a=e.length),e.slice(n,a)},xe=function(e){let t;if(xn(e),0===e.length)return".";let r=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){r=n;break}}else t||(t=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},xt=function(e){let t;xn(e);let r=e.length,n=-1,a=0,i=-1,o=0;for(;r--;){let s=e.codePointAt(r);if(47===s){if(t){a=r+1;break}continue}n<0&&(t=!0,n=r+1),46===s?i<0?i=r:1!==o&&(o=1):i>-1&&(o=-1)}return i<0||n<0||0===o||1===o&&i===n-1&&i===a+1?"":e.slice(i,n)},xr=function(...e){var t;let r,n,a,i=-1;for(;++i<e.length;)xn(e[i]),e[i]&&(a=void 0===a?e[i]:a+"/"+e[i]);return void 0===a?".":(xn(t=a),r=47===t.codePointAt(0),0!==(n=function(e,t){let r,n,a="",i=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)r=e.codePointAt(l);else if(47===r)break;else r=47;if(47===r){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(a.length<2||2!==i||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2)){if(a.length>2){if((n=a.lastIndexOf("/"))!==a.length-1){n<0?(a="",i=0):i=(a=a.slice(0,n)).length-1-a.lastIndexOf("/"),o=l,s=0;continue}}else if(a.length>0){a="",i=0,o=l,s=0;continue}}t&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+e.slice(o+1,l):a=e.slice(o+1,l),i=l-o-1;o=l,s=0}else 46===r&&s>-1?s++:s=-1}return a}(t,!r)).length||r||(n="."),n.length>0&&47===t.codePointAt(t.length-1)&&(n+="/"),r?"/"+n:n)};function xn(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function xa(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let xi=["history","path","basename","stem","extname","dirname"];class xo{constructor(e){let t,r;t=e?xa(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xi.length;){const e=xi[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)xi.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?E7(this.path):void 0}set basename(e){xl(e,"basename"),xs(e,"basename"),this.path=xr(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?xe(this.path):void 0}set dirname(e){xu(this.basename,"dirname"),this.path=xr(e||"",this.basename)}get extname(){return"string"==typeof this.path?xt(this.path):void 0}set extname(e){if(xs(e,"extname"),xu(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=xr(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){xa(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!xa(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,r=-1;for(;++r<t.length;)if(37===t.codePointAt(r)&&50===t.codePointAt(r+1)){let e=t.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),xl(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?E7(this.path,this.extname):void 0}set stem(e){xl(e,"stem"),xs(e,"stem"),this.path=xr(this.dirname||"",e+(this.extname||""))}fail(e,t,r){let n=this.message(e,t,r);throw n.fatal=!0,n}info(e,t,r){let n=this.message(e,t,r);return n.fatal=void 0,n}message(e,t,r){let n=new _6(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function xs(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function xl(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xu(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let xc=function(e){let t=this.constructor.prototype,r=t[e],n=function(){return r.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},xd={}.hasOwnProperty;class xp extends xc{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let r=-1,n=t.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function a(i,...o){let s=e[++r],l=-1;if(i)return void n(i);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let r;return function(...t){let i,o=e.length>t.length;o&&t.push(n);try{i=e.apply(this,t)}catch(e){if(o&&r)throw e;return n(e)}o||(i&&i.then&&"function"==typeof i.then?i.then(a,n):i instanceof Error?n(i):a(i))};function n(e,...a){r||(r=!0,t(e,...a))}function a(e){n(null,e)}})(s,a)(...o):n(null,...o)}(null,...t)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}};return t}()}copy(){let e=new xp,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data((0,E9.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(xg("data",this.frozen),this.namespace[e]=t,this):xd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xg("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let r=e.call(this,...t);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=xv(e),r=this.parser||this.Parser;return xm("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),xm("process",this.parser||this.Parser),xh("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,a){let i=xv(e),o=r.parse(i);function s(e,r){e||!r?a(e):n?n(r):(_d(t,"`done` is defined if `resolve` is not"),t(void 0,r))}r.run(o,i,function(e,t,n){var a,i;if(e||!t||!n)return s(e);let o=r.stringify(t,n);"string"==typeof(a=o)||(i=a)&&"object"==typeof i&&"byteLength"in i&&"byteOffset"in i?n.value=o:n.result=o,s(e,n)})}}processSync(e){let t,r=!1;return this.freeze(),xm("processSync",this.parser||this.Parser),xh("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){r=!0,E6(e),t=n}),xy("processSync","process",r),_d(t,"we either bailed on an error or have a tree"),t}run(e,t,r){xb(e),this.freeze();let n=this.transformers;return r||"function"!=typeof t||(r=t,t=void 0),r?a(void 0,r):new Promise(a);function a(a,i){_d("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=xv(t);n.run(e,o,function(t,n,o){let s=n||e;t?i(t):a?a(s):(_d(r,"`done` is defined if `resolve` is not"),r(void 0,s,o))})}}runSync(e,t){let r,n=!1;return this.run(e,t,function(e,t){E6(e),r=t,n=!0}),xy("runSync","run",n),_d(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let r=xv(t),n=this.compiler||this.Compiler;return xh("stringify",n),xb(e),n(e,r)}use(e,...t){let r=this.attachers,n=this.namespace;if(xg("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?i(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");i(e.plugins),e.settings&&(n.settings=(0,E9.default)(!0,n.settings,e.settings))}function i(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...r]=e;o(t,r)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let n=-1,a=-1;for(;++n<r.length;)if(r[n][0]===e){a=n;break}if(-1===a)r.push([e,...t]);else if(t.length>0){let[n,...i]=t,o=r[a][1];E8(o)&&E8(n)&&(n=(0,E9.default)(!0,o,n)),r[a]=[e,n,...i]}}}}let xf=new xp().freeze();function xm(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function xh(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function xg(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xb(e){if(!E8(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function xy(e,t,r){if(!r)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xv(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new xo(e)}let x_=[],xw={allowDangerousHtml:!0},xE=/^(https?|ircs?|mailto|xmpp)$/i,xx=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function xS(e){var t;let r,n,a,i,o,s=(r=(t=e).rehypePlugins||x_,n=t.remarkPlugins||x_,a=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xw}:xw,xf().use(EN).use(n).use(E5,a).use(r)),l=(i=e.children||"",o=new xo,"string"==typeof i?o.value=i:_p("Unexpected value `"+i+"` for `children` prop, expected `string`"),o);return function(e,t){let r=t.allowedElements,n=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||xk;for(let e of xx)Object.hasOwn(t,e.from)&&_p("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&i&&_p("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:"root"===e.type?e.children:[e]}),Eq(e,function(e,t,a){if("raw"===e.type&&a&&"number"==typeof t)return o?a.children.splice(t,1):a.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in wc)if(Object.hasOwn(wc,t)&&Object.hasOwn(e.properties,t)){let r=e.properties[t],n=wc[t];(null===n||n.includes(e.tagName))&&(e.properties[t]=l(String(r||""),t,e))}}if("element"===e.type){let o=r?!r.includes(e.tagName):!!i&&i.includes(e.tagName);if(!o&&n&&"number"==typeof t&&(o=!n(e,t,a)),o&&a&&"number"==typeof t)return s&&e.children?a.children.splice(t,1,...e.children):a.children.splice(t,1),t}}),function(e,t){var r,n,a,i;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=s,n=t.jsxDEV,o=function(e,t,a,i){let o=Array.isArray(a.children),s=_0(e);return n(t,a,i,o,{columnNumber:s?s.column-1:void 0,fileName:r,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");a=t.jsx,i=t.jsxs,o=function(e,t,r,n){let o=Array.isArray(r.children)?i:a;return n?o(t,r,n):o(t,r)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?_X:_Y,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=wn(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:J.Fragment,components:a,ignoreInvalidStyle:!0,jsx:J.jsx,jsxs:J.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function xk(e){let t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),a=e.indexOf("/");return -1===t||-1!==a&&t>a||-1!==r&&t>r||-1!==n&&t>n||xE.test(e.slice(0,t))?e:""}function xT(e,t){let r=String(e);if("string"!=typeof t)throw TypeError("Expected character");let n=0,a=r.indexOf(t);for(;-1!==a;)n++,a=r.indexOf(t,a+t.length);return n}let xA="phrasing",xN=["autolink","link","image","label"];function xI(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xC(e){this.config.enter.autolinkProtocol.call(this,e)}function xR(e){this.config.exit.autolinkProtocol.call(this,e)}function xO(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];_d("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function xL(e){this.config.exit.autolinkEmail.call(this,e)}function xP(e){this.exit(e)}function xD(e){!function(e,t,r){let n=Ez((r||{}).ignore||[]),a=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){var a;let e=r[n];t.push(["string"==typeof(a=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(a),"g"):a,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),i=-1;for(;++i<a.length;)EV(e,"text",o);function o(e,t){let r,o=-1;for(;++o<t.length;){let e=t[o],a=r?r.children:void 0;if(n(e,a?a.indexOf(e):void 0,r))return;r=e}if(r)return function(e,t){let r=t[t.length-1],n=a[i][0],o=a[i][1],s=0,l=r.children.indexOf(e),u=!1,c=[];n.lastIndex=0;let d=n.exec(e.value);for(;d;){let r=d.index,a={index:d.index,input:d.input,stack:[...t,e]},i=o(...d,a);if("string"==typeof i&&(i=i.length>0?{type:"text",value:i}:void 0),!1===i?n.lastIndex=r+1:(s!==r&&c.push({type:"text",value:e.value.slice(s,r)}),Array.isArray(i)?c.push(...i):i&&c.push(i),s=r+d[0].length,u=!0),!n.global)break;d=n.exec(e.value)}return u?(s<e.value.length&&c.push({type:"text",value:e.value.slice(s)}),r.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xM],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,xj]],{ignore:["link","linkReference"]})}function xM(e,t,r,n,a){let i,o="";if(!xF(a))return!1;if(/^w/i.test(t)&&(r=t+r,t="",o="http://"),(i=r.split(".")).length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),a=xT(e,"("),i=xT(e,")");for(;-1!==n&&a>i;)e+=r.slice(0,n+1),n=(r=r.slice(n+1)).indexOf(")"),i++;return[e,r]}(r+n);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function xj(e,t,r,n){return!(!xF(n,!0)||/[-\d_]$/.test(r))&&{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function xF(e,t){let r=e.input.charCodeAt(e.index-1);return(0===e.index||wC(r)||wI(r))&&(!t||47!==r)}function x$(){this.buffer()}function xU(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xz(){this.buffer()}function xB(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xH(e){let t=this.resume(),r=this.stack[this.stack.length-1];_d("footnoteReference"===r.type),r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xG(e){this.exit(e)}function xV(e){let t=this.resume(),r=this.stack[this.stack.length-1];_d("footnoteDefinition"===r.type),r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xq(e){this.exit(e)}function xW(e,t,r,n){let a=r.createTracker(n),i=a.move("[^"),o=r.enter("footnoteReference"),s=r.enter("reference");return i+=a.move(r.safe(r.associationId(e),{after:"]",before:i})),s(),o(),i+=a.move("]")}function xZ(e,t,r){return 0===t?e:xK(e,t,r)}function xK(e,t,r){return(r?"":" ")+e}xW.peek=function(){return"["};let xY=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function xX(e){this.enter({type:"delete",children:[]},e)}function xJ(e){this.exit(e)}function xQ(e,t,r,n){let a=r.createTracker(n),i=r.enter("strikethrough"),o=a.move("~~");return o+=r.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function x0(e){return e.length}function x1(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}xQ.peek=function(){return"~"};function x2(e,t,r){let n=e.value||"",a="`",i=-1;for(;RegExp("(^|[^`])"+a+"([^`]|$)").test(n);)a+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++i<r.unsafe.length;){let e,t=r.unsafe[i],a=r.compilePattern(t);if(t.atBreak)for(;e=a.exec(n);){let t=e.index;10===n.charCodeAt(t)&&13===n.charCodeAt(t-1)&&t--,n=n.slice(0,t)+" "+n.slice(e.index+1)}}return a+n+a}x2.peek=function(){return"`"};Ez(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let x4=function(e,t,r,n){let a=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(r),i=r.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(r);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===r.options.incrementListMarker?0:t.children.indexOf(e))+i);let o=i.length+1;("tab"===a||"mixed"===a&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=r.createTracker(n);s.move(i+" ".repeat(o-i.length)),s.shift(o);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,s.current()),function(e,t,r){return t?(r?"":" ".repeat(o))+e:(r?i:i+" ".repeat(o-i.length))+e});return l(),u};function x3(e){let t=e._align;_d(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function x5(e){this.exit(e),this.data.inTable=void 0}function x6(e){this.enter({type:"tableRow",children:[]},e)}function x9(e){this.exit(e)}function x8(e){this.enter({type:"tableCell",children:[]},e)}function x7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Se));let r=this.stack[this.stack.length-1];_d("inlineCode"===r.type),r.value=t,this.exit(e)}function Se(e,t){return"|"===t?t:e}function St(e){let t=this.stack[this.stack.length-2];_d("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function Sr(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];_d("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,a=t.children,i=-1;for(;++i<a.length;){let e=a[i];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Sn(e,t,r,n){let a=e.children[0],i="boolean"==typeof e.checked&&a&&"paragraph"===a.type,o="["+(e.checked?"x":" ")+"] ",s=r.createTracker(n);i&&s.move(o);let l=x4(e,t,r,{...n,...s.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let Sa={tokenize:function(e,t,r){let n=0;return function t(i){return(87===i||119===i)&&n<3?(n++,e.consume(i),t):46===i&&3===n?(e.consume(i),a):r(i)};function a(e){return null===e?r(e):t(e)}},partial:!0},Si={tokenize:function(e,t,r){let n,a,i;return o;function o(t){return 46===t||95===t?e.check(Ss,l,s)(t):null===t||wA(t)||wC(t)||45!==t&&wI(t)?l(t):(i=!0,e.consume(t),o)}function s(t){return 95===t?n=!0:(a=n,n=void 0),e.consume(t),o}function l(e){return a||n||!i?r(e):t(e)}},partial:!0},So={tokenize:function(e,t){let r=0,n=0;return a;function a(o){return 40===o?(r++,e.consume(o),a):41===o&&n<r?i(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(Ss,t,i)(o):null===o||wA(o)||wC(o)?t(o):(e.consume(o),a)}function i(t){return 41===t&&n++,e.consume(t),a}},partial:!0},Ss={tokenize:function(e,t,r){return n;function n(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),n):38===o?(e.consume(o),i):93===o?(e.consume(o),a):60===o||null===o||wA(o)||wC(o)?t(o):r(o)}function a(e){return null===e||40===e||91===e||wA(e)||wC(e)?t(e):n(e)}function i(t){return wv(t)?function t(a){return 59===a?(e.consume(a),n):wv(a)?(e.consume(a),t):r(a)}(t):r(t)}},partial:!0},Sl={tokenize:function(e,t,r){return function(t){return e.consume(t),n};function n(e){return w_(e)?r(e):t(e)}},partial:!0},Su={name:"wwwAutolink",tokenize:function(e,t,r){let n=this;return function(t){return 87!==t&&119!==t||!Sm.call(n,n.previous)||Sy(n.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Sa,e.attempt(Si,e.attempt(So,a),r),r)(t))};function a(r){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(r)}},previous:Sm},Sc={name:"protocolAutolink",tokenize:function(e,t,r){let n=this,a="",i=!1;return function(t){return(72===t||104===t)&&Sh.call(n,n.previous)&&!Sy(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(t),e.consume(t),o):r(t)};function o(t){if(wv(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let r=a.toLowerCase();if("http"===r||"https"===r)return e.consume(t),s}return r(t)}function s(t){return 47===t?(e.consume(t),i)?l:(i=!0,s):r(t)}function l(t){return null===t||wE(t)||wA(t)||wC(t)||wI(t)?r(t):e.attempt(Si,e.attempt(So,u),r)(t)}function u(r){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(r)}},previous:Sh},Sd={name:"emailAutolink",tokenize:function(e,t,r){let n,a,i=this;return function(t){return!Sb(t)||!Sg.call(i,i.previous)||Sy(i.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(n){return Sb(n)?(e.consume(n),t):64===n?(e.consume(n),o):r(n)}(t))};function o(t){return 46===t?e.check(Sl,l,s)(t):45===t||95===t||w_(t)?(a=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),n=!0,o}function l(o){return a&&n&&wv(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):r(o)}},previous:Sg},Sp={},Sf=48;for(;Sf<123;)Sp[Sf]=Sd,58==++Sf?Sf=65:91===Sf&&(Sf=97);function Sm(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||wA(e)}function Sh(e){return!wv(e)}function Sg(e){return!(47===e||Sb(e))}function Sb(e){return 43===e||45===e||46===e||95===e||w_(e)}function Sy(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if(("labelLink"===n.type||"labelImage"===n.type)&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}Sp[43]=Sd,Sp[45]=Sd,Sp[46]=Sd,Sp[95]=Sd,Sp[72]=[Sd,Sc],Sp[104]=[Sd,Sc],Sp[87]=[Sd,Su],Sp[119]=[Sd,Su];let Sv={tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return a&&"gfmFootnoteDefinitionIndent"===a[1].type&&4===a[2].sliceSerialize(a[1],!0).length?t(e):r(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function S_(e,t,r){let n,a=this,i=a.events.length,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);for(;i--;){let e=a.events[i][1];if("labelImage"===e.type){n=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!n||!n._balanced)return r(i);let s=Er(a.sliceSerialize({start:n.end,end:a.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)):r(i)}}function Sw(e,t){let r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},s=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...s),e}function SE(e,t,r){let n,a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?r(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!n||null===s||91===s||wA(s))return r(s);if(93===s){e.exit("chunkString");let n=e.exit("gfmFootnoteCallString");return i.includes(Er(a.sliceSerialize(n)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(s)}return wA(s)||(n=!0),o++,e.consume(s),92===s?u:l}function u(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function Sx(e,t,r){let n,a,i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(t)}function u(t){if(s>999||93===t&&!a||null===t||91===t||wA(t))return r(t);if(93===t){e.exit("chunkString");let r=e.exit("gfmFootnoteDefinitionLabelString");return n=Er(i.sliceSerialize(r)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return wA(t)||(a=!0),s++,e.consume(t),92===t?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(n)||o.push(n),wO(e,p,"gfmFootnoteDefinitionWhitespace")):r(t)}function p(e){return t(e)}}function SS(e,t,r){return e.check(wM,t,e.attempt(Sv,t,r))}function Sk(e){e.exit("gfmFootnoteDefinition")}class ST{constructor(){this.map=[]}add(e,t,r){!function(e,t,r,n){let a=0;if(0!==r||0!==n.length){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=r,e.map[a][2].push(...n);return}a+=1}e.map.push([t,r,n])}}(this,e,t,r)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,r=[];for(;t>0;)t-=1,r.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];r.push(e.slice()),e.length=0;let n=r.pop();for(;n;){for(let t of n)e.push(t);n=r.pop()}this.map.length=0}}function SA(e,t,r){let n,a=this,i=0,o=0;return function(e){let t=a.events.length-1;for(;t>-1;){let e=a.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let n=t>-1?a.events[t][1].type:null,i="tableHead"===n||"tableRow"===n?y:s;return i===y&&a.parser.lazy[a.now().line]?r(e):i(e)};function s(t){var r;return e.enter("tableHead"),e.enter("tableRow"),124===(r=t)||(n=!0,o+=1),l(r)}function l(t){return null===t?r(t):wT(t)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):r(t):wN(t)?wO(e,l,"whitespace")(t):(o+=1,n&&(n=!1,i+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),n=!0,l):(e.enter("data"),u(t))}function u(t){return null===t||124===t||wA(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return 92===t||124===t?(e.consume(t),u):u(t)}function d(t){return(a.interrupt=!1,a.parser.lazy[a.now().line])?r(t):(e.enter("tableDelimiterRow"),n=!1,wN(t))?wO(e,p,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?m(t):124===t?(n=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):r(t)}function f(t){return wN(t)?wO(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(o+=1,n=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||wT(t)?b(t):r(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(r){return 45===r?(e.consume(r),t):58===r?(n=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(r),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(r))}(t)):r(t)}function g(t){return wN(t)?wO(e,b,"whitespace")(t):b(t)}function b(a){if(124===a)return p(a);if(null===a||wT(a))return n&&i===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(a)):r(a);return r(a)}function y(t){return e.enter("tableRow"),v(t)}function v(r){return 124===r?(e.enter("tableCellDivider"),e.consume(r),e.exit("tableCellDivider"),v):null===r||wT(r)?(e.exit("tableRow"),t(r)):wN(r)?wO(e,v,"whitespace")(r):(e.enter("data"),_(r))}function _(t){return null===t||124===t||wA(t)?(e.exit("data"),v(t)):(e.consume(t),92===t?w:_)}function w(t){return 92===t||124===t?(e.consume(t),_):_(t)}}function SN(e,t){let r,n,a,i=-1,o=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,p=new ST;for(;++i<e.length;){let f=e[i],m=f[1];"enter"===f[0]?"tableHead"===m.type?(c=!1,0!==d&&(SC(p,t,d,r,n),n=void 0,d=0),r={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",r,t]])):"tableRow"===m.type||"tableDelimiterRow"===m.type?(o=!0,a=void 0,l=[0,0,0,0],u=[0,i+1,0,0],c&&(c=!1,n={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",n,t]])),s="tableDelimiterRow"===m.type?2:n?3:1):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],a=SI(p,t,l,s,void 0,a),l=[0,0,0,0]),u[2]=i)):"tableCellDivider"===m.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],a=SI(p,t,l,s,void 0,a)),u=[(l=u)[1],i,0,0])):"tableHead"===m.type?(c=!0,d=i):"tableRow"===m.type||"tableDelimiterRow"===m.type?(d=i,0!==l[1]?(u[0]=u[1],a=SI(p,t,l,s,i,a)):0!==u[1]&&(a=SI(p,t,u,s,i,a)),s=0):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)&&(u[3]=i)}for(0!==d&&SC(p,t,d,r,n),p.consume(t.events),i=-1;++i<t.events.length;){let e=t.events[i];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let r=!1,n=[];for(;t<e.length;){let a=e[t];if(r){if("enter"===a[0])"tableContent"===a[1].type&&n.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===a[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=n.length-1;n[e]="left"===n[e]?"center":"right"}}else if("tableDelimiterRow"===a[1].type)break}else"enter"===a[0]&&"tableDelimiterRow"===a[1].type&&(r=!0);t+=1}return n}(t.events,i))}return e}function SI(e,t,r,n,a,i){0!==r[0]&&(i.end=Object.assign({},SR(t.events,r[0])),e.add(r[0],0,[["exit",i,t]]));let o=SR(t.events,r[1]);if(i={type:1===n?"tableHeader":2===n?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(r[1],0,[["enter",i,t]]),0!==r[2]){let a=SR(t.events,r[2]),i=SR(t.events,r[3]),o={type:"tableContent",start:Object.assign({},a),end:Object.assign({},i)};if(e.add(r[2],0,[["enter",o,t]]),2!==n){let n=t.events[r[2]],a=t.events[r[3]];if(n[1].end=Object.assign({},a[1].end),n[1].type="chunkText",n[1].contentType="text",r[3]>r[2]+1){let t=r[2]+1,n=r[3]-r[2]-1;e.add(t,n,[])}}e.add(r[3]+1,0,[["exit",o,t]])}return void 0!==a&&(i.end=Object.assign({},SR(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function SC(e,t,r,n,a){let i=[],o=SR(t.events,r);a&&(a.end=Object.assign({},o),i.push(["exit",a,t])),n.end=Object.assign({},o),i.push(["exit",n,t]),e.add(r+1,0,i)}function SR(e,t){let r=e[t],n="enter"===r[0]?"start":"end";return r[1][n]}let SO={name:"tasklistCheck",tokenize:function(e,t,r){let n=this;return function(t){return null===n.previous&&n._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a):r(t)};function a(t){return wA(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):r(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(t)}function o(n){return wT(n)?t(n):wN(n)?e.check({tokenize:SL},t,r)(n):r(n)}}};function SL(e,t,r){return wO(e,function(e){return null===e?r(e):t(e)},"whitespace")}let SP={};function SD(e){let t,r,n,a=e||SP,i=this.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(wy([{text:Sp},{document:{91:{name:"gfmFootnoteDefinition",tokenize:Sx,continuation:{tokenize:SS},exit:Sk}},text:{91:{name:"gfmFootnoteCall",tokenize:SE},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:S_,resolveTo:Sw}}},(t=(a||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let a=this.previous,i=this.events,o=0;return function(s){return 126===a&&"characterEscape"!==i[i.length-1][1].type?n(s):(e.enter("strikethroughSequenceTemporary"),function i(s){let l=wK(a);if(126===s)return o>1?n(s):(e.consume(s),o++,i);if(o<2&&!t)return n(s);let u=e.exit("strikethroughSequenceTemporary"),c=wK(s);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,r(s)}(s))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let a={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},i={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},o=[["enter",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",i,t]],s=t.parser.constructs.insideSpan.null;s&&wh(o,o.length,0,wY(s,e.slice(n+1,r),t)),wh(o,o.length,0,[["exit",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",a,t]]),wh(e,n-1,r-n+3,o),r=n+o.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:SA,resolveAll:SN}}},{text:{91:SO}}])),s.push([{transforms:[xD],enter:{literalAutolink:xI,literalAutolinkEmail:xC,literalAutolinkHttp:xC,literalAutolinkWww:xC},exit:{literalAutolink:xP,literalAutolinkEmail:xL,literalAutolinkHttp:xR,literalAutolinkWww:xO}},{enter:{gfmFootnoteCallString:x$,gfmFootnoteCall:xU,gfmFootnoteDefinitionLabelString:xz,gfmFootnoteDefinition:xB},exit:{gfmFootnoteCallString:xH,gfmFootnoteCall:xG,gfmFootnoteDefinitionLabelString:xV,gfmFootnoteDefinition:xq}},{canContainEols:["delete"],enter:{strikethrough:xX},exit:{strikethrough:xJ}},{enter:{table:x3,tableData:x8,tableHeader:x8,tableRow:x6},exit:{codeText:x7,table:x5,tableData:x9,tableHeader:x9,tableRow:x9}},{exit:{taskListCheckValueChecked:St,taskListCheckValueUnchecked:St,paragraph:Sr}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xA,notInConstruct:xN},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xA,notInConstruct:xN},{character:":",before:"[ps]",after:"\\/",inConstruct:xA,notInConstruct:xN}]},(n=!1,a&&a.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:function(e,t,r,a){let i=r.createTracker(a),o=i.move("[^"),s=r.enter("footnoteDefinition"),l=r.enter("label");return o+=i.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=i.move("]:"),e.children&&e.children.length>0&&(i.shift(4),o+=i.move((n?"\n":" ")+r.indentLines(r.containerFlow(e,i.current()),n?xK:xZ))),s(),o},footnoteReference:xW},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xY}],handlers:{delete:xQ}},function(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,a=t.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,r){let n=x2(e,t,r);return r.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n},table:function(e,t,r,n){return s(function(e,t,r){let n=e.children,a=-1,i=[],o=t.enter("table");for(;++a<n.length;)i[a]=l(n[a],t,r);return o(),i}(e,r,n),e.align)},tableCell:o,tableRow:function(e,t,r,n){let a=s([l(e,r,n)]);return a.slice(0,a.indexOf("\n"))}}};function o(e,t,r,n){let a=r.enter("tableCell"),o=r.enter("phrasing"),s=r.containerPhrasing(e,{...n,before:i,after:i});return o(),a(),s}function s(e,t){return function(e,t){let r=t||{},n=(r.align||[]).concat(),a=r.stringLength||x0,i=[],o=[],s=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],n=[],i=-1;for(e[c].length>u&&(u=e[c].length);++i<e[c].length;){var d;let o=null==(d=e[c][i])?"":String(d);if(!1!==r.alignDelimiters){let e=a(o);n[i]=e,(void 0===l[i]||e>l[i])&&(l[i]=e)}t.push(o)}o[c]=t,s[c]=n}let p=-1;if("object"==typeof n&&"length"in n)for(;++p<u;)i[p]=x1(n[p]);else{let e=x1(n);for(;++p<u;)i[p]=e}p=-1;let f=[],m=[];for(;++p<u;){let e=i[p],t="",n="";99===e?(t=":",n=":"):108===e?t=":":114===e&&(n=":");let a=!1===r.alignDelimiters?1:Math.max(1,l[p]-t.length-n.length),o=t+"-".repeat(a)+n;!1!==r.alignDelimiters&&((a=t.length+a+n.length)>l[p]&&(l[p]=a),m[p]=a),f[p]=o}o.splice(1,0,f),s.splice(1,0,m),c=-1;let h=[];for(;++c<o.length;){let e=o[c],t=s[c];p=-1;let n=[];for(;++p<u;){let a=e[p]||"",o="",s="";if(!1!==r.alignDelimiters){let e=l[p]-(t[p]||0),r=i[p];114===r?o=" ".repeat(e):99===r?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===r.delimiterStart||p||n.push("|"),!1!==r.padding&&(!1!==r.alignDelimiters||""!==a)&&(!1!==r.delimiterStart||p)&&n.push(" "),!1!==r.alignDelimiters&&n.push(o),n.push(a),!1!==r.alignDelimiters&&n.push(s),!1!==r.padding&&n.push(" "),(!1!==r.delimiterEnd||p!==u-1)&&n.push("|")}h.push(!1===r.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:n,padding:r,stringLength:a})}function l(e,t,r){let n=e.children,a=-1,i=[],s=t.enter("tableRow");for(;++a<n.length;)i[a]=o(n[a],e,t,r);return s(),i}}(a),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Sn}}]})}function SM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Sj(e){return function(e){if(Array.isArray(e))return SM(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return SM(e,void 0);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?SM(e,void 0):void 0}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function SF(e){return(SF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S$(e,t,r){var n;return(n=function(e,t){if("object"!=SF(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=SF(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==SF(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SU(){return(SU=Object.assign.bind()).apply(null,arguments)}function Sz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function SB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sz(Object(r),!0).forEach(function(t){S$(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sz(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var SH={},SG=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function SV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Sq(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SV(Object(r),!0).forEach(function(t){S$(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SV(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var SW=/\n/g;function SZ(e){var t,r,n,a,i=e.codeString,o=e.codeStyle,s=e.containerStyle,l=e.numberStyle,u=e.startingLineNumber;return Q.default.createElement("code",{style:Object.assign({},o,void 0===s?{float:"left",paddingRight:"10px"}:s)},(r=(t={lines:i.replace(/\n$/,"").split("\n"),style:void 0===l?{}:l,startingLineNumber:u}).lines,n=t.startingLineNumber,a=t.style,r.map(function(e,t){var r=t+n;return Q.default.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof a?a(r):a},"".concat(r,"\n"))})))}function SK(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function SY(e,t,r){var n={display:"inline-block",minWidth:"".concat(r.toString().length,".25em"),paddingRight:"1em",textAlign:"right",userSelect:"none"},a="function"==typeof e?e(t):e;return Sq(Sq({},n),a)}function SX(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,a=e.largestLineNumber,i=e.showInlineLineNumbers,o=e.lineProps,s=void 0===o?{}:o,l=e.className,u=void 0===l?[]:l,c=e.showLineNumbers,d=e.wrapLongLines,p=e.wrapLines,f=void 0!==p&&p?Sq({},"function"==typeof s?s(r):s):{};if(f.className=f.className?[].concat(Sj(f.className.trim().split(/\s+/)),Sj(u)):u,r&&i){var m=SY(n,r,a);t.unshift(SK(r,m))}return d&c&&(f.style=Sq({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function SJ(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(e,t){return function e(t){var r=t.node,n=t.stylesheet,a=t.style,i=t.useInlineStyles,o=t.key,s=r.properties,l=r.type,u=r.tagName,c=r.value;if("text"===l)return c;if(u){var d,p,f=(d=0,function(t){return d+=1,t.map(function(t,r){return e({node:t,stylesheet:n,useInlineStyles:i,key:"code-segment-".concat(d,"-").concat(r)})})});if(i){var m=Object.keys(n).reduce(function(e,t){return t.split(".").forEach(function(t){e.includes(t)||e.push(t)}),e},[]),h=s.className&&s.className.includes("token")?["token"]:[],g=s.className&&h.concat(s.className.filter(function(e){return!m.includes(e)}));p=SB(SB({},s),{},{className:g.join(" ")||void 0,style:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,r=e.join(".");return SH[r]||(SH[r]=0===(t=e.length)||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0),SH[r]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return SB(SB({},e),r[t])},t)}(s.className,Object.assign({},s.style,void 0===a?{}:a),n)})}else p=SB(SB({},s),{},{className:s.className.join(" ")});var b=f(r.children);return Q.default.createElement(u,SU({key:o},p),b)}}({node:e,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(t)})})}function SQ(e){return e&&void 0!==e.highlightAuto}var S0=($=e.i(16907).default,U={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},function(e){var t,r,n=e.language,a=e.children,i=e.style,o=void 0===i?U:i,s=e.customStyle,l=void 0===s?{}:s,u=e.codeTagProps,c=void 0===u?{className:n?"language-".concat(n):void 0,style:Sq(Sq({},o['code[class*="language-"]']),o['code[class*="language-'.concat(n,'"]')])}:u,d=e.useInlineStyles,p=void 0===d||d,f=e.showLineNumbers,m=void 0!==f&&f,h=e.showInlineLineNumbers,g=void 0===h||h,b=e.startingLineNumber,y=void 0===b?1:b,v=e.lineNumberContainerStyle,_=e.lineNumberStyle,w=void 0===_?{}:_,E=e.wrapLines,x=e.wrapLongLines,S=void 0!==x&&x,k=e.lineProps,T=e.renderer,A=e.PreTag,N=void 0===A?"pre":A,I=e.CodeTag,C=void 0===I?"code":I,R=e.code,O=void 0===R?(Array.isArray(a)?a[0]:a)||"":R,L=e.astGenerator,P=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,SG);L=L||$;var D=m?Q.default.createElement(SZ,{containerStyle:v,codeStyle:c.style||{},numberStyle:w,startingLineNumber:y,codeString:O}):null,M=o.hljs||o['pre[class*="language-"]']||{backgroundColor:"#fff"},j=SQ(L)?"hljs":"prismjs",F=p?Object.assign({},P,{style:Object.assign({},M,l)}):Object.assign({},P,{className:P.className?"".concat(j," ").concat(P.className):j,style:Object.assign({},l)});if(S?c.style=Sq({whiteSpace:"pre-wrap"},c.style):c.style=Sq({whiteSpace:"pre"},c.style),!L)return Q.default.createElement(N,F,D,Q.default.createElement(C,c,O));(void 0===E&&T||S)&&(E=!0),T=T||SJ;var z=[{type:"text",value:O}],B=function(e){var t=e.astGenerator,r=e.language,n=e.code,a=e.defaultCodeValue;if(SQ(t)){var i=-1!==t.listLanguages().indexOf(r);return"text"===r?{value:a,language:"text"}:i?t.highlight(r,n):t.highlightAuto(n)}try{return r&&"text"!==r?{value:t.highlight(n,r)}:{value:a}}catch(e){return{value:a}}}({astGenerator:L,language:n,code:O,defaultCodeValue:z});null===B.language&&(B.value=z);var H=y+(null!=(t=null==(r=O.match(/\n/g))?void 0:r.length)?t:0),G=function(e,t,r,n,a,i,o,s,l){var u,c=function e(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<t.length;a++){var i=t[a];if("text"===i.type)n.push(SX({children:[i],className:Sj(new Set(r))}));else if(i.children){var o=r.concat(i.properties.className);e(i.children,o).forEach(function(e){return n.push(e)})}}return n}(e.value),d=[],p=-1,f=0;function m(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||u.length>0?function(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return SX({children:e,lineNumber:i,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:a,lineProps:r,className:u,showLineNumbers:n,wrapLongLines:l,wrapLines:t})}(e,i,u):function(e,t){if(n&&t&&a){var r=SY(s,t,o);e.unshift(SK(t,r))}return e}(e,i)}for(;f<c.length;)!function(){var e=c[f],t=e.children[0].value;if(t.match(SW)){var r=t.split("\n");r.forEach(function(t,a){var o=n&&d.length+i,s={type:"text",value:"".concat(t,"\n")};if(0===a){var l=m(c.slice(p+1,f).concat(SX({children:[s],className:e.properties.className})),o);d.push(l)}else if(a===r.length-1){var u=c[f+1]&&c[f+1].children&&c[f+1].children[0],h={type:"text",value:"".concat(t)};if(u){var g=SX({children:[h],className:e.properties.className});c.splice(f+1,0,g)}else{var b=m([h],o,e.properties.className);d.push(b)}}else{var y=m([s],o,e.properties.className);d.push(y)}}),p=f}f++}();if(p!==c.length-1){var h=c.slice(p+1,c.length);if(h&&h.length){var g=m(h,n&&d.length+i);d.push(g)}}return t?d:(u=[]).concat.apply(u,d)}(B,E,void 0===k?{}:k,m,g,y,H,w,S);return Q.default.createElement(N,F,Q.default.createElement(C,c,!g&&D,T({rows:G,stylesheet:o,useInlineStyles:p})))});S0.supportedLanguages=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];let S1={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}},S2=Q.default.memo(({content:e,className:t=""})=>(0,J.jsx)("div",{className:rZ("prose min-w-0 max-w-full overflow-hidden break-words text-sm leading-relaxed text-inherit [&_h1:first-child]:mt-0 [&_h1]:mb-4 [&_h1]:mt-6 [&_h1]:font-semibold [&_h2:first-child]:mt-0 [&_h2]:mb-4 [&_h2]:mt-6 [&_h2]:font-semibold [&_h3:first-child]:mt-0 [&_h3]:mb-4 [&_h3]:mt-6 [&_h3]:font-semibold [&_h4:first-child]:mt-0 [&_h4]:mb-4 [&_h4]:mt-6 [&_h4]:font-semibold [&_h5:first-child]:mt-0 [&_h5]:mb-4 [&_h5]:mt-6 [&_h5]:font-semibold [&_h6:first-child]:mt-0 [&_h6]:mb-4 [&_h6]:mt-6 [&_h6]:font-semibold [&_p:last-child]:mb-0 [&_p]:mb-4",t),children:(0,J.jsx)(xS,{remarkPlugins:[SD],components:{code({inline:e,className:t,children:r,...n}){let a=/language-(\w+)/.exec(t||"");return!e&&a?(0,J.jsx)(S0,{style:S1,language:a[1],PreTag:"div",className:"max-w-full rounded-md text-sm",wrapLines:!0,wrapLongLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},customStyle:{margin:0,maxWidth:"100%",overflowX:"auto",fontSize:"0.875rem"},children:String(r).replace(/\n$/,"")}):(0,J.jsx)("code",{className:"bg-surface rounded-sm px-1 py-0.5 font-mono text-[0.9em]",...n,children:r})},pre:({children:e})=>(0,J.jsx)("div",{className:"my-4 max-w-full overflow-hidden last:mb-0",children:e}),a:({href:e,children:t})=>(0,J.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary no-underline hover:underline",children:t}),blockquote:({children:e})=>(0,J.jsx)("blockquote",{className:"my-4 border-l-4 border-border pl-4 italic text-[var(--color-text-tertiary)]",children:e}),ul:({children:e})=>(0,J.jsx)("ul",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),ol:({children:e})=>(0,J.jsx)("ol",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),table:({children:e})=>(0,J.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,J.jsx)("table",{className:"[&_th]:bg-surface w-full border-collapse [&_td]:border [&_td]:border-border [&_td]:p-2 [&_th]:border [&_th]:border-border [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold",children:e})})},children:e})}));function S4({steps:e,hideFinalText:t,compact:r=!1}){let n=new Map;for(let t of e)"tool_result"===t.kind&&t.toolCallId&&n.set(t.toolCallId,t.text);let a=-1;if(t){for(let t=e.length-1;t>=0;t--)if("text"===e[t].kind){a=t;break}}return(0,J.jsx)("div",{className:rZ("flex flex-col gap-1",r&&"gap-0.5"),children:e.map((e,t)=>{if(t===a)return null;if("tool_call"===e.kind){let a={id:e.id,name:e.name,args:e.args,result:n.get(e.id),status:n.has(e.id)?"completed":"pending"};return(0,J.jsx)(_c,{toolCall:a,compact:r},e.id||`tc-${t}`)}return"text"===e.kind?(0,J.jsx)("div",{className:rZ("px-2 text-sm",r&&"px-1 text-xs"),children:(0,J.jsx)(S2,{content:e.text,className:r?"text-xs leading-5 [&_blockquote]:my-2 [&_blockquote]:pl-2 [&_h1]:mb-2 [&_h1]:mt-3 [&_h1]:text-base [&_h2]:mb-2 [&_h2]:mt-3 [&_h2]:text-base [&_h3]:mb-1.5 [&_h3]:mt-3 [&_h3]:text-sm [&_h4]:mb-1.5 [&_h4]:mt-3 [&_h4]:text-sm [&_ol]:my-2 [&_ol]:pl-5 [&_p]:mb-2 [&_table]:text-[11px] [&_td]:p-1.5 [&_th]:p-1.5 [&_ul]:my-2 [&_ul]:pl-5":void 0})},`txt-${t}`):null})})}function S3(e){switch(e){case"running":case"pending":case"busy":return"running";case"success":return"success";case"error":case"timeout":return"error";case"cancelled":case"interrupted":return"cancelled";default:return"unknown"}}S2.displayName="MarkdownContent";let S5={"writing-agent":"Writing agent","data-analysis-agent":"Data analysis agent"},S6="[Async tasks update]";function S9(e){return`${e.task_id}:${e.run_id||"legacy"}`}function S8(e){let t=e.trim().split(/\r?\n/);if(t[0]!==S6||!t[1])return null;try{let e=JSON.parse(t[1]);if("string"!=typeof e.task_id||!e.task_id)return null;return{taskId:e.task_id,runId:"string"==typeof e.run_id&&e.run_id?e.run_id:void 0}}catch{return null}}function S7(e,t){let r=S8(e);return!!r&&r.taskId===t.task_id&&(!r.runId||r.runId===t.run_id)}function ke(e){let t=e.liveStatus||e.status||"success";return[S6,JSON.stringify({agent:e.agent_name,kind:"agent",...e.run_id?{run_id:e.run_id}:{},status:t,task_id:e.task_id}),"(Signal only — fetch full result via check_async_task (sub-agents) if relevant to the current step, else acknowledge & continue.)"].join("\n")}let kt={running:{dot:"bg-[var(--color-warning)]",label:"Running",pulse:!0},success:{dot:"bg-[var(--color-success)]",label:"Done",pulse:!1},error:{dot:"bg-[var(--color-error)]",label:"Error",pulse:!1},cancelled:{dot:"bg-muted-foreground",label:"Cancelled",pulse:!1},unknown:{dot:"bg-muted-foreground",label:"Unknown",pulse:!1}};function kr(e){let t=S3(e);return"success"===t||"error"===t||"cancelled"===t}function kn(e){return e.filter(e=>"running"===S3(e.liveStatus??e.status)).length}let ka=ro("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),ki=ro("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),ko=ro("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),ks=ro("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);async function kl(e){try{if("u">typeof navigator&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{if("u"<typeof document)return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}finally{t.remove()}}catch{return!1}}let ku=Q.default.memo(({message:e,toolCalls:t,isLoading:r,actionRequests:n,submittedActionRequestKeys:a,onActionRequestSubmitted:i,reviewConfigsMap:o,ui:s,stream:l,onResumeInterrupt:u,graphId:c,onEditMessage:d,autoApprove:p,subAgentSteps:f})=>{let m="human"===e.type,h=vB(e),g=h&&""!==h.trim(),b=t.length>0,y=(0,Q.useMemo)(()=>{let t=e.additional_kwargs?.reasoning_content;return"string"==typeof t&&t.trim()?t.trim():null},[e.additional_kwargs]),v=(0,Q.useMemo)(()=>t.filter(e=>"task"===e.name&&e.args.subagent_type&&""!==e.args.subagent_type&&null!==e.args.subagent_type).map(e=>{let t=e.args.subagent_type;return{id:e.id,name:e.name,subAgentName:t,input:e.args,output:e.result?{result:e.result}:void 0,status:e.status}}),[t]),_=(0,Q.useMemo)(()=>{let e=new Map;if(!n||0===n.length)return e;let r=new Map;n.forEach((e,t)=>{let n=r.get(e.name),a={actionRequest:e,actionIndex:t};n?n.push(a):r.set(e.name,[a])});let a=new Map;for(let n of t){let t=r.get(n.name);if(!t)continue;let i=a.get(n.name)??0;i<t.length&&(e.set(n.id,t[i]),a.set(n.name,i+1))}return e},[n,t]),w=(0,Q.useMemo)(()=>JSON.stringify((n??[]).map(e=>({name:e.name,args:e.args}))),[n]),E=(0,Q.useRef)({});(0,Q.useEffect)(()=>{E.current={}},[w]);let x=(0,Q.useCallback)((e,t)=>{let r=t?.decisions;if(!Array.isArray(r)||!n?.length||1===n.length||r.length===n.length)return void u?.(t);let a=r[0],i={...E.current,[e]:a};E.current=i,n.every((e,t)=>i[t])&&(E.current={},u?.({decisions:n.map((e,t)=>i[t])}))},[n,u]),[S,k]=(0,Q.useState)(!1),[T,A]=(0,Q.useState)(!1),N=(0,Q.useCallback)(async()=>{h&&(await kl(h)?(A(!0),setTimeout(()=>A(!1),2e3)):u_.toast.error("Couldn't copy to clipboard."))},[h]),[I,C]=(0,Q.useState)({}),R=(0,Q.useCallback)(e=>I[e]??!1,[I]),O=(0,Q.useCallback)(e=>{C(t=>({...t,[e]:!t[e]}))},[]);return m&&null!==S8(h)?(0,J.jsx)("div",{className:"flex w-full justify-center py-1.5",children:(0,J.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs text-muted-foreground",children:[(0,J.jsx)(ka,{className:"size-3 text-[var(--brand)]","aria-hidden":"true"}),"Background agent reported back"]})}):(0,J.jsx)("div",{className:rZ("group flex w-full max-w-full overflow-x-hidden",m&&"flex-row-reverse"),children:(0,J.jsxs)("div",{className:rZ("min-w-0 max-w-full",m?"max-w-[70%]":"w-full"),children:[!m&&y&&(0,J.jsxs)("div",{className:"mt-4",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>k(e=>!e),"aria-expanded":S,className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground",children:[(0,J.jsx)(ko,{className:rZ("h-3.5 w-3.5 transition-transform",S&&"rotate-90"),"aria-hidden":"true"}),(0,J.jsx)(ki,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Thinking"]}),S&&(0,J.jsx)("div",{className:"mt-2 whitespace-pre-wrap break-words border-l-2 border-border pl-3 text-sm leading-relaxed text-muted-foreground",children:y})]}),g&&(0,J.jsx)("div",{className:rZ("relative flex items-end gap-0"),children:(0,J.jsx)("div",{className:rZ("mt-4 overflow-hidden break-words text-sm font-normal leading-[150%]",m?"rounded-xl rounded-br-none border border-border px-3 py-2 text-foreground":"text-primary"),style:m?{backgroundColor:"var(--color-user-message-bg)"}:void 0,children:m?(0,J.jsx)("p",{className:"m-0 whitespace-pre-wrap break-words text-sm leading-relaxed",children:h}):g?(0,J.jsx)(S2,{content:h}):null})}),!m&&g&&(0,J.jsx)("div",{className:"mt-1",children:(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ks,{className:"h-4 w-4","aria-hidden":"true"})})}),m&&g&&(0,J.jsxs)("div",{className:"mt-1 flex justify-end gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",children:[(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ks,{className:"h-4 w-4","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button",onClick:()=>d?.(h),"aria-label":"Edit message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:(0,J.jsx)(a4,{className:"h-4 w-4","aria-hidden":"true"})})]}),b&&(0,J.jsx)("div",{className:"mt-4 flex w-full flex-col",children:t.map(e=>{if("task"===e.name)return null;let t=s?.find(t=>t.metadata?.tool_call_id===e.id),n=_.get(e.id),d=n?.actionRequest,f=n?e.id:void 0,m=o?.get(e.name);return(0,J.jsx)(_c,{toolCall:e,uiComponent:t,stream:l,graphId:c,actionRequest:d,actionRequestKey:f,actionRequestSubmitted:f?a?.has(f):void 0,onActionRequestSubmitted:i,reviewConfig:m,onResume:n?e=>x(n.actionIndex,e):u,isLoading:r,autoApprove:p},e.id)})}),!m&&v.length>0&&(0,J.jsx)("div",{className:"flex w-fit max-w-full flex-col gap-4",children:v.map(e=>(0,J.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,J.jsx)("div",{className:"flex items-end gap-2",children:(0,J.jsx)("div",{className:"w-[calc(100%-100px)]",children:(0,J.jsx)(v9,{subAgent:e,onClick:()=>O(e.id),isExpanded:R(e.id)})})}),R(e.id)&&(0,J.jsx)("div",{className:"w-full max-w-full",children:(0,J.jsxs)("div",{className:"bg-surface border-border-light rounded-md border p-4",children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Input"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S2,{content:vH(e.input)})}),(f?.[e.id]?.length??0)>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Steps"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S4,{steps:f[e.id],hideFinalText:!!e.output})})]}),e.output&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Output"}),(0,J.jsx)(S2,{content:vH(e.output)})]})]})})]},e.id))})]})})});ku.displayName="ChatMessage";let kc=ro("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),kd=Q.default.memo(({content:e,summarizedCount:t})=>{let[r,n]=(0,Q.useState)(!1),a=function(e){if(!e)return"";let t=e.match(/<summary>\s*([\s\S]*?)\s*<\/summary>/);if(t)return t[1].trim();let r=e.match(/Here is a summary of the conversation to date:\s*([\s\S]*)$/);return r?r[1].trim():e.trim()}(e);return(0,J.jsxs)("div",{className:"my-3 w-full",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,J.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),"aria-expanded":r,className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[(0,J.jsx)(kc,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),"Conversation compacted","number"==typeof t&&t>0&&(0,J.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",t," earlier"," ",1===t?"message":"messages"," summarized"]}),(0,J.jsx)(ko,{className:rZ("size-3.5 transition-transform",r&&"rotate-90"),"aria-hidden":"true"})]}),(0,J.jsx)("div",{className:"h-px flex-1 bg-border"})]}),r&&(0,J.jsx)("div",{className:"mt-2 overflow-hidden rounded-md border border-border bg-muted/20 px-4 py-3",children:(0,J.jsx)(S2,{content:a})})]})});kd.displayName="CompactionSummary";let kp=ro("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),kf="__other__";function km({questions:e,onSubmit:t,onCancel:r,isLoading:n}){let[a,i]=(0,Q.useState)(()=>e.map(()=>"")),[o,s]=(0,Q.useState)(()=>e.map(()=>null)),l=(e,t)=>i(r=>r.map((r,n)=>n===e?t:r)),u=(e,t)=>s(r=>r.map((r,n)=>n===e?t:r)),c=e=>"text"===e.type&&!1===e.required,d=e.every((e,t)=>c(e)||""!==a[t].trim());return(0,J.jsxs)("div",{className:"w-full rounded-lg border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(kp,{size:16,className:"text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"EvoScientist Needs Your Input"})]}),(0,J.jsx)("div",{className:"space-y-5",children:e.map((e,t)=>(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-2 text-sm font-medium text-foreground",children:[e.question,!c(e)&&(0,J.jsx)("span",{className:"ml-1 text-destructive",children:"*"})]}),"multiple_choice"===e.type?(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[e.choices?.map(e=>{let r=o[t]===e.value;return(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,e.value),l(t,e.value)},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",r?"border-[var(--brand-solid)] bg-[var(--brand-solid)] text-[var(--brand-foreground)]":"border-border bg-background hover:bg-accent"),children:e.value},e.value)}),(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,kf),l(t,"")},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",o[t]===kf?"border-[var(--brand)] text-foreground":"border-border bg-background hover:bg-accent"),children:"Other…"}),o[t]===kf&&(0,J.jsx)(_l,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:"Type your answer…",className:"text-sm",rows:2,disabled:n})]}):(0,J.jsx)(_l,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:c(e)?"Type your answer… (optional)":"Type your answer…",className:"text-sm",rows:2,disabled:n})]},t))}),(0,J.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,J.jsx)(na,{variant:"outline",size:"sm",onClick:r,disabled:n,children:"Cancel"}),(0,J.jsx)(na,{size:"sm",onClick:()=>t(a),disabled:!d||n,className:"bg-[var(--brand-solid)] text-[var(--brand-foreground)] hover:opacity-90",children:n?"Submitting…":"Submit"})]})]})}let kh="evoscientist-auto-approve",kg="__new__";function kb(){try{let e=localStorage.getItem(kh);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function ky(e){try{localStorage.setItem(kh,JSON.stringify(e))}catch{}}function kv(e){return!0===kb()[e??kg]}function k_(e,t){let r=kb(),n=e??kg;t?r[n]=!0:delete r[n],ky(r)}function kw(e,t){let r=t?.enabled??!0,n=t?.intervalMs??3e3,a=nj(),[i,o]=(0,Q.useState)([]),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)(null),d=(0,Q.useRef)(0),p=(0,Q.useRef)(!0),f=(0,Q.useCallback)(async()=>{if(!r||!e){o([]),l(!0);return}let t=++d.current;try{let r=await a.threads.getState(e),n=function(e){if(!e||"object"!=typeof e)return[];let t=[];for(let r of Object.values(e))r&&"object"==typeof r&&"string"==typeof r.task_id&&"string"==typeof r.agent_name&&t.push({task_id:r.task_id,agent_name:r.agent_name,thread_id:"string"==typeof r.thread_id?r.thread_id:r.task_id,run_id:"string"==typeof r.run_id?r.run_id:"",status:"string"==typeof r.status?r.status:"",created_at:"string"==typeof r.created_at?r.created_at:void 0,last_updated_at:"string"==typeof r.last_updated_at?r.last_updated_at:void 0});return t.sort((e,t)=>(t.created_at??"").localeCompare(e.created_at??"")),t}(r.values?.async_tasks),i=await Promise.all(n.map(async e=>{if(!e.run_id)return{...e,liveStatus:e.status,startedAt:e.created_at};try{let t=await a.runs.get(e.thread_id,e.run_id),r=t.status??e.status;return{...e,liveStatus:r,startedAt:t.created_at??e.created_at,endedAt:kr(r)?t.updated_at??e.last_updated_at:void 0}}catch{return{...e,liveStatus:e.status,startedAt:e.created_at}}}));if(t!==d.current||!p.current)return;o(i),c(null)}catch{t===d.current&&p.current&&c("Couldn't load background agents.")}finally{t===d.current&&p.current&&l(!0)}},[a,e,r]);return(0,Q.useEffect)(()=>{if(p.current=!0,!r)return o([]),l(!0),()=>{p.current=!1};l(!1),f();let e=setInterval(()=>{document.hidden||f()},n);return()=>{p.current=!1,clearInterval(e)}},[f,r,n]),{tasks:i,loaded:s,error:u,refresh:f}}let kE="evoscientist-auto-notify",kx="evoscientist-auto-notify-reported",kS="evo-auto-notify-change";function kk(){try{let e=localStorage.getItem(kE);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kT(){try{let e=localStorage.getItem(kx);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kA(e){try{localStorage.setItem(kx,JSON.stringify(e))}catch{}}function kN(e){return!!e&&!1!==kk()[e]}function kI(e,t){if(!e)return;let r=kT(),n=r[e];r[e]={initialized:!0,keys:Array.from(new Set([...n?.keys??[],...t]))},kA(r)}function kC(e,t){if(!e)return;let r=kT(),n=r[e];r[e]={initialized:n?.initialized??!0,keys:Array.from(new Set([...n?.keys??[],t]))},kA(r)}function kR(e){let[t,r]=(0,Q.useState)(()=>kN(e));return(0,Q.useEffect)(()=>{let t=()=>r(kN(e));return t(),window.addEventListener(kS,t),window.addEventListener("storage",t),()=>{window.removeEventListener(kS,t),window.removeEventListener("storage",t)}},[e]),[t,(0,Q.useCallback)(t=>(function(e,t){if(!e)return;let r=kk();t?delete r[e]:r[e]=!1;try{localStorage.setItem(kE,JSON.stringify(r))}catch{}window.dispatchEvent(new Event(kS))})(e,t),[e])]}let kO={damping:.7,stiffness:.05,mass:1.25},kL=1e3/60,kP=!1;function kD(e,t){let r=(0,Q.useCallback)(t=>(r.current=t,e(t)),t);return r}globalThis.document?.addEventListener("mousedown",()=>{kP=!0}),globalThis.document?.addEventListener("mouseup",()=>{kP=!1}),globalThis.document?.addEventListener("click",()=>{kP=!1});let kM=new Map;function kj(...e){let t={...kO},r=!1;for(let n of e){if("instant"===n){r=!0;continue}"object"==typeof n&&(r=!1,t.damping=n.damping??t.damping,t.stiffness=n.stiffness??t.stiffness,t.mass=n.mass??t.mass)}let n=JSON.stringify(t);return kM.has(n)||kM.set(n,Object.freeze(t)),r?"instant":kM.get(n)}let kF=ro("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),k$=ro("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),kU=ro("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),kz=lO?e=>{e()}:Q.default.startTransition,kB=l5(ur,()=>(e,t,r={})=>{let{mutate:n}=l4(),a=(0,Q.useRef)(e),i=(0,Q.useRef)(t),o=(0,Q.useRef)(r),s=(0,Q.useRef)(0),[l,u,c]=(e=>{let[,t]=(0,Q.useState)({}),r=(0,Q.useRef)(!1),n=(0,Q.useRef)(e),a=(0,Q.useRef)({data:!1,error:!1,isValidating:!1}),i=(0,Q.useCallback)(e=>{let i=!1,o=n.current;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&o[t]!==e[t]&&(o[t]=e[t],a.current[t]&&(i=!0));i&&!r.current&&t({})},[]);return lP(()=>(r.current=!1,()=>{r.current=!0})),[n,a.current,i]})({data:lb,error:lb,isMutating:!1}),d=l.current,p=(0,Q.useCallback)(async(e,t)=>{let[r,l]=lz(a.current);if(!i.current)throw Error("Can’t trigger the mutation: missing fetcher.");if(!r)throw Error("Can’t trigger the mutation: missing key.");let u=l_(l_({populateCache:!1,throwOnError:!0},o.current),t),d=lH();s.current=d,c({isMutating:!0});try{let t=await n(r,i.current(l,{arg:e}),l_(u,{throwOnError:!0}));return s.current<=d&&(kz(()=>c({data:t,isMutating:!1,error:void 0})),null==u.onSuccess||u.onSuccess.call(u,t,r,u)),t}catch(e){if(s.current<=d&&(kz(()=>c({error:e,isMutating:!1})),null==u.onError||u.onError.call(u,e,r,u),u.throwOnError))throw e}},[]),f=(0,Q.useCallback)(()=>{s.current=lH(),c({data:lb,error:lb,isMutating:!1})},[]);return lP(()=>{a.current=e,i.current=t,o.current=r}),{trigger:p,reset:f,get data(){return u.data=!0,d.data},get error(){return u.error=!0,d.error},get isMutating(){return u.isMutating=!0,d.isMutating}}}),kH={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",dockerfile:"dockerfile",makefile:"makefile"},kG=Q.default.memo(({file:e,onSaveFile:t,onClose:r,editDisabled:n})=>{let[a,i]=(0,Q.useState)(null===e),[o,s]=(0,Q.useState)(String(e?.path||"")),[l,u]=(0,Q.useState)(String(e?.content||"")),c=kB({kind:"files-update",fileName:o,fileContent:l},async({fileName:e,fileContent:r})=>{if(e&&r)return await t(e,r)},{onSuccess:()=>i(!1),onError:e=>u_.toast.error(`Failed to save file: ${e}`)});(0,Q.useEffect)(()=>{s(String(e?.path||"")),u(String(e?.content||"")),i(null===e)},[e]);let d=(0,Q.useMemo)(()=>{let e=String(o||"");return e.split(".").pop()?.toLowerCase()||""},[o]),p=(0,Q.useMemo)(()=>"md"===d||"markdown"===d,[d]),f=(0,Q.useMemo)(()=>kH[d]||"text",[d]),m=(0,Q.useCallback)(()=>{l&&kl(l)},[l]),h=(0,Q.useCallback)(()=>{if(l&&o){let e=new Blob([l],{type:"text/plain"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},[l,o]),g=(0,Q.useCallback)(()=>{i(!0)},[]),b=(0,Q.useCallback)(()=>{null===e?r():(s(String(e.path)),u(String(e.content)),i(!1))},[e,r]),y=(0,Q.useMemo)(()=>""!==o.trim()&&!o.includes("/")&&!o.includes(" "),[o]);return(0,J.jsx)(rK,{open:!0,onOpenChange:r,children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e?.path||"New File"}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kF,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),a&&null===e?(0,J.jsx)(nu,{value:o,onChange:e=>s(e.target.value),placeholder:"Enter filename…",className:"text-base font-medium","aria-invalid":!y}):(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e?.path})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{onClick:g,variant:"ghost",size:"sm",className:"h-8 px-2",disabled:n,children:[(0,J.jsx)(n$,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsxs)(na,{onClick:m,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(ks,{size:16,className:"mr-1"}),"Copy"]}),(0,J.jsxs)(na,{onClick:h,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download"]})]})})]}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:a?(0,J.jsx)(_l,{value:l,onChange:e=>u(e.target.value),placeholder:"Enter file content…",className:"h-full min-h-[400px] resize-none font-mono text-sm"}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:l?p?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S2,{content:l})}):(0,J.jsx)(S0,{language:f,style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:l}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})}),a&&(0,J.jsxs)("div",{className:"mt-4 flex justify-end gap-2 border-t border-border pt-4",children:[(0,J.jsxs)(na,{onClick:b,variant:"outline",size:"sm",children:[(0,J.jsx)(rs,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{onClick:()=>c.trigger(),size:"sm",disabled:c.isMutating||!o.trim()||!l.trim()||!y,children:[c.isMutating?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kU,{size:16,className:"mr-1"}),"Save"]})]})]})})});function kV({files:e,setFiles:t,editDisabled:r}){let[n,a]=(0,Q.useState)(null),i=(0,Q.useCallback)(async(r,n)=>{await t({...e,[r]:n}),a({path:r,content:n})},[e,t]);return(0,J.jsxs)(J.Fragment,{children:[0===Object.keys(e).length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No files created yet"})}):(0,J.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(256px,1fr))] gap-2",children:Object.keys(e).map(t=>{let r,n=String(t),i=e[t];if("object"==typeof i&&null!==i&&"content"in i){let e=i.content;r=Array.isArray(e)?e.join("\n"):String(e||"")}else r=String(i||"");return(0,J.jsxs)("button",{type:"button",onClick:()=>a({path:n,content:r}),className:"cursor-pointer space-y-1 truncate rounded-md border border-border px-2 py-3 shadow-sm transition-colors",style:{backgroundColor:"var(--color-file-button)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button-hover)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button)"},children:[(0,J.jsx)(kF,{size:24,className:"mx-auto text-muted-foreground"}),(0,J.jsx)("span",{className:"mx-auto block w-full truncate break-words text-center text-sm leading-relaxed text-foreground",children:n})]},n)})}),n&&(0,J.jsx)(kG,{file:n,onSaveFile:i,onClose:()=>a(null),editDisabled:r})]})}kG.displayName="FileViewDialog",Q.default.memo(({todos:e,files:t,setFiles:r})=>{let{isLoading:n,interrupt:a}=vZ(),[i,o]=(0,Q.useState)(!1),[s,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(e.length),c=(0,Q.useRef)(Object.keys(t).length);(0,Q.useEffect)(()=>{0===u.current&&e.length>0&&o(!0),u.current=e.length},[e.length]);let d=Object.keys(t).length;(0,Q.useEffect)(()=>{0===c.current&&d>0&&l(!0),c.current=d},[d]);let p=(0,Q.useCallback)(e=>{switch(e){case"completed":return(0,J.jsx)(vX,{size:12,className:"text-[var(--color-success)]"});case"in_progress":return(0,J.jsx)(vJ,{size:12,className:"text-[var(--color-warning)]"});default:return(0,J.jsx)(vQ,{size:10,className:"text-[var(--color-text-tertiary)]"})}},[]),f=(0,Q.useMemo)(()=>({pending:e.filter(e=>"pending"===e.status),in_progress:e.filter(e=>"in_progress"===e.status),completed:e.filter(e=>"completed"===e.status)}),[e]),m={pending:"Pending",in_progress:"In Progress",completed:"Completed"};return(0,J.jsx)("div",{className:"min-h-0 w-full flex-1",children:(0,J.jsx)("div",{className:"font-inter flex h-full w-full flex-col p-0",children:(0,J.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-hidden",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"AGENT TASKS"}),(0,J.jsx)("button",{onClick:()=>o(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",i?"rotate-180":"rotate-0"),"aria-label":"Toggle tasks panel",children:(0,J.jsx)(la,{size:14})})]}),i&&(0,J.jsx)("div",{className:"bg-muted-secondary rounded-xl px-3 pb-2",children:(0,J.jsx)(ij,{className:"h-full",children:0===e.length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tasks created yet"})}):(0,J.jsx)("div",{className:"ml-1 p-0.5",children:Object.entries(f).map(([e,t])=>(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:m[e]}),t.map((t,r)=>(0,J.jsxs)("div",{className:"mb-1.5 flex items-start gap-2 rounded-sm p-1 text-sm",children:[p(t.status),(0,J.jsx)("span",{className:"flex-1 break-words leading-relaxed text-inherit",children:t.content})]},`${e}_${t.id}_${r}`))]}))})})}),(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"FILE SYSTEM"}),(0,J.jsx)("button",{onClick:()=>l(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",s?"rotate-180":"rotate-0"),"aria-label":"Toggle files panel",children:(0,J.jsx)(la,{size:14})})]}),s&&(0,J.jsx)(kV,{files:t,setFiles:r,editDisabled:!0===n||void 0!==a})]})})})}).displayName="TasksFilesSidebar";let kq=ro("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),kW=ro("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),kZ=ro("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),kK=ro("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),kY=ro("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),kX=ro("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),kJ={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",sh:"bash",bash:"bash",zsh:"bash",json:"json",jsonl:"json",xml:"xml",html:"html",css:"css",scss:"scss",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",tex:"latex",bib:"latex",r:"r"},kQ=new Set(["png","jpg","jpeg","gif","webp","svg","bmp"]),k0=new Set([...Object.keys(kJ),"txt","md","markdown","log","csv","tsv","cfg","conf","env","gitignore"]);function k1(e,t=!1){let r=new URLSearchParams({path:e});return t&&r.set("download","1"),`/api/workspace/file?${r.toString()}`}let k2=Q.default.memo(({path:e,size:t,onClose:r,onChanged:n})=>{let[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(!1),[p,f]=(0,Q.useState)(""),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(!1),[_,w]=(0,Q.useState)(!1),[E,x]=(0,Q.useState)(null),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]);let k=e?e.split("/").pop()||e:"",T=(0,Q.useMemo)(()=>k.includes(".")?k.split(".").pop().toLowerCase():"",[k]),A=kQ.has(T)?"image":"pdf"===T?"pdf":k0.has(T)?"text":"binary",N="text"===A&&null!=t&&t>2097152;if((0,Q.useEffect)(()=>{if(!e||"text"!==A||N)return void i(null);let t=!1;return s(!0),u(null),d(!1),b(null),fetch(k1(e)).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||`Failed to load file (${e.status})`)}return e.text()}).then(e=>{t||i(e)}).catch(e=>{t||u(e.message??"Failed to load file.")}).finally(()=>{t||s(!1)}),()=>{t=!0}},[e,A,N]),!e)return null;let I="md"===T||"markdown"===T,C=kJ[T]||"text",R=c&&null!==a&&p!==a,O=e=>{R?x(e):"close"===e?r():d(!1)},L=async()=>{h(!0),b(null);try{let t=await fetch(k1(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:p})}),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to save.");if(!S.current)return;i(p),d(!1),n?.()}catch(e){S.current&&b(e instanceof Error?e.message:"Failed to save.")}finally{S.current&&h(!1)}},P=async()=>{v(!0),b(null);try{let t=await fetch(k1(e),{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to delete.")}n?.(),r()}catch(e){S.current&&(w(!1),b(e instanceof Error?e.message:"Failed to delete."))}finally{S.current&&v(!1)}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(rK,{open:!0,onOpenChange:e=>{e||O("close")},children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between gap-3 border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kF,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{O("cancel-edit")},disabled:m,children:[(0,J.jsx)(kX,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 bg-[var(--brand-solid)] px-3 text-[var(--brand-foreground)] hover:opacity-90",onClick:L,disabled:m||!R,children:[m?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kU,{size:16,className:"mr-1"}),m?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:["text"===A&&!N&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{f(a??""),b(null),d(!0)},disabled:o||null===a,"aria-label":"Edit file",children:[(0,J.jsx)(a4,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsx)("a",{href:k1(e,!0),download:k,children:(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",asChild:!0,children:(0,J.jsxs)("span",{children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download"]})})}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>w(!0),disabled:y,"aria-label":"Delete file",title:"Delete file",children:y?(0,J.jsx)(a1,{size:16,className:"animate-spin"}):(0,J.jsx)(a8,{size:16})})]})})]}),g&&(0,J.jsx)("p",{role:"alert",className:"mb-2 text-sm text-destructive",children:g}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:c?(0,J.jsx)("textarea",{value:p,onChange:e=>f(e.target.value),spellCheck:!1,"aria-label":"File content",className:"h-full w-full resize-none rounded-md border border-border bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"File is empty…"}):"image"===A?(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,J.jsx)("img",{src:k1(e),alt:k,className:"max-h-full max-w-full object-contain"})})}):"pdf"===A?(0,J.jsx)("iframe",{src:k1(e),title:k,className:"h-full w-full rounded-md border border-border"}):"binary"===A||N?(0,J.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-12 text-center",children:[(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:N?"This file is too large to preview inline.":"This file type can't be previewed."}),(0,J.jsx)("a",{href:k1(e,!0),download:k,children:(0,J.jsxs)(na,{variant:"outline",size:"sm",children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download file"]})})]}):o?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):l?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:l})}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:a&&a.length>0?I?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S2,{content:a})}):(0,J.jsx)(S0,{language:C,style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:a}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})})]})}),(0,J.jsx)(rK,{open:null!==E,onOpenChange:e=>{e||x(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",k,"” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>x(null),children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{x(null),"close"===E&&r(),"cancel-edit"===E&&d(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})}),(0,J.jsx)(rK,{open:_,onOpenChange:e=>{y||w(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete file?"}),(0,J.jsxs)(r2,{children:["“",k,"” will be permanently removed from the workspace. This can't be undone."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>w(!1),disabled:y,children:"Cancel"}),(0,J.jsx)(na,{onClick:P,disabled:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:y?"Deleting…":"Delete"})]})]})})]})});async function k4(e){let t=await fetch(`/api/workspace?${new URLSearchParams({path:e})}`),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to list workspace.");return r?.entries??[]}async function k3(){let e=await fetch("/api/workspace?recursive=1"),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||"Failed to load workspace.");return{entries:t?.entries??[],truncated:!!t?.truncated}}k2.displayName="WorkspaceFileDialog";let k5=[{key:"docs",label:"Papers & docs",Icon:kF,exts:["pdf","tex","bib","md","markdown","txt","docx","doc","rtf","odt"]},{key:"figures",label:"Figures",Icon:kZ,exts:["png","jpg","jpeg","gif","svg","webp","bmp","tiff","tif","eps"]},{key:"data",label:"Data",Icon:kK,exts:["json","jsonl","csv","tsv","xlsx","xls","parquet","pkl","npy","npz","h5","hdf5","db","sqlite","yaml","yml","xml"]},{key:"code",label:"Code",Icon:kY,exts:["py","ipynb","js","ts","tsx","jsx","sh","bash","r","jl","cpp","cc","c","h","hpp","java","go","rs","m","rb"]}],k6={key:"other",label:"Other",Icon:v0},k9={};for(let e of k5)for(let t of e.exts)k9[t]=e.key;function k8(){let[e,t]=(0,Q.useState)("tree"),[r,n]=(0,Q.useState)({}),[a,i]=(0,Q.useState)(new Set),[o,s]=(0,Q.useState)(new Set),[l,u]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(null),[p,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(null),_=(0,Q.useCallback)(async e=>{s(t=>new Set(t).add(e));try{let t=await k4(e);return n(r=>({...r,[e]:t})),""===e&&b(null),t}catch(t){throw""===e&&b(t instanceof Error?t.message:"Failed to load."),t}finally{s(t=>{let r=new Set(t);return r.delete(e),r})}},[]),w=(0,Q.useCallback)(async()=>{f(!0);try{let{entries:e,truncated:t}=await k3();d(e),h(t),b(null)}catch(e){b(e instanceof Error?e.message:"Failed to load.")}finally{f(!1)}},[]);(0,Q.useEffect)(()=>{u(!0),_("").catch(()=>{}).finally(()=>u(!1))},[]),(0,Q.useEffect)(()=>{"type"!==e||null!==c||p||w()},[e]);let E=(0,Q.useCallback)(async()=>{(b(null),"type"===e)?await w():(u(!0),await Promise.allSettled(["",...a].map(e=>_(e))),u(!1))},[e,a,_,w]),x=(0,Q.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):(n.add(e),r[e]||_(e).catch(()=>{})),n})},[r,_]),S=(0,Q.useMemo)(()=>{let e={};for(let t of c??[]){let r=k9[t.ext]??k6.key;(e[r]??=[]).push(t)}for(let t of Object.values(e))t.sort((e,t)=>t.mtime-e.mtime);return e},[c]),k="type"===e?p:l,T=(e,t)=>{let n=r[e];return n?0===n.length&&0===t?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"}):n.map(e=>{let r=a.has(e.path),n=o.has(e.path);return(0,J.jsxs)("div",{children:[(0,J.jsxs)("button",{type:"button",onClick:()=>"dir"===e.type?x(e.path):v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-sm text-foreground transition-colors hover:bg-muted",style:{paddingLeft:`${14*t+4}px`},title:e.name,children:["dir"===e.type?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground",children:n?(0,J.jsx)(a1,{className:"size-3 animate-spin"}):r?(0,J.jsx)(la,{className:"size-3.5"}):(0,J.jsx)(ko,{className:"size-3.5"})}),(0,J.jsx)(kq,{className:"size-4 shrink-0 text-[var(--brand)]"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"size-4 shrink-0"}),(0,J.jsx)(kF,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,J.jsx)("span",{className:"truncate",children:e.name})]}),"dir"===e.type&&r&&T(e.path,t+1)]},e.path)}):null};return(0,J.jsxs)("div",{className:"flex min-h-0 flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 pb-1.5",children:[(0,J.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted p-0.5 text-xs",children:["tree","type"].map(r=>(0,J.jsx)("button",{type:"button",onClick:()=>t(r),className:rZ("rounded px-2 py-0.5 font-medium transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),"aria-pressed":e===r,children:"tree"===r?"Tree":"By type"},r))}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)("a",{href:"/api/workspace/download",download:!0,className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Download the whole workspace as a zip",children:[(0,J.jsx)(k$,{className:"size-3.5"}),"All"]}),(0,J.jsx)("button",{type:"button",onClick:E,disabled:k,className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50","aria-label":"Refresh workspace",title:"Refresh",children:(0,J.jsx)(kW,{className:rZ("size-3.5",k&&"animate-spin")})})]})]}),g?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:g}):"tree"===e?l&&!r[""]?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(0,J.jsx)("div",{className:"-mx-1",children:T("",0)}):p&&null===c?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(()=>{if(!c)return null;if(0===c.length)return(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"});let e=[...k5,k6];return(0,J.jsxs)("div",{className:"space-y-3",children:[m&&(0,J.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Showing the first files only — the workspace has more than the limit."}),e.map(e=>{let t=S[e.key];if(!t||0===t.length)return null;let r=e.Icon;return(0,J.jsxs)("div",{children:[(0,J.jsxs)("div",{className:"mb-0.5 flex items-center gap-1.5 px-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:[(0,J.jsx)(r,{className:"size-3.5"}),e.label,(0,J.jsxs)("span",{className:"text-muted-foreground",children:["(",t.length,")"]})]}),t.map(e=>{let t=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,J.jsxs)("button",{type:"button",onClick:()=>v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md px-1 py-1 text-left text-sm text-foreground transition-colors hover:bg-muted",title:e.path,children:[(0,J.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,J.jsx)("span",{className:"truncate",children:e.name}),t&&(0,J.jsx)("span",{className:"ml-auto shrink-0 truncate pl-2 text-[11px] text-muted-foreground",children:t})]},e.path)})]},e.key)})]})})(),(0,J.jsx)(k2,{path:y?.path??null,size:y?.size,onClose:()=>v(null),onChanged:E})]})}let k7=["Survey recent papers on a topic","Design an experiment plan","Analyze workspace files"],Te=(e,t)=>{switch(e){case"completed":return(0,J.jsx)(vX,{size:16,className:rZ("text-[var(--color-success)]",t)});case"in_progress":return(0,J.jsx)(vJ,{size:16,className:rZ("text-[var(--color-warning)]",t)});default:return(0,J.jsx)(vQ,{size:16,className:rZ("text-[var(--color-text-tertiary)]",t)})}},Tt=Q.default.memo(({assistant:e,onShowAgents:t,onNotifyReady:r})=>{let n,a,i,o,s,l,u,[c,d]=(0,Q.useState)(null),p=(0,Q.useRef)(null),f=(0,Q.useRef)(null),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(""),[b,y]=(0,Q.useState)([]),[v,_]=(0,Q.useState)(!1),[w]=ec("threadId"),[E,x]=(0,Q.useState)(()=>kv(w)),[S,k]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),A=(0,Q.useRef)(w),N=(0,Q.useRef)(!1),{scrollRef:I,contentRef:C,scrollToBottom:R}=((e={})=>{let[t,r]=(0,Q.useState)(!1),[n,a]=(0,Q.useState)(!1!==e.initial),[i,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);s.current=e;let l=(0,Q.useCallback)(()=>{if(!kP)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),u=(0,Q.useCallback)(e=>{d.isAtBottom=e,a(e)},[]),c=(0,Q.useCallback)(e=>{d.escapedFromLock=e,r(e)},[]),d=(0,Q.useMemo)(()=>{let r;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(scrollTop){if(g.current){let{scrollBehavior:e}=getComputedStyle(g.current);"auto"!==e&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=scrollTop,d.ignoreScrollToTop=g.current.scrollTop,"auto"!==e&&(g.current.style.scrollBehavior=e)}},get targetScrollTop(){if(!g.current||!b.current)return 0;return g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!b.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(r?.targetScrollTop===t)return r.calculatedScrollTop;let n=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:b.current}),t),0);return r={targetScrollTop:t,calculatedScrollTop:n},requestAnimationFrame(()=>{r=void 0}),n},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),p=(0,Q.useCallback)((e={})=>{let t;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||u(!0);let r=Date.now()+(Number(e.wait)||0),n=kj(s.current,e.animation),{ignoreEscapes:a=!1}=e,i=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{t=Date.now()}):t=r+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:u}=d,c=performance.now(),f=(c-(d.lastTick??c))/kL;if(d.animation||(d.animation={behavior:n,promise:e,ignoreEscapes:a}),d.animation.behavior===n&&(d.lastTick=c),l()||r>Date.now())return o();if(u<Math.min(i,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if("instant"===n)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*f,d.scrollTop+=d.accumulated,d.scrollTop!==u&&(d.accumulated=0)}return o()}return t>Date.now()?(i=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop)?p({animation:kj(s.current,s.current.resize),ignoreEscapes:a,duration:Math.max(0,t-Date.now())||void 0}):d.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return(!0!==e.wait&&(d.animation=void 0),d.animation?.behavior===n)?d.animation.promise:o()},[u,l,d]),f=(0,Q.useCallback)(()=>{c(!0),u(!1)},[c,u]),m=(0,Q.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:r}=d,{lastScrollTop:n=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,r&&r>t&&(n=r),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===r)return;if(l()){c(!0),u(!1);return}let e=t>n,a=t<n;if(d.animation?.ignoreEscapes){d.scrollTop=n;return}a&&(c(!0),u(!1)),e&&c(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[c,u,l,d]),h=(0,Q.useCallback)(({target:e,deltaY:t})=>{let r=e;for(;!["scroll","auto"].includes(getComputedStyle(r).overflow);){if(!r.parentElement)return;r=r.parentElement}r===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,d]),g=kD(e=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",h),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",h,{passive:!0})},[]),b=kD(e=>{let t;d.resizeObserver?.disconnect(),e&&(d.resizeObserver=new ResizeObserver(([e])=>{let{height:r}=e.contentRect,n=r-(t??r);if(d.resizeDifference=n,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),n>=0){let e=kj(s.current,t?s.current.resize:s.current.initial);p({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else d.isNearBottom&&(c(!1),u(!0));t=r,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===n&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e))},[]);return{contentRef:b,scrollRef:g,scrollToBottom:p,stopScroll:f,isAtBottom:n||i,isNearBottom:i,escapedFromLock:t,state:d}})(),{stream:O,messages:L,todos:P,files:D,ui:M,setFiles:j,isLoading:F,isThreadLoading:$,interrupt:U,sendMessage:z,stopStream:B,resumeInterrupt:H,subAgentActivity:G,asyncTasks:V,summarizationEvent:q}=vZ(),{tasks:W}=kw(w,{enabled:Object.keys(V??{}).length>0}),Z=(0,Q.useMemo)(()=>kn(W),[W]),[K]=kR(w),Y=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{Y.current=!1},[w]),(0,Q.useEffect)(()=>{F&&(Y.current=!1)},[F]),(0,Q.useEffect)(()=>{var e;if(!W||0===W.length||!w||!K)return;if(!(w&&kT()[w]?.initialized===!0))return void kI(w,W.filter(e=>kr(e.liveStatus)).map(S9));if(F||Y.current||h.trim())return;let t=function(e){if(!e)return new Set;let t=kT()[e];return new Set(Array.isArray(t?.keys)?t.keys:[])}(w);for(let r of W){if(!kr(r.liveStatus))continue;let n=S9(r);if(!t.has(n)){if(L.some(e=>"human"===e.type&&S7(vB(e),r))){kC(w,n);continue}Y.current=!0,kC(w,n),z(ke(r)),u_.toast.success(`Auto-reported ${S5[e=r.agent_name]??e} to the main chat.`);break}}},[W,K,F,h,L,z,w]),(0,Q.useEffect)(()=>{F&&R()},[F,R]);let X=(0,Q.useRef)({sendMessage:z,isLoading:F,messages:L,threadId:w});X.current={sendMessage:z,isLoading:F,messages:L,threadId:w};let ee=(0,Q.useRef)(r);ee.current=r,(0,Q.useEffect)(()=>(ee.current?.((e,t)=>{let r=X.current;return r.threadId!==t?"wrong-thread":r.isLoading?"busy":r.messages.some(t=>"human"===t.type&&S7(vB(t),e))?"duplicate":(kC(t,S9(e)),r.sendMessage(ke(e)),"sent")}),()=>ee.current?.(null)),[]);let et=(0,Q.useMemo)(()=>{for(let e=L.length-1;e>=0;e--){let t=L[e];if("ai"!==t.type)continue;let r=t.response_metadata,n=function(e,t){if("string"!=typeof e||!e.trim())return null;let r=e.trim(),n=r.lastIndexOf("/"),a=n>=0?r.slice(0,n):"";n>=0&&(r=r.slice(n+1)),r=r.replace(/-\d{8}$/,"");let i="string"==typeof t&&t.trim()||a;return{name:r,provider:i?i.charAt(0).toUpperCase()+i.slice(1):null}}(r?.model_name??r?.model,r?.model_provider);if(n)return n}return null},[L]),er=(0,Q.useMemo)(()=>{let e={},t=Object.keys(G);if(0===t.length)return e;let r=[],n={};for(let e of L)if("ai"===e.type)for(let t of e.tool_calls??[])"task"===t.name&&t.id&&r.push(t.id);else if("tool"===e.type){let t=e.tool_call_id;t&&(n[t]=vB(e))}let a=e=>e.replace(/\s+/g," ").trim(),i=new Set;for(let o of r){let r=a(n[o]??"");if(!r)continue;let s=t.find(e=>{if(i.has(e))return!1;let t=a(function(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if("text"===r.kind)return r.text}return""}(G[e]));return""!==t&&(r.includes(t)||t.includes(r))});s&&(e[o]=G[s],i.add(s))}let o=t.filter(e=>!i.has(e)),s=0;for(let t of r)e[t]||n[t]||s<o.length&&(e[t]=G[o[s++]]);return e},[L,G]),en=U?.value,ea=en?.type==="ask_user"||Array.isArray(en?.action_requests)&&en.action_requests.length>0,ei=F||!e||ea,eo=(0,Q.useCallback)(()=>{x(!0),k_(w,!0),k(!1)},[w]),es=(0,Q.useCallback)(()=>{x(!1),k_(w,!1),k(!1),T.current=null},[w]);(0,Q.useEffect)(()=>{let e=A.current;if(e!==w){if(null===e&&null!==w&&N.current){let e;(e=kb())[kg]&&(e[w]=!0),kg in e&&(delete e[kg],ky(e))}else null===e&&null!==w&&k_(null,!1);x(kv(w)),T.current=null,k(!1),y([]),N.current=!1,A.current=w}},[w]);let el=(0,Q.useCallback)(async e=>{let t=Array.from(e.target.files??[]);if(e.target.value="",0!==t.length){_(!0);try{let e=new FormData;t.forEach(t=>e.append("files",t));let r=await fetch("/api/workspace/upload",{method:"POST",body:e}),n=await r.json();if(!r.ok||!n.files)throw Error(n.error||"Failed to upload files.");y(e=>[...e,...n.files]),u_.toast.success(`${n.files.length} file${1===n.files.length?"":"s"} uploaded to the workspace.`)}catch(e){u_.toast.error(e instanceof Error?e.message:"Failed to upload files.")}finally{_(!1)}}},[]),eu=(0,Q.useCallback)(e=>{y(t=>t.filter(t=>t.path!==e))},[]),ed=(0,Q.useCallback)(e=>{e&&e.preventDefault();let t=h.trim();if(!t||F||v||ei)return;N.current=null===w&&E;let r=b.length>0?`
|
|
70
|
+
`),t[t.length-1]])}let vI=["text","reasoning","tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result","image","video","audio","text-plain","file"];uR({},{AIMessage:()=>cQ,AIMessageChunk:()=>c2,BaseMessage:()=>cn,BaseMessageChunk:()=>cu,ChatMessage:()=>cE,ChatMessageChunk:()=>cx,DEFAULT_MERGE_IGNORE_KEYS:()=>ci,FunctionMessage:()=>cT,FunctionMessageChunk:()=>cA,HumanMessage:()=>cC,HumanMessageChunk:()=>cR,KNOWN_BLOCK_TYPES:()=>vI,RemoveMessage:()=>cP,SystemMessage:()=>cD,SystemMessageChunk:()=>cM,ToolMessage:()=>cb,ToolMessageChunk:()=>cy,_isMessageFieldWithRole:()=>cc,_mergeDicts:()=>co,_mergeLists:()=>cs,_mergeObj:()=>cl,_mergeStatus:()=>cr,coerceMessageLikeToMessage:()=>c6,collapseToolCallChunks:()=>dr,convertToChunk:()=>dt,convertToOpenAIImageBlock:()=>uj,convertToProviderContentBlock:()=>uU,defaultTextSplitter:()=>vN,defaultToolCallParser:()=>cv,filterMessages:()=>vy,getBufferString:()=>c9,iife:()=>c4,isAIMessage:()=>c0,isAIMessageChunk:()=>c1,isBase64ContentBlock:()=>uP,isBaseMessage:()=>cd,isBaseMessageChunk:()=>cp,isChatMessage:()=>cS,isChatMessageChunk:()=>ck,isDataContentBlock:()=>uO,isDirectToolOutput:()=>cg,isFunctionMessage:()=>cN,isFunctionMessageChunk:()=>cI,isHumanMessage:()=>cO,isHumanMessageChunk:()=>cL,isIDContentBlock:()=>uM,isMessage:()=>uz,isOpenAIToolCallArray:()=>ca,isPlainTextContentBlock:()=>uD,isSystemMessage:()=>cj,isSystemMessageChunk:()=>cF,isToolMessage:()=>c_,isToolMessageChunk:()=>cw,isURLContentBlock:()=>uL,mapChatMessagesToStoredMessages:()=>de,mapStoredMessageToChatMessage:()=>c8,mapStoredMessagesToChatMessages:()=>c7,mergeContent:()=>ct,mergeMessageRuns:()=>v_,mergeResponseMetadata:()=>cf,mergeUsageMetadata:()=>ch,parseBase64DataUrl:()=>u$,parseMimeType:()=>uF,trimMessages:()=>vE});var vC=class{chunks={};constructor(){this.chunks={}}add(e,t){e.type.endsWith("MessageChunk")&&(e.type=e.type.slice(0,-12).toLowerCase());let r="remove"===e.type&&null!=e.id?new cP({...e,id:e.id}):c6(e),n=function(e){try{return dt(e)}catch{return null}}(r),{id:a}=n??r;if(!a)return console.warn("No message ID found for chunk, ignoring in state",e),null;if(this.chunks[a]??={},this.chunks[a].metadata=t??this.chunks[a].metadata,n){let e=this.chunks[a].chunk;this.chunks[a].chunk=(cp(e)?e:null)?.concat(n)??n}else this.chunks[a].chunk=r;return a}clear(){this.chunks={}}get(e,t){return null==e||null==this.chunks[e]?null:(null!=t&&(this.chunks[e].index??=t),this.chunks[e])}};let vR=e=>{let{type:t,data:r}=e.toDict();return{...r,type:t}};var vO=class extends Error{constructor(e){super(e.message),this.name=e.name??e.error??"StreamError"}static isStructuredError(e){return"object"==typeof e&&null!=e&&"message"in e}},vL=class{abortRef=new AbortController;messages;listeners=new Set;state;constructor(e){this.messages=e,this.state={isLoading:!1,values:null,error:void 0}}setState=e=>{this.state={...this.state,...e},this.notifyListeners()};notifyListeners=()=>{this.listeners.forEach(e=>e())};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;get isLoading(){return this.state.isLoading}get values(){return this.state.values?.[0]??null}get error(){return this.state.error}setStreamValues=(e,t="stream")=>{if("function"==typeof e){let[r,n]=this.state.values??[null,"stream"],a=e(r,n);this.setState({values:null!=a?[a,t]:null})}else this.setState({values:null!=e?[e,t]:null})};getMutateFn=(e,t)=>r=>{let n={...t,...(this.state.values??[null,"stream"])[0]},a="function"==typeof r?r(n):r;this.setStreamValues({...n,...a},e)};matchEventType=(e,t,r)=>e===t||t.startsWith(`${e}|`);start=async(e,t)=>{if(!this.state.isLoading)try{let r;for await(let{event:n,data:a}of(this.setState({isLoading:!0,error:void 0}),this.abortRef=new AbortController,await e(this.abortRef.signal))){if("error"===n){r=new vO(a);break}let e=n.includes("|")?n.split("|").slice(1):void 0,i=this.getMutateFn("stream",t.initialValues);if("metadata"===n&&t.callbacks.onMetadataEvent?.(a),"events"===n&&t.callbacks.onLangChainEvent?.(a),this.matchEventType("updates",n,a)&&t.callbacks.onUpdateEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("custom",n,a)&&t.callbacks.onCustomEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("checkpoints",n,a)&&t.callbacks.onCheckpointEvent?.(a,{namespace:e}),this.matchEventType("tasks",n,a)&&t.callbacks.onTaskEvent?.(a,{namespace:e}),this.matchEventType("debug",n,a)&&t.callbacks.onDebugEvent?.(a,{namespace:e}),"values"===n&&("__interrupt__"in a?this.setStreamValues(e=>({...e,...a})):this.setStreamValues(a)),this.matchEventType("messages",n,a)){let[e,r]=a,n=this.messages.add(e,r);if(!n){console.warn("Failed to add message to manager, no message ID found");continue}this.setStreamValues(e=>{let r={...t.initialValues,...e},a=t.getMessages(r).slice(),{chunk:i,index:o}=this.messages.get(n,a.length)??{};return i&&null!=o?("remove"===i.getType()?a.splice(o,1):a[o]=vR(i),t.setMessages(r,a)):r})}}if(null!=r)throw r;let n=await t.onSuccess?.();void 0!==n&&this.setStreamValues(n)}catch(e){e instanceof Error&&("AbortError"===e.name||"TimeoutError"===e.name)||(console.error(e),this.setState({error:e}),await t.onError?.(e))}finally{this.setState({isLoading:!1}),this.abortRef=new AbortController,t.onFinish?.()}};stop=async(e,t)=>{this.abortRef.abort(),this.abortRef=new AbortController,t.onStop?.({mutate:this.getMutateFn("stop",e)})};clear=()=>{this.abortRef.abort(),this.abortRef=new AbortController,this.setState({error:void 0,values:null,isLoading:!1}),this.messages.clear()}};let vP=e=>{let[t,r]=(0,Q.useState)(e?.threadId??null),n=(0,Q.useRef)(e?.onThreadId);n.current=e?.onThreadId;let a=(0,Q.useCallback)(e=>{r(e),n.current?.(e)},[]);return e&&"threadId"in e?[e.threadId??null,a]:[t,a]};function vD(e,t,r){return[e["~configHash"],t,r].join(":")}function vM(e){let[t]=(0,Q.useState)("transport"in e);return t?function(e){let[t]=(0,Q.useState)(()=>new vC),[r]=(0,Q.useState)(()=>new vL(t));(0,Q.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot);let[n,a]=vP(e),i=(0,Q.useRef)(n);(0,Q.useEffect)(()=>{i.current!==n&&(i.current=n,r.clear())},[n,r]);let o=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},s=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},l=e.initialValues??{},u=async(t,u)=>{let c,d=n;r.setStreamValues(()=>u?.optimisticValues!=null?{...l,..."function"==typeof u.optimisticValues?u.optimisticValues(l):u.optimisticValues}:{...l}),await r.start(async r=>{if(d||(i.current=d=crypto.randomUUID(),a(d)),!d)throw Error("Failed to obtain valid thread ID.");return e.transport.stream({input:t,context:u?.context,command:u?.command,signal:r,config:{...u?.config,configurable:{thread_id:d,...u?.config?.configurable}}})},{getMessages:o,setMessages:s,initialValues:{},callbacks:e,onSuccess:()=>void 0,onError(t){e.onError?.(t,c)}})};return{get values(){return r.values??{}},error:r.error,isLoading:r.isLoading,stop:()=>r.stop(l,{onStop:e.onStop}),submit:u,get interrupt(){if(null!=r.values&&"__interrupt__"in r.values&&Array.isArray(r.values.__interrupt__)){let e=r.values.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}return},get messages(){if(!r.values)return[];return o(r.values)}}}(e):function(e){let t,r=(0,Q.useRef)(e.reconnectOnMount),n=(0,Q.useMemo)(()=>{if("u"<typeof window)return null;let e=r.current;return!0===e?window.sessionStorage:"function"==typeof e?e():null},[]),a=(0,Q.useMemo)(()=>e.client??new nP({apiUrl:e.apiUrl,apiKey:e.apiKey,callerOptions:e.callerOptions,defaultHeaders:e.defaultHeaders}),[e.client,e.apiKey,e.apiUrl,e.callerOptions,e.defaultHeaders]),[i]=(0,Q.useState)(()=>new vC),[o]=(0,Q.useState)(()=>new vL(i));(0,Q.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot);let[s,l]=vP(e),u=(0,Q.useRef)([]),c=(0,Q.useCallback)((...e)=>{let t=u.current;for(let r of e)t.includes(r)||t.push(r)},[]),d=null!=e.onUpdateEvent,p=null!=e.onCustomEvent,f=null!=e.onLangChainEvent,m=null!=e.onDebugEvent,h=null!=e.onCheckpointEvent,g=null!=e.onTaskEvent,b=(0,Q.useMemo)(()=>{let e=[];return d&&e.push("updates"),p&&e.push("custom"),f&&e.push("events"),m&&e.push("debug"),h&&e.push("checkpoints"),g&&e.push("tasks"),e},[d,p,f,m,h,g]);(0,Q.useRef)(null).current=o.clear;let y=(0,Q.useRef)(s),v=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{y.current!==s&&(y.current=s,o.clear())},[s,o]);let _="object"==typeof e.fetchStateHistory&&null!=e.fetchStateHistory?e.fetchStateHistory.limit??!1:e.fetchStateHistory??!1,w=function(e,t,r,n){let a=vD(e,t,r),[i,o]=(0,Q.useState)(()=>({key:void 0,data:void 0,error:void 0,isLoading:null!=t})),s=(0,Q.useRef)(e);s.current=e;let l=(0,Q.useRef)(n?.onError);l.current=n?.onError;let u=(0,Q.useCallback)((e,t)=>{if(n.passthrough)return Promise.resolve([]);let r=s.current,a=vD(r,e,t);return null!=e?(o(e=>e.key===a?{...e,isLoading:!0}:{key:a,data:void 0,error:void 0,isLoading:!0}),(function(e,t,r){if(r?.limit===!1)return e.threads.getState(t).then(e=>null==e.checkpoint?[]:[e]);let n="number"==typeof r?.limit?r.limit:10;return e.threads.getHistory(t,{limit:n})})(r,e,{limit:t}).then(e=>(o(t=>t.key!==a?t:{key:a,data:e,error:void 0,isLoading:!1}),e),e=>(o(t=>t.key!==a?t:{key:a,data:t.data,error:e,isLoading:!1}),l.current?.(e),Promise.reject(e)))):(o({key:a,data:void 0,error:void 0,isLoading:!1}),Promise.resolve([]))},[n.passthrough]);return(0,Q.useEffect)(()=>{(null==n.submittingRef.current||n.submittingRef.current!==t)&&u(t,r)},[u,a]),{data:i.data,error:i.error,isLoading:i.isLoading,mutate:e=>u(e??t,r)}}(a,s,_,{passthrough:null!=e.experimental_thread,submittingRef:v,onError:e.onError}),E=e.experimental_thread??w,x=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},S=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},[k,T]=(0,Q.useState)(""),A=function(e,t){let{rootSequence:r,paths:n}=function(e){let t=new Set,r={};if(e.length<=1)return{rootSequence:{type:"sequence",items:e.map(e=>({type:"node",value:e,path:[]}))},paths:[]};e.forEach(e=>{let n=e.parent_checkpoint?.checkpoint_id??"$";r[n]??=[],r[n].push(e),e.checkpoint?.checkpoint_id!=null&&t.add(e.checkpoint.checkpoint_id)});let n=(...e)=>e.filter(e=>null!=e).sort((e,t)=>e.localeCompare(t)).at(-1),a=null==r.$?Object.keys(r).filter(e=>!t.has(e)).map(e=>{let t=[e],a=new Set,i=e;for(;t.length>0;){let e=t.shift();if(a.has(e))continue;a.add(e);let o=(r[e]??[]).flatMap(e=>e.checkpoint?.checkpoint_id??[]);i=n(i,...o),t.push(...o)}return{parentId:e,lastId:i}}).sort((e,t)=>e.lastId.localeCompare(t.lastId)).at(-1)?.parentId:void 0;null!=a&&(r.$=r[a]);let i={type:"sequence",items:[]},o=[{id:"$",sequence:i,path:[]}],s=[],l=new Set;for(;o.length>0;){let e,t=o.shift();if(l.has(t.id))continue;l.add(t.id);let n=r[t.id];if(null!=n&&0!==n.length)for(let r of(n.length>1&&(e={type:"fork",items:[]},t.sequence.items.push(e)),n)){let n=r.checkpoint?.checkpoint_id;if(null==n)continue;let{sequence:a}=t,{path:i}=t;null!=e&&(a={type:"sequence",items:[]},e.items.unshift(a),(i=i.slice()).push(n),s.push(i)),a.items.push({type:"node",value:r,path:i}),o.push({id:n,sequence:a,path:i})}}return{rootSequence:i,paths:s}}(t??[]),{history:a,branchByCheckpoint:i}=function(e,t,r){let n=r.split(">"),a={};for(let e of t){let t=e.at(-2)??"$";a[t]??=[],a[t].unshift(e)}let i=[],o={},s=n.slice(),l=[...e.items];for(;l.length>0;){let e=l.shift();if("node"===e.type){i.push(e.value);let t=e.value.checkpoint?.checkpoint_id;if(null==t)continue;o[t]={branch:e.path.join(">"),branchOptions:(e.path.length>0?a[e.path.at(-2)??"$"]??[]:[]).map(e=>e.join(">"))}}if("fork"===e.type){let t=s.shift(),r=null!=t?e.items.findIndex(e=>{let r=e.items.at(0);return!!r&&"node"===r.type&&r.value.checkpoint?.checkpoint_id===t}):-1,n=e.items.at(r)?.items??[];l.push(...n)}}return{history:i,branchByCheckpoint:o}}(r,n,e);return{branchTree:r,flatHistory:a,branchByCheckpoint:i,threadHead:a.at(-1)}}(k,E.data??void 0),N=A.threadHead?.values??e.initialValues??{},I=(()=>{let e=A.threadHead?.tasks?.at(-1)?.error;if(null!=e){try{let t=JSON.parse(e);if(vO.isStructuredError(t))return new vO(t);return t}catch{}return e}})(),C=(t=new Set,x(N).map((e,r)=>{let n=e.id??r,a=function(e,t){for(let r=e.length-1;r>=0;r-=1)if(t(e[r]))return e[r]}(E.data??[],e=>x(e.values).map((e,t)=>e.id??t).includes(n)),i=a?.checkpoint?.checkpoint_id,o=null!=i?A.branchByCheckpoint[i]:void 0;o?.branch?.length||(o=void 0);let s=o?.branchOptions?.flat(2).join(",");return s&&(t.has(s)&&(o=void 0),t.add(s)),{messageId:n.toString(),firstSeenState:a,branch:o?.branch,branchOptions:o?.branchOptions}})),R=async(t,r)=>{let i,c,d=r?.checkpoint?.checkpoint_id;T(null!=d?A.branchByCheckpoint[d]?.branch??"":"");let p=!0===_||"number"==typeof _,f=null!=e.onFinish||p;o.setStreamValues(()=>{let e=f?N:{...N,...o.values};return r?.optimisticValues!=null?{...e,..."function"==typeof r.optimisticValues?r.optimisticValues(e):r.optimisticValues}:{...e}});let m=s;await o.start(async o=>{if(m||(y.current=m=(await a.threads.create({threadId:r?.threadId,metadata:r?.metadata})).thread_id,v.current=m,l(m)),!m)throw Error("Failed to obtain valid thread ID.");v.current=m;let s=[...new Set([...r?.streamMode??[],...u.current,...b])],d=r?.checkpoint??(p?A.threadHead?.checkpoint:void 0)??void 0;r?.checkpoint===null&&(d=void 0),null!=d&&delete d.thread_id;let f=r?.streamResumable??!!n;return a.runs.stream(m,e.assistantId,{input:t,config:r?.config,context:r?.context,command:r?.command,interruptBefore:r?.interruptBefore,interruptAfter:r?.interruptAfter,metadata:r?.metadata,multitaskStrategy:r?.multitaskStrategy,onCompletion:r?.onCompletion,onDisconnect:r?.onDisconnect??(f?"continue":"cancel"),signal:o,checkpoint:d,streamMode:s,streamSubgraphs:r?.streamSubgraphs,streamResumable:f,durability:r?.durability,onRunCreated(t){i={run_id:t.run_id,thread_id:t.thread_id??m},n&&(c=`lg:stream:${m}`,n.setItem(c,i.run_id)),e.onCreated?.(i)}})},{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){if(c&&n?.removeItem(c),f){let t=await E.mutate(m),r=t?.at(0);if(r)return e.onFinish?.(r,i),null}},onError(t){e.onError?.(t,i)},onFinish(){v.current=null}})},O=async(t,r,i)=>{if(r??="-1",!s)return;let l={thread_id:s,run_id:t};await o.start(async e=>(v.current=s,a.runs.joinStream(s,t,{signal:e,lastEventId:r,streamMode:i?.streamMode})),{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){n?.removeItem(`lg:stream:${s}`);let t=await E.mutate(s),r=t?.at(0);r&&e.onFinish?.(r,l)},onError(t){e.onError?.(t,l)},onFinish(){v.current=null}})},L=(0,Q.useMemo)(()=>{if(!n||o.isLoading||"u"<typeof window)return;let e=n?.getItem(`lg:stream:${s}`);if(e)return{runId:e,threadId:s}},[n,o.isLoading,s]),P=!!n,D=(0,Q.useRef)({threadId:s,shouldReconnect:P}),M=(0,Q.useRef)(O);M.current=O,(0,Q.useEffect)(()=>{D.current.threadId!==s&&(D.current={threadId:s,shouldReconnect:P})},[s,P]),(0,Q.useEffect)(()=>{L&&D.current.shouldReconnect&&(D.current.shouldReconnect=!1,M.current?.(L.runId))},[L]);let j=o.error??I??E.error,F=o.values??N;return{get values(){return c("values"),F},client:a,assistantId:e.assistantId,error:j,isLoading:o.isLoading,stop:()=>o.stop(N,{onStop:t=>{if(n&&s){let e=n.getItem(`lg:stream:${s}`);e&&a.runs.cancel(s,e),n.removeItem(`lg:stream:${s}`)}e.onStop?.(t)}}),submit:R,joinStream:O,branch:k,setBranch:T,get history(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `history`");return A.flatHistory},isThreadLoading:E.isLoading&&null==E.data,get experimental_branchTree(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `experimental_branchTree`");return A.branchTree},get interrupt(){if(null!=F&&"__interrupt__"in F&&Array.isArray(F.__interrupt__)){let e=F.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}if(o.isLoading)return;let e=A.threadHead?.tasks?.at(-1)?.interrupts;if(null==e||0===e.length){if(!(A.threadHead?.next??[]).length||null!=j)return;return{when:"breakpoint"}}return e.at(-1)},get messages(){return c("messages-tuple","values"),x(F)},getMessagesMetadata(e,t){c("values");let r=i.get(e.id)?.metadata,n=C?.find(r=>r.messageId===(e.id??t));if(null!=r||null!=n)return{...n,streamMetadata:r}}}}(e)}let vj="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vF=new Uint8Array(16),v$=[];for(let e=0;e<256;++e)v$.push((e+256).toString(16).slice(1));let vU=function(e,t,r){if(vj&&!t&&!e)return vj();let n=(e=e||{}).random||(e.rng||function(){if(!d&&!(d="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return d(vF)})();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return v$[e[t+0]]+v$[e[t+1]]+v$[e[t+2]]+v$[e[t+3]]+"-"+v$[e[t+4]]+v$[e[t+5]]+"-"+v$[e[t+6]]+v$[e[t+7]]+"-"+v$[e[t+8]]+v$[e[t+9]]+"-"+v$[e[t+10]]+v$[e[t+11]]+v$[e[t+12]]+v$[e[t+13]]+v$[e[t+14]]+v$[e[t+15]]}(n)};function vz(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>e&&"object"==typeof e&&"text"in e?String(e.text??""):"").join(""):""}function vB(e){return"string"==typeof e.content?e.content:Array.isArray(e.content)?e.content.filter(e=>"object"==typeof e&&null!==e&&"type"in e&&"text"===e.type||"string"==typeof e).map(e=>"string"==typeof e?e:"object"==typeof e&&null!==e&&"text"in e&&e.text||"").join(""):""}function vH(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){if(e.description&&"string"==typeof e.description)return e.description;if(e.prompt&&"string"==typeof e.prompt)return e.prompt;if(e.result&&"string"==typeof e.result)return e.result}return JSON.stringify(e,null,2)}function vG(e){let t=0;for(let r of e){let e=r.content;if("string"==typeof e)t+=e.length;else if(Array.isArray(e))for(let r of e){let e=r?.text;"string"==typeof e&&(t+=e.length)}}return t}function vV(e){if(!e||"object"!=typeof e)return null;try{return JSON.stringify(e.value??null)}catch{return null}}function vq({children:e,activeAssistant:t,onHistoryRevalidate:r,thread:n}){let a=function({activeAssistant:e,onHistoryRevalidate:t,thread:r}){let[n,a]=ec("threadId"),i=nj(),[o,s]=(0,Q.useState)({}),l=vM({assistantId:e?.assistant_id||"",client:i??void 0,reconnectOnMount:!0,threadId:n??null,onThreadId:a,defaultHeaders:{"x-auth-scheme":"langsmith"},fetchStateHistory:!0,onFinish:t,onError:t,onCreated:t,onUpdateEvent:(e,t)=>{let r=t?.namespace;if(!r||0===r.length)return;let n=function(e){let t=[];if(!e||"object"!=typeof e)return t;for(let r of Object.values(e)){let e=r?.messages;if(Array.isArray(e))for(let r of e)if("ai"===r.type&&r.tool_calls&&r.tool_calls.length>0)for(let e of r.tool_calls)t.push({kind:"tool_call",id:e.id??"",name:e.name??"tool",args:e.args&&"object"==typeof e.args?e.args:{}});else if("ai"===r.type){let e=vz(r.content).trim();e&&t.push({kind:"text",text:e})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()})}return t}(e);if(0===n.length)return;let a=r.join("|");s(e=>({...e,[a]:[...e[a]??[],...n]}))},experimental_thread:r}),[u,c]=(0,Q.useState)(void 0),[d,p]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e;if(!n){c(void 0),m(null),p(null);return}let t=l.messages.length,r=!1,a=0,o=async()=>{a+=1;try{let s=await i.threads.getState(n);if(r)return;let u=s.values?.messages,d=s.tasks?.at(-1)?.interrupts,f=Array.isArray(d)&&d.length>0?d[d.length-1]:void 0,h=Array.isArray(s.next)&&s.next.length>0;Array.isArray(u)&&u.length>t&&m(u);let g=function(e){if(!e||"object"!=typeof e)return;let t=e.value;if(!t||"object"!=typeof t)return;let r={...t};return"action_requests"in t&&!Array.isArray(t.action_requests)&&(r.action_requests=[]),"review_configs"in t&&!Array.isArray(t.review_configs)&&(r.review_configs=[]),{...e,value:r}}(f);if(g){c(g),p(null),Array.isArray(u)&&m(u);return}if(!h){c(void 0),p(vV(l.interrupt)),Array.isArray(u)&&m(u);return}h&&a<15&&!r&&(e=setTimeout(o,1e3))}catch{!r&&a<15&&(e=setTimeout(o,1e3))}};return o(),()=>{r=!0,e&&clearTimeout(e)}},[n,l.interrupt,l.isLoading,i]);let h=l.interrupt,g=h&&(null===d||vV(h)!==d)?h:u??void 0,b=f&&(f.length>l.messages.length||!l.isLoading&&f.length===l.messages.length&&vG(f)>vG(l.messages))?f:l.messages,y=(0,Q.useCallback)(r=>{c(void 0),m(null),p(null);let n={id:vU(),type:"human",content:r};l.submit({messages:[n]},{optimisticValues:e=>({messages:[...e.messages??[],n]}),config:{...e?.config??{},recursion_limit:100},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,e?.config,t]),v=(0,Q.useCallback)(async e=>{n&&await i.threads.updateState(n,{values:{files:e}})},[i,n]),_=(0,Q.useCallback)(e=>{c(void 0),m(null),p(null),l.submit(null,{command:{resume:e},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,t]),w=(0,Q.useCallback)(()=>{l.stop()},[l]);return{stream:l,todos:l.values.todos??[],files:l.values.files??{},email:l.values.email,asyncTasks:l.values.async_tasks??{},summarizationEvent:function(e){if(!e||"object"!=typeof e)return null;let t=e.summary_message,r="string"==typeof t?.content?t.content:"";if(!r)return null;let n=e.cutoff_index,a=e.file_path;return{cutoffIndex:"number"==typeof n&&n>=0?n:0,content:r,filePath:"string"==typeof a?a:null}}(l.values._summarization_event),ui:l.values.ui,setFiles:v,messages:b,isLoading:l.isLoading,isThreadLoading:l.isThreadLoading,interrupt:g,sendMessage:y,stopStream:w,resumeInterrupt:_,subAgentActivity:o}}({activeAssistant:t,onHistoryRevalidate:r,thread:n});return(0,J.jsx)(vW.Provider,{value:a,children:e})}let vW=(0,Q.createContext)(void 0);function vZ(){let e=(0,Q.useContext)(vW);if(void 0===e)throw Error("useChatContext must be used within a ChatProvider");return e}let vK=ro("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),vY=ro("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),vX=ro("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),vJ=ro("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),vQ=ro("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),v0=ro("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),v1=ro("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),v2=ro("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),v4=ro("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),v3=ro("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),v5=ro("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),v6=ro("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),v9=Q.default.memo(({subAgent:e,onClick:t,isExpanded:r=!0})=>{let n="pending"===e.status;return(0,J.jsx)("div",{className:"w-fit max-w-[70vw] overflow-hidden rounded-lg bg-card",children:(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:t,className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left",children:[(0,J.jsx)("span",{className:"bg-[var(--brand)]/10 flex size-5 shrink-0 items-center justify-center rounded-md text-[var(--brand)]",children:n?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(v6,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("span",{className:"truncate text-sm font-semibold text-foreground",children:e.subAgentName}),(0,J.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:"subagent"}),r?(0,J.jsx)(li,{size:14,className:"ml-auto shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"ml-auto shrink-0 text-muted-foreground"})]})})});v9.displayName="SubAgentIndicator";let v8=ro("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),v7=ro("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),_e=ro("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),_t=Q.createContext(null);function _r(){let e=Q.useContext(_t);if(!e)throw Error("useStreamContext must be used within a LoadExternalComponent");return new Proxy(e,{get:(e,t)=>"meta"===t?e.meta:e.stream[t]})}let _n=new class{cache={};boundCache={};callbacks={};respond(e,t,r){this.cache[e]={comp:t,target:r},this.callbacks[e]?.forEach(e=>e(t,r))}getBoundStore(e){return this.boundCache[e]??={subscribe:t=>(this.callbacks[e]??=[],this.callbacks[e].push(t),()=>{this.callbacks[e]=this.callbacks[e].filter(e=>e!==t)}),getSnapshot:()=>this.cache[e]},this.boundCache[e]}},_a=Symbol.for("LGUI_EXT_STORE"),_i=Symbol.for("LGUI_REQUIRE"),_o=Symbol.for("LGUI_REQUIRE_EXTRA");function _s({stream:e,namespace:t,message:r,meta:n,fallback:a,components:i,...o}){let s=Q.useRef(null),l=Q.useId(),u=`child-shadow-${l}`,c=Q.useMemo(()=>_n.getBoundStore(u),[u]),d=Q.useSyncExternalStore(c.subscribe,c.getSnapshot),p=i?.[r.name],f=null!=p,m=null;(e=>!!Q.isValidElement(e)||null==e||"string"==typeof e||"number"==typeof e||"bigint"==typeof e||"boolean"==typeof e||null!=e&&"object"==typeof e&&Symbol.iterator in e||null!=e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then)(a)?m=a:"object"==typeof a&&null!=a&&(m=a?.[r.name]);let h=t??e.assistantId,g=e.client["~ui"];return(Q.useEffect(()=>{f||g.getComponent(h,r.name).then(e=>{let t=s.current;if(!t)return;let r=t.shadowRoot??t.attachShadow({mode:"open"}),n=document.createRange().createContextualFragment(e.replace("{{shadowRootId}}",u));r.appendChild(n)})},[g,h,r.name,u,f]),f)?(0,J.jsx)(_t.Provider,{value:{stream:e,meta:n},children:Q.createElement(p,r.props)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{id:u,ref:s,...o}),(0,J.jsx)(_t.Provider,{value:{stream:e,meta:n},children:d?.target!=null?ek.createPortal(Q.createElement(d.comp,r.props),d.target):m})]})}"u">typeof window&&(window[_a]=_n,window[_i]=e=>{if("react"===e)return Q;if("react-dom"===e)return ek;if("react/jsx-runtime"===e)return J;if("@langchain/langgraph-sdk/react"===e)return{useStream:vM};if("@langchain/langgraph-sdk/react-ui"===e)return{useStreamContext:_r,LoadExternalComponent:()=>{throw Error("Nesting LoadExternalComponent is not supported")}};if(null!=window[_o]&&"object"==typeof window[_o]&&e in window[_o])return window[_o][e];throw Error(`Unknown module...: ${e}`)});let _l=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)("textarea",{className:rZ("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));function _u({actionRequest:e,reviewConfig:t,onResume:r,isLoading:n,onSubmitted:a}){let[i,o]=(0,Q.useState)(""),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)({}),[d,p]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(!1),h=t?.allowedDecisions??t?.allowed_decisions??["approve","reject","edit"],g=e=>{(0,ek.flushSync)(()=>{m(!0),a&&a()}),r(e)};return f?null:(0,J.jsxs)("div",{className:"w-full rounded-md border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(v7,{size:16,className:"text-yellow-600 dark:text-yellow-400"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Approval Required"})]}),e.description&&(0,J.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:e.description}),(0,J.jsxs)("div",{className:"mb-4 rounded-sm border border-border bg-background p-3",children:[(0,J.jsxs)("div",{className:"mb-2",children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool"}),(0,J.jsx)("p",{className:"mt-1 font-mono text-sm font-medium text-foreground",children:e.name})]}),s?(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Edit Arguments"}),(0,J.jsx)("div",{className:"mt-2 space-y-3",children:Object.entries(e.args).map(([e,t])=>(0,J.jsxs)("div",{children:[(0,J.jsx)("label",{className:"mb-1 block text-xs font-medium text-foreground",children:e}),(0,J.jsx)(_l,{value:void 0!==u[e]?"string"==typeof u[e]?u[e]:JSON.stringify(u[e],null,2):"string"==typeof t?t:JSON.stringify(t,null,2),onChange:t=>((e,t)=>{try{let r=t.trim().startsWith("{")||t.trim().startsWith("[")?JSON.parse(t):t;c(t=>({...t,[e]:r}))}catch{c(r=>({...r,[e]:t}))}})(e,t.target.value),className:"font-mono text-xs",rows:"string"==typeof t&&t.length<100?2:4,disabled:n})]},e))})]}):(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("pre",{className:"mt-2 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs text-foreground",children:JSON.stringify(e.args,null,2)})]})]}),d&&!s&&(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("label",{className:"mb-2 block text-xs font-medium text-foreground",children:"Rejection Message (optional)"}),(0,J.jsx)(_l,{value:i,onChange:e=>o(e.target.value),placeholder:"Explain why you're rejecting this action…",className:"text-sm",rows:2,disabled:n})]}),(0,J.jsx)("div",{className:"flex flex-wrap gap-2",children:s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!1),c({})},disabled:n,children:"Cancel"}),(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{s&&(g({decisions:[{type:"edit",edited_action:{name:e.name,args:u}}]}),l(!1),c({}))},disabled:n,className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",children:[(0,J.jsx)(ln,{size:14}),n?"Saving…":"Save & Approve"]})]}):d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{p(!1),o("")},disabled:n,children:"Cancel"}),(0,J.jsx)(na,{type:"button",variant:"destructive",size:"sm",onClick:()=>{g({decisions:[{type:"reject",message:i.trim()}]})},disabled:n,children:n?"Rejecting…":"Confirm Reject"})]}):(0,J.jsxs)(J.Fragment,{children:[h.includes("reject")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{d?g({decisions:[{type:"reject",message:i.trim()}]}):p(!0)},disabled:n,className:"text-destructive hover:bg-destructive/10",children:[(0,J.jsx)(rs,{size:14}),"Reject"]}),h.includes("edit")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!0),c(JSON.parse(JSON.stringify(e.args))),p(!1)},disabled:n,children:[(0,J.jsx)(a4,{size:14}),"Edit"]}),h.includes("approve")&&(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{g({decisions:[{type:"approve"}]})},disabled:n,className:rZ("bg-green-600 text-white hover:bg-green-700","dark:bg-green-600 dark:hover:bg-green-700"),children:[(0,J.jsx)(ln,{size:14}),n?"Approving…":"Approve"]})]})})]})}_l.displayName="Textarea";let _c=Q.default.memo(({toolCall:e,uiComponent:t,stream:r,graphId:n,actionRequest:a,actionRequestKey:i,actionRequestSubmitted:o,onActionRequestSubmitted:s,reviewConfig:l,onResume:u,isLoading:c,autoApprove:d,compact:p=!1})=>{let[f,m]=(0,Q.useState)(()=>!!t||!!a&&!d),[h,g]=(0,Q.useState)({}),b=(0,Q.useMemo)(()=>a?`${e.id}:${a.name}:${JSON.stringify(a.args)}`:null,[a,e.id]),y=i??b,[v,_]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{y?_(e=>e&&e!==y?null:e):_(null)},[y]),(0,Q.useEffect)(()=>{t&&m(!0)},[t]);let w=(0,Q.useRef)(a);(0,Q.useEffect)(()=>{let e=!!w.current,t=!!a;!t||e||d?!t&&e&&m(!1):m(!0),w.current=a},[a,d]);let{name:E,args:x,result:S,status:k}=(0,Q.useMemo)(()=>{let t=e.args;return{name:function(e,t){if(!e)return"Unknown Tool";if("ToolSelectionResponse"===e)return"Adaptive tool selection";let r=e.toLowerCase();if("think_tool"===r)return"Reflection";if("read_file"===r||"write_file"===r||"edit_file"===r){let e,n=function(e){if(e&&"object"==typeof e)return e;if("string"==typeof e)try{let t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch{}return{}}(t),a=String(n.path??n.file_path??"");if("/memories"===(e=(a||"").trim())||e.startsWith("/memories/"))return"read_file"===r?"Reading memory":"Updating memory";if("read_file"===r){let e=function(e){let t=(e||"").trim();if(!t.startsWith("/skills/"))return"";let[r]=t.slice(8).split("/");return r||""}(a);if(e)return`Skill: ${e}`}}return e}(e.name,t),args:t&&"object"==typeof t?t:{},result:e.result,status:e.status||"completed"}},[e]),T=(0,Q.useMemo)(()=>{switch(k){case"completed":return(0,J.jsx)(vX,{});case"error":return(0,J.jsx)(v7,{size:14,className:"text-destructive"});case"pending":return(0,J.jsx)(a1,{size:14,className:"animate-spin"});case"interrupted":return(0,J.jsx)(_e,{size:14,className:"text-orange-500"});default:return(0,J.jsx)(v8,{size:14,className:"text-muted-foreground"})}},[k]),A=(0,Q.useCallback)(()=>{m(e=>!e)},[]),N=(0,Q.useCallback)(e=>{g(t=>({...t,[e]:!t[e]}))},[]),I=S||Object.keys(x).length>0,C=o??v===y,R=a&&u&&(!y||!C);return(0,J.jsxs)("div",{className:rZ("w-full overflow-hidden rounded-lg border-none shadow-none outline-none transition-colors duration-200 focus-within:ring-2 focus-within:ring-ring hover:bg-accent",p&&"rounded-md",f&&I&&"bg-accent"),children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",onClick:A,className:rZ("flex w-full items-center justify-between gap-2 border-none px-2 py-2 text-left shadow-none outline-none disabled:cursor-default",p&&"h-auto min-h-8 py-1.5"),disabled:!I,children:(0,J.jsxs)("div",{className:"flex w-full items-center justify-between gap-2",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[T,(0,J.jsx)("span",{className:rZ("text-[15px] font-medium tracking-[-0.6px] text-foreground",p&&"text-xs tracking-normal"),children:E})]}),I&&(f?(0,J.jsx)(li,{size:14,className:"shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"shrink-0 text-muted-foreground"}))]})}),f&&I&&(0,J.jsx)("div",{className:rZ("px-4 pb-4",p&&"px-2 pb-2"),children:t&&r&&n?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_s,{stream:r,message:t,namespace:n,meta:{status:k,args:x,result:S??"No Result Yet"}},t.id)}):R?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_u,{actionRequest:a,reviewConfig:l,onResume:u,isLoading:c,onSubmitted:()=>{_(y),y&&s?.(y),m(!1)}})}):(0,J.jsxs)(J.Fragment,{children:[Object.keys(x).length>0&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("div",{className:"space-y-2",children:Object.entries(x).map(([e,t])=>(0,J.jsxs)("div",{className:"rounded-sm border border-border",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>N(e),className:"flex w-full items-center justify-between bg-muted/30 p-2 text-left text-xs font-medium transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,J.jsx)("span",{className:"font-mono",children:e}),h[e]?(0,J.jsx)(li,{size:12,className:"text-muted-foreground"}):(0,J.jsx)(la,{size:12,className:"text-muted-foreground"})]}),h[e]&&(0,J.jsx)("div",{className:rZ("border-t border-border bg-muted/20 p-2",p&&"p-1.5"),children:(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all font-mono text-xs leading-6 text-foreground",p&&"text-[11px] leading-5"),children:"string"==typeof t?t:JSON.stringify(t,null,2)})})]},e))})]}),S&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Result"}),(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs leading-7 text-foreground",p&&"p-1.5 text-[11px] leading-5"),children:"string"==typeof S?S:JSON.stringify(S,null,2)})]})]})})]})});function _d(){}function _p(){}_c.displayName="ToolCallBox";let _f=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_m=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_h={};function _g(e,t){return((t||_h).jsx?_m:_f).test(e)}let _b=/[ \t\n\f\r]/g;function _y(e){return""===e.replace(_b,"")}class _v{constructor(e,t){this.attribute=t,this.property=e}}_v.prototype.attribute="",_v.prototype.booleanish=!1,_v.prototype.boolean=!1,_v.prototype.commaOrSpaceSeparated=!1,_v.prototype.commaSeparated=!1,_v.prototype.defined=!1,_v.prototype.mustUseProperty=!1,_v.prototype.number=!1,_v.prototype.overloadedBoolean=!1,_v.prototype.property="",_v.prototype.spaceSeparated=!1,_v.prototype.space=void 0;let __=0,_w=_N(),_E=_N(),_x=_N(),_S=_N(),_k=_N(),_T=_N(),_A=_N();function _N(){return 2**++__}e.s(["boolean",0,_w,"booleanish",0,_E,"commaOrSpaceSeparated",0,_A,"commaSeparated",0,_T,"number",0,_S,"overloadedBoolean",0,_x,"spaceSeparated",0,_k],744);var _I=e.i(744);let _C=Object.keys(_I);class _R extends _v{constructor(e,t,r,n){let a=-1;if(super(e,t),function(e,t,r){r&&(e[t]=r)}(this,"space",n),"number"==typeof r)for(;++a<_C.length;){const e=_C[a];!function(e,t,r){r&&(e[t]=r)}(this,_C[a],(r&_I[e])===_I[e])}}}function _O(e){return e.toLowerCase()}_R.prototype.defined=!0;let _L=/[A-Z]/g,_P=/-[a-z]/g,_D=/^data[-\w.:]+$/i;function _M(e){return"-"+e.toLowerCase()}function _j(e){return e.charAt(1).toUpperCase()}let _F={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class _${constructor(e,t,r){this.normal=t,this.property=e,r&&(this.space=r)}}function _U(e,t){let r={},n={};for(let t of e)Object.assign(r,t.property),Object.assign(n,t.normal);return new _$(r,n,t)}function _z(e){let t={},r={};for(let[n,a]of Object.entries(e.properties)){let i=new _R(n,e.transform(e.attributes||{},n),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[_O(n)]=n,r[_O(i.attribute)]=n}return new _$(t,r,e.space)}_$.prototype.normal={},_$.prototype.property={},_$.prototype.space=void 0;let _B=_z({properties:{ariaActiveDescendant:null,ariaAtomic:_E,ariaAutoComplete:null,ariaBusy:_E,ariaChecked:_E,ariaColCount:_S,ariaColIndex:_S,ariaColSpan:_S,ariaControls:_k,ariaCurrent:null,ariaDescribedBy:_k,ariaDetails:null,ariaDisabled:_E,ariaDropEffect:_k,ariaErrorMessage:null,ariaExpanded:_E,ariaFlowTo:_k,ariaGrabbed:_E,ariaHasPopup:null,ariaHidden:_E,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_k,ariaLevel:_S,ariaLive:null,ariaModal:_E,ariaMultiLine:_E,ariaMultiSelectable:_E,ariaOrientation:null,ariaOwns:_k,ariaPlaceholder:null,ariaPosInSet:_S,ariaPressed:_E,ariaReadOnly:_E,ariaRelevant:null,ariaRequired:_E,ariaRoleDescription:_k,ariaRowCount:_S,ariaRowIndex:_S,ariaRowSpan:_S,ariaSelected:_E,ariaSetSize:_S,ariaSort:null,ariaValueMax:_S,ariaValueMin:_S,ariaValueNow:_S,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function _H(e,t){return t in e?e[t]:t}function _G(e,t){return _H(e,t.toLowerCase())}let _V=_z({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_T,acceptCharset:_k,accessKey:_k,action:null,allow:null,allowFullScreen:_w,allowPaymentRequest:_w,allowUserMedia:_w,alt:null,as:null,async:_w,autoCapitalize:null,autoComplete:_k,autoFocus:_w,autoPlay:_w,blocking:_k,capture:null,charSet:null,checked:_w,cite:null,className:_k,cols:_S,colSpan:null,content:null,contentEditable:_E,controls:_w,controlsList:_k,coords:_S|_T,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_w,defer:_w,dir:null,dirName:null,disabled:_w,download:_x,draggable:_E,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_w,formTarget:null,headers:_k,height:_S,hidden:_x,high:_S,href:null,hrefLang:null,htmlFor:_k,httpEquiv:_k,id:null,imageSizes:null,imageSrcSet:null,inert:_w,inputMode:null,integrity:null,is:null,isMap:_w,itemId:null,itemProp:_k,itemRef:_k,itemScope:_w,itemType:_k,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_w,low:_S,manifest:null,max:null,maxLength:_S,media:null,method:null,min:null,minLength:_S,multiple:_w,muted:_w,name:null,nonce:null,noModule:_w,noValidate:_w,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_w,optimum:_S,pattern:null,ping:_k,placeholder:null,playsInline:_w,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_w,referrerPolicy:null,rel:_k,required:_w,reversed:_w,rows:_S,rowSpan:_S,sandbox:_k,scope:null,scoped:_w,seamless:_w,selected:_w,shadowRootClonable:_w,shadowRootDelegatesFocus:_w,shadowRootMode:null,shape:null,size:_S,sizes:null,slot:null,span:_S,spellCheck:_E,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_S,step:null,style:null,tabIndex:_S,target:null,title:null,translate:null,type:null,typeMustMatch:_w,useMap:null,value:_E,width:_S,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_k,axis:null,background:null,bgColor:null,border:_S,borderColor:null,bottomMargin:_S,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_w,declare:_w,event:null,face:null,frame:null,frameBorder:null,hSpace:_S,leftMargin:_S,link:null,longDesc:null,lowSrc:null,marginHeight:_S,marginWidth:_S,noResize:_w,noHref:_w,noShade:_w,noWrap:_w,object:null,profile:null,prompt:null,rev:null,rightMargin:_S,rules:null,scheme:null,scrolling:_E,standby:null,summary:null,text:null,topMargin:_S,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_S,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_w,disableRemotePlayback:_w,prefix:null,property:null,results:_S,security:null,unselectable:null},space:"html",transform:_G}),_q=_z({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:_A,accentHeight:_S,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_S,amplitude:_S,arabicForm:null,ascent:_S,attributeName:null,attributeType:null,azimuth:_S,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_S,by:null,calcMode:null,capHeight:_S,className:_k,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:_S,diffuseConstant:_S,direction:null,display:null,dur:null,divisor:_S,dominantBaseline:null,download:_w,dx:null,dy:null,edgeMode:null,editable:null,elevation:_S,enableBackground:null,end:null,event:null,exponent:_S,externalResourcesRequired:null,fill:null,fillOpacity:_S,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:_T,g2:_T,glyphName:_T,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_S,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_S,horizOriginX:_S,horizOriginY:_S,id:null,ideographic:_S,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_S,k:_S,k1:_S,k2:_S,k3:_S,k4:_S,kernelMatrix:_A,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_S,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:_S,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:_S,overlineThickness:_S,paintOrder:null,panose1:null,path:null,pathLength:_S,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_k,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_S,pointsAtY:_S,pointsAtZ:_S,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_A,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_A,rev:_A,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_A,requiredFeatures:_A,requiredFonts:_A,requiredFormats:_A,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:_S,specularExponent:_S,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_S,strikethroughThickness:_S,string:null,stroke:null,strokeDashArray:_A,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_S,strokeOpacity:_S,strokeWidth:null,style:null,surfaceScale:_S,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_A,tabIndex:_S,tableValues:null,target:null,targetX:_S,targetY:_S,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_A,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_S,underlineThickness:_S,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_S,values:null,vAlphabetic:_S,vMathematical:_S,vectorEffect:null,vHanging:_S,vIdeographic:_S,version:null,vertAdvY:_S,vertOriginX:_S,vertOriginY:_S,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_S,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_H}),_W=_z({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),_Z=_z({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_G}),_K=_z({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),_Y=_U([_B,_V,_W,_Z,_K],"html"),_X=_U([_B,_q,_W,_Z,_K],"svg");var _J=e.i(15511);let _Q=_1("end"),_0=_1("start");function _1(e){return function(t){let r=t&&t.position&&t.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function _2(e){return e&&"object"==typeof e?"position"in e||"type"in e?_3(e.position):"start"in e||"end"in e?_3(e):"line"in e||"column"in e?_4(e):"":""}function _4(e){return _5(e&&e.line)+":"+_5(e&&e.column)}function _3(e){return _4(e&&e.start)+"-"+_4(e&&e.end)}function _5(e){return e&&"number"==typeof e?e:1}class _6 extends Error{constructor(e,t,r){super(),"string"==typeof t&&(r=t,t=void 0);let n="",a={},i=!1;if(t&&(a="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!a.cause&&e&&(i=!0,n=e.message,a.cause=e),!a.ruleId&&!a.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){const e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=o?o.line:void 0,this.name=_2(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=i&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_6.prototype.file="",_6.prototype.name="",_6.prototype.reason="",_6.prototype.message="",_6.prototype.stack="",_6.prototype.column=void 0,_6.prototype.line=void 0,_6.prototype.ancestors=void 0,_6.prototype.cause=void 0,_6.prototype.fatal=void 0,_6.prototype.place=void 0,_6.prototype.ruleId=void 0,_6.prototype.source=void 0;let _9={}.hasOwnProperty,_8=new Map,_7=/[A-Z]/g,we=new Set(["table","tbody","thead","tfoot","tr"]),wt=new Set(["td","th"]),wr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wn(e,t,r){var n,a,i,o,s,l,u,c,d;let p,f,m,h,g,b,y,v,_,w,E;return"element"===t.type?(n=e,a=t,i=r,f=p=n.schema,"svg"===a.tagName.toLowerCase()&&"html"===p.space&&(n.schema=_X),n.ancestors.push(a),m=ws(n,a.tagName,!1),h=function(e,t){let r,n,a={};for(n in t.properties)if("children"!==n&&_9.call(t.properties,n)){let i=function(e,t,r){let n=function(e,t){let r=_O(t),n=t,a=_v;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&_D.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(_P,_j);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_P.test(e)){let r=e.replace(_L,_M);"-"!==r.charAt(0)&&(r="-"+r),t="data"+r}}a=_R}return new a(n,t)}(e.schema,t);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){var a;let t;if(Array.isArray(r)&&(r=n.commaSeparated?(t={},(""===(a=r)[a.length-1]?[...a,""]:a).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):r.join(" ").trim()),"style"===n.property){let t="object"==typeof r?r:function(e,t){try{return(0,_J.default)(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};let t=new _6("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=wr+"#cannot-parse-style-attribute",t}}(e,String(r));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,r={};for(t in e)_9.call(e,t)&&(r[function(e){let t=e.replace(_7,wu);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return r}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&n.space?_F[n.property]||n.property:n.attribute,r]}}(e,n,t.properties[n]);if(i){let[n,o]=i;e.tableCellAlignToStyle&&"align"===n&&"string"==typeof o&&wt.has(t.tagName)?r=o:a[n]=o}}return r&&((a.style||(a.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),a}(n,a),g=wo(n,a),we.has(a.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&_y(e.value):_y(e))})),wa(n,h,m,a),wi(h,g),n.ancestors.pop(),n.schema=p,n.create(a,m,h,i)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return _d("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}wl(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=r,y=b=o.schema,"svg"===s.name&&"html"===b.space&&(o.schema=_X),o.ancestors.push(s),v=null===s.name?o.Fragment:ws(o,s.name,!0),_=function(e,t){let r={};for(let n of t.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&e.evaluater){let t=n.data.estree.body[0];_d("ExpressionStatement"===t.type);let a=t.expression;_d("ObjectExpression"===a.type);let i=a.properties[0];_d("SpreadElement"===i.type),Object.assign(r,e.evaluater.evaluateExpression(i.argument))}else wl(e,t.position);else{let a,i=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&e.evaluater){let t=n.value.data.estree.body[0];_d("ExpressionStatement"===t.type),a=e.evaluater.evaluateExpression(t.expression)}else wl(e,t.position);else a=null===n.value||n.value;r[i]=a}return r}(o,s),w=wo(o,s),wa(o,_,v,s),wi(_,w),o.ancestors.pop(),o.schema=b,o.create(s,v,_,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wl(e,t.position)}(e,t):"root"===t.type?(u=e,c=t,d=r,wi(E={},wo(u,c)),u.create(c,u.Fragment,E,d)):"text"===t.type?t.value:void 0}function wa(e,t,r,n){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(t.node=n)}function wi(e,t){if(t.length>0){let r=t.length>1?t:t[0];r&&(e.children=r)}}function wo(e,t){let r=[],n=-1,a=e.passKeys?new Map:_8;for(;++n<t.children.length;){let i,o=t.children[n];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=a.get(e)||0;i=e+"-"+t,a.set(e,t+1)}}let s=wn(e,o,i);void 0!==s&&r.push(s)}return r}function ws(e,t,r){let n;if(r)if(t.includes(".")){let e,r=t.split("."),a=-1;for(;++a<r.length;){let t=_g(r[a])?{type:"Identifier",name:r[a]}:{type:"Literal",value:r[a]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(a&&"Literal"===t.type),optional:!1}:t}_d(e,"always a result"),n=e}else n=_g(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else n={type:"Literal",value:t};if("Literal"===n.type){let t=n.value;return _9.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(n);wl(e)}function wl(e,t){let r=new _6("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=wr+"#cannot-handle-mdx-estrees-without-createevaluater",r}function wu(e){return"-"+e.toLowerCase()}let wc={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},wd={};function wp(e,t){let r=t||wd;return wf(e,"boolean"!=typeof r.includeImageAlt||r.includeImageAlt,"boolean"!=typeof r.includeHtml||r.includeHtml)}function wf(e,t,r){var n;if((n=e)&&"object"==typeof n){if("value"in e)return"html"!==e.type||r?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wm(e.children,t,r)}return Array.isArray(e)?wm(e,t,r):""}function wm(e,t,r){let n=[],a=-1;for(;++a<e.length;)n[a]=wf(e[a],t,r);return n.join("")}function wh(e,t,r,n){let a,i=e.length,o=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,r=r>0?r:0,n.length<1e4)(a=Array.from(n)).unshift(t,r),e.splice(...a);else for(r&&e.splice(t,r);o<n.length;)(a=n.slice(o,o+1e4)).unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function wg(e,t){return e.length>0?(wh(e,e.length,0,t),e):t}let wb={}.hasOwnProperty;function wy(e){let t={},r=-1;for(;++r<e.length;)!function(e,t){let r;for(r in t){let n,a=(wb.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];if(i)for(n in i){wb.call(a,n)||(a[n]=[]);let e=i[n];!function(e,t){let r=-1,n=[];for(;++r<t.length;)("after"===t[r].add?e:n).push(t[r]);wh(e,0,0,n)}(a[n],Array.isArray(e)?e:e?[e]:[])}}}(t,e[r]);return t}let wv=wR(/[A-Za-z]/),w_=wR(/[\dA-Za-z]/),ww=wR(/[#-'*+\--9=?A-Z^-~]/);function wE(e){return null!==e&&(e<32||127===e)}let wx=wR(/\d/),wS=wR(/[\dA-Fa-f]/),wk=wR(/[!-/:-@[-`{-~]/);function wT(e){return null!==e&&e<-2}function wA(e){return null!==e&&(e<0||32===e)}function wN(e){return -2===e||-1===e||32===e}let wI=wR(/\p{P}|\p{S}/u),wC=wR(/\s/);function wR(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wO(e,t,r,n){let a=n?n-1:1/0,i=0;return function(n){return wN(n)?(e.enter(r),function n(o){return wN(o)&&i++<a?(e.consume(o),n):(e.exit(r),t(o))}(n)):t(n)}}let wL={tokenize:function(e){let t,r=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(n){let a=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=a),t=a,function t(n){if(null===n){e.exit("chunkText"),e.exit("paragraph"),e.consume(n);return}return wT(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),t)}(n)}(r)});return r}},wP={tokenize:function(e){let t,r,n,a=this,i=[],o=0;return s;function s(t){if(o<i.length){let r=i[o];return a.containerState=r[1],e.attempt(r[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,a.containerState._closeFlow){let r;a.containerState._closeFlow=void 0,t&&b();let n=a.events.length,i=n;for(;i--;)if("exit"===a.events[i][0]&&"chunkFlow"===a.events[i][1].type){r=a.events[i][1].end;break}g(o);let s=n;for(;s<a.events.length;)a.events[s][1].end={...r},s++;return wh(a.events,i+1,0,a.events.slice(n)),a.events.length=s,u(e)}return s(e)}function u(r){if(o===i.length){if(!t)return p(r);if(t.currentConstruct&&t.currentConstruct.concrete)return m(r);a.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(wD,c,d)(r)}function c(e){return t&&b(),g(o),p(e)}function d(e){return a.parser.lazy[a.now().line]=o!==i.length,n=a.now().offset,m(e)}function p(t){return a.containerState={},e.attempt(wD,f,m)(t)}function f(e){return o++,i.push([a.currentConstruct,a.containerState]),p(e)}function m(n){if(null===n){t&&b(),g(0),e.consume(n);return}return t=t||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:r}),function t(r){if(null===r){h(e.exit("chunkFlow"),!0),g(0),e.consume(r);return}return wT(r)?(e.consume(r),h(e.exit("chunkFlow")),o=0,a.interrupt=void 0,s):(e.consume(r),t)}(n)}function h(e,i){let s=a.sliceStream(e);if(i&&s.push(null),e.previous=r,r&&(r.next=e),r=e,t.defineSkip(e.start),t.write(s),a.parser.lazy[e.start.line]){let e,r,i=t.events.length;for(;i--;)if(t.events[i][1].start.offset<n&&(!t.events[i][1].end||t.events[i][1].end.offset>n))return;let s=a.events.length,l=s;for(;l--;)if("exit"===a.events[l][0]&&"chunkFlow"===a.events[l][1].type){if(e){r=a.events[l][1].end;break}e=!0}for(g(o),i=s;i<a.events.length;)a.events[i][1].end={...r},i++;wh(a.events,l+1,0,a.events.slice(s)),a.events.length=i}}function g(t){let r=i.length;for(;r-- >t;){let t=i[r];a.containerState=t[1],t[0].exit.call(a,e)}i.length=t}function b(){t.write([null]),r=void 0,t=void 0,a.containerState._closeFlow=void 0}}},wD={tokenize:function(e,t,r){return wO(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},wM={partial:!0,tokenize:function(e,t,r){return function(t){return wN(t)?wO(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||wT(e)?t(e):r(e)}}};class wj{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let r=null==t?1/0:t;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){this.setCursor(Math.trunc(e));let n=this.right.splice(this.right.length-(t||0),1/0);return r&&wF(this.left,r),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),wF(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wF(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);wF(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wF(this.left,t.reverse())}}}function wF(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function w$(e){let t,r,n,a,i,o,s,l={},u=-1,c=new wj(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((n=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[n][1].type&&(n+=2),n<o.length&&"content"===o[n][1].type))for(;++n<o.length&&"content"!==o[n][1].type;)"chunkText"===o[n][1].type&&(o[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let r,n,a=e.get(t)[1],i=e.get(t)[2],o=t-1,s=[],l=a._tokenizer;!l&&(l=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},p=-1,f=a,m=0,h=0,g=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(r=i.sliceStream(f),f.next||r.push(null),n&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(r),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),n=f,f=f.next}for(f=a;++p<u.length;)"exit"===u[p][0]&&"enter"===u[p-1][0]&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(h=p+1,g.push(h),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),p=g.length;p--;){let t=u.slice(g[p],g[p+1]),r=s.pop();c.push([r,r+t.length-1]),e.splice(r,2,t)}for(c.reverse(),p=-1;++p<c.length;)d[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return d}(c,u)),u=l[u],s=!0);else if(t[1]._container){for(n=u,r=void 0;n--;)if("lineEnding"===(a=c.get(n))[1].type||"lineEndingBlank"===a[1].type)"enter"===a[0]&&(r&&(c.get(r)[1].type="lineEndingBlank"),a[1].type="lineEnding",r=n);else if("linePrefix"===a[1].type||"listItemIndent"===a[1].type);else break;r&&(t[1].end={...c.get(r)[1].start},(i=c.slice(r,u)).unshift(t),c.splice(r,u-r+1,i))}}return wh(e,0,1/0,c.slice(0)),!s}let wU={resolve:function(e){return w$(e),e},tokenize:function(e,t){let r;return function(t){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?a(t):wT(t)?e.check(wz,i,a)(t):(e.consume(t),n)}function a(r){return e.exit("chunkContent"),e.exit("content"),t(r)}function i(t){return e.consume(t),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}},wz={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,a,"linePrefix")};function a(a){if(null===a||wT(a))return r(a);let i=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(a):e.interrupt(n.parser.constructs.flow,r,t)(a)}}},wB={tokenize:function(e){let t=this,r=e.attempt(wM,function(n){return null===n?void e.consume(n):(e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,n,wO(e,e.attempt(this.parser.constructs.flow,n,e.attempt(wU,n)),"linePrefix")));return r;function n(n){return null===n?void e.consume(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,r)}}},wH={resolveAll:wW()},wG=wq("string"),wV=wq("text");function wq(e){return{resolveAll:wW("text"===e?wZ:void 0),tokenize:function(t){let r=this,n=this.parser.constructs[e],a=t.attempt(n,i,o);return i;function i(e){return l(e)?a(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),a(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=n[e],a=-1;if(t)for(;++a<t.length;){let e=t[a];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function wW(e){return function(t,r){let n,a=-1;for(;++a<=t.length;)void 0===n?t[a]&&"data"===t[a][1].type&&(n=a,a++):t[a]&&"data"===t[a][1].type||(a!==n+2&&(t[n][1].end=t[a-1][1].end,t.splice(n+2,a-n-2),a=n+2),n=void 0);return e?e(t,r):t}}function wZ(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let n,a=e[r-1][1],i=t.sliceStream(a),o=i.length,s=-1,l=0;for(;o--;){let e=i[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)n=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){let i={type:r===e.length||n||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:a.start._bufferIndex+s,_index:a.start._index+o,line:a.end.line,column:a.end.column-l,offset:a.end.offset-l},end:{...a.end}};a.end={...i.start},a.start.offset===a.end.offset?Object.assign(a,i):(e.splice(r,0,["enter",i,t],["exit",i,t]),r+=2)}r++}return e}function wK(e){return null===e||wA(e)||wC(e)?1:wI(e)?2:void 0}function wY(e,t,r){let n=[],a=-1;for(;++a<e.length;){let i=e[a].resolveAll;i&&!n.includes(i)&&(t=i(t,r),n.push(i))}return t}let wX={name:"attention",resolveAll:function(e,t){let r,n,a,i,o,s,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(r=c;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[r][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[r][1].end},p={...e[c][1].start};wJ(d,-s),wJ(p,s),i={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:p},a={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[c][1].start}},n={type:s>1?"strong":"emphasis",start:{...i.start},end:{...o.end}},e[r][1].end={...i.start},e[c][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=wg(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=wg(l,[["enter",n,t],["enter",i,t],["exit",i,t],["enter",a,t]]),l=wg(l,wY(t.parser.constructs.insideSpan.null,e.slice(r+1,c),t)),l=wg(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",n,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=wg(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,wh(e,r-1,c-r+3,l),c=r+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,a=this.previous,i=wK(a);return function(o){return r=o,e.enter("attentionSequence"),function o(s){if(s===r)return e.consume(s),o;let l=e.exit("attentionSequence"),u=wK(s),c=!u||2===u&&i||n.includes(s),d=!i||2===i&&u||n.includes(a);return l._open=!!(42===r?c:c&&(i||!d)),l._close=!!(42===r?d:d&&(u||!c)),t(s)}(o)}}};function wJ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let wQ={continuation:{tokenize:function(e,t,r){let n=this;return function(t){return wN(t)?wO(e,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):a(t)};function a(n){return e.attempt(wQ,t,r)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,r){let n=this;return function(t){if(62===t){let r=n.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),a}return r(t)};function a(r){return wN(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}},w0={name:"characterEscape",tokenize:function(e,t,r){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return wk(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(n)}}},w1=document.createElement("i");function w2(e){let t="&"+e+";";w1.innerHTML=t;let r=w1.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==t&&r}let w4={name:"characterReference",tokenize:function(e,t,r){let n,a,i=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),n=31,a=w_,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),n=6,a=wS,u):(e.enter("characterReferenceValue"),n=7,a=wx,u(t))}function u(s){if(59===s&&o){let n=e.exit("characterReferenceValue");return a!==w_||w2(i.sliceSerialize(n))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):r(s)}return a(s)&&o++<n?(e.consume(s),u):r(s)}}},w3={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return null===t?r(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},w5={concrete:!0,name:"codeFenced",tokenize:function(e,t,r){let n,a=this,i={partial:!0,tokenize:function(e,t,r){let i=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),wN(t)?wO(e,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===n?(e.enter("codeFencedFenceSequence"),function t(a){return a===n?(i++,e.consume(a),t):i>=s?(e.exit("codeFencedFenceSequence"),wN(a)?wO(e,u,"whitespace")(a):u(a)):r(a)}(t)):r(t)}function u(n){return null===n||wT(n)?(e.exit("codeFencedFence"),t(n)):r(n)}}},o=0,s=0;return function(t){var i;let u;return i=t,o=(u=a.events[a.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,n=i,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(a){return a===n?(s++,e.consume(a),t):s<3?r(a):(e.exit("codeFencedFenceSequence"),wN(a)?wO(e,l,"whitespace")(a):l(a))}(i)};function l(i){return null===i||wT(i)?(e.exit("codeFencedFence"),a.interrupt?t(i):e.check(w3,c,m)(i)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wT(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(a)):wN(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wO(e,u,"whitespace")(a)):96===a&&a===n?r(a):(e.consume(a),t)}(i))}function u(t){return null===t||wT(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wT(a)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(a)):96===a&&a===n?r(a):(e.consume(a),t)}(t))}function c(t){return e.attempt(i,m,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return o>0&&wN(t)?wO(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||wT(t)?e.check(w3,c,m)(t):(e.enter("codeFlowValue"),function t(r){return null===r||wT(r)?(e.exit("codeFlowValue"),f(r)):(e.consume(r),t)}(t))}function m(r){return e.exit("codeFenced"),t(r)}}},w6={name:"codeIndented",tokenize:function(e,t,r){let n=this;return function(t){return e.enter("codeIndented"),wO(e,a,"linePrefix",5)(t)};function a(t){let a=n.events[n.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?function t(r){return null===r?i(r):wT(r)?e.attempt(w9,t,i)(r):(e.enter("codeFlowValue"),function r(n){return null===n||wT(n)?(e.exit("codeFlowValue"),t(n)):(e.consume(n),r)}(r))}(t):r(t)}function i(r){return e.exit("codeIndented"),t(r)}}},w9={partial:!0,tokenize:function(e,t,r){let n=this;return a;function a(t){return n.parser.lazy[n.now().line]?r(t):wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):wO(e,i,"linePrefix",5)(t)}function i(e){let i=n.events[n.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):wT(e)?a(e):r(e)}}};function w8(e,t,r,n,a,i,o,s,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(n),e.enter(a),e.enter(i),e.consume(t),e.exit(i),d):null===t||32===t||41===t||wE(t)?r(t):(e.enter(n),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),m(t))};function d(r){return 62===r?(e.enter(i),e.consume(r),e.exit(i),e.exit(a),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(r))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||wT(t)?r(t):(e.consume(t),92===t?f:p)}function f(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function m(a){return!c&&(null===a||41===a||wA(a))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(n),t(a)):c<u&&40===a?(e.consume(a),c++,m):41===a?(e.consume(a),c--,m):null===a||32===a||40===a||wE(a)?r(a):(e.consume(a),92===a?h:m)}function h(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function w7(e,t,r,n,a,i){let o,s=this,l=0;return function(t){return e.enter(n),e.enter(a),e.consume(t),e.exit(a),e.enter(i),u};function u(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?r(d):93===d?(e.exit(i),e.enter(a),e.consume(d),e.exit(a),e.exit(n),t):wT(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||wT(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!wN(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function Ee(e,t,r,n,a,i){let o;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(a),e.consume(t),e.exit(a),o=40===t?41:t,s):r(t)};function s(r){return r===o?(e.enter(a),e.consume(r),e.exit(a),e.exit(n),t):(e.enter(i),l(r))}function l(t){return t===o?(e.exit(i),s(o)):null===t?r(t):wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||wT(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===o||92===t?(e.consume(t),u):u(t)}}function Et(e,t){let r;return function n(a){return wT(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,n):wN(a)?wO(e,n,r?"linePrefix":"lineSuffix")(a):t(a)}}function Er(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let En={partial:!0,tokenize:function(e,t,r){return function(t){return wA(t)?Et(e,n)(t):r(t)};function n(t){return Ee(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function a(t){return wN(t)?wO(e,i,"whitespace")(t):i(t)}function i(e){return null===e||wT(e)?t(e):r(e)}}},Ea=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ei=["pre","script","style","textarea"],Eo={partial:!0,tokenize:function(e,t,r){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(wM,t,r)}}},Es={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):r(t)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},El={name:"labelEnd",resolveAll:function(e){let t=-1,r=[];for(;++t<e.length;){let n=e[t][1];if(r.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let e="labelImage"===n.type?4:2;n.type="data",t+=e}}return e.length!==r.length&&wh(e,0,e.length,r),e},resolveTo:function(e,t){let r,n,a,i,o=e.length,s=0;for(;o--;)if(r=e[o][1],n){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[o][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(a){if("enter"===e[o][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(n=o,"labelLink"!==r.type)){s=2;break}}else"labelEnd"===r.type&&(a=o);let l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[n][1].start},end:{...e[a][1].end}},c={type:"labelText",start:{...e[n+s+2][1].end},end:{...e[a-2][1].start}};return i=wg(i=[["enter",l,t],["enter",u,t]],e.slice(n+1,n+s+3)),i=wg(i,[["enter",c,t]]),i=wg(i,wY(t.parser.constructs.insideSpan.null,e.slice(n+s+4,a-3),t)),i=wg(i,[["exit",c,t],e[a-2],e[a-1],["exit",u,t]]),i=wg(i,e.slice(a+1)),i=wg(i,[["exit",l,t]]),wh(e,n,e.length,i),e},tokenize:function(e,t,r){let n,a,i=this,o=i.events.length;for(;o--;)if(("labelImage"===i.events[o][1].type||"labelLink"===i.events[o][1].type)&&!i.events[o][1]._balanced){n=i.events[o][1];break}return function(t){return n?n._inactive?c(t):(a=i.parser.defined.includes(Er(i.sliceSerialize({start:n.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):r(t)};function s(t){return 40===t?e.attempt(Eu,u,a?u:c)(t):91===t?e.attempt(Ec,u,a?l:c)(t):a?u(t):c(t)}function l(t){return e.attempt(Ed,u,c)(t)}function u(e){return t(e)}function c(e){return n._balanced=!0,r(e)}}},Eu={tokenize:function(e,t,r){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return wA(t)?Et(e,a)(t):a(t)}function a(t){return 41===t?u(t):w8(e,i,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function i(t){return wA(t)?Et(e,s)(t):u(t)}function o(e){return r(e)}function s(t){return 34===t||39===t||40===t?Ee(e,l,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return wA(t)?Et(e,u)(t):u(t)}function u(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):r(n)}}},Ec={tokenize:function(e,t,r){let n=this;return function(t){return w7.call(n,e,a,i,"reference","referenceMarker","referenceString")(t)};function a(e){return n.parser.defined.includes(Er(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):r(e)}function i(e){return r(e)}}},Ed={tokenize:function(e,t,r){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):r(n)}}},Ep={name:"labelStartImage",resolveAll:El.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),a};function a(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),i):r(t)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Ef={name:"labelStartLink",resolveAll:El.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),a};function a(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Em={name:"lineEnding",tokenize:function(e,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),wO(e,t,"linePrefix")}}},Eh={name:"thematicBreak",tokenize:function(e,t,r){let n,a=0;return function(i){var o;return e.enter("thematicBreak"),n=o=i,function i(o){return o===n?(e.enter("thematicBreakSequence"),function t(r){return r===n?(e.consume(r),a++,t):(e.exit("thematicBreakSequence"),wN(r)?wO(e,i,"whitespace")(r):i(r))}(o)):a>=3&&(null===o||wT(o))?(e.exit("thematicBreak"),t(o)):r(o)}(o)}}},Eg={continuation:{tokenize:function(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(wM,function(r){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,wO(e,t,"listItemIndent",n.containerState.size+1)(r)},function(r){return n.containerState.furtherBlankLines||!wN(r)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(r)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Ey,t,a)(r))});function a(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,wO(e,e.attempt(Eg,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,r){let n=this,a=n.events[n.events.length-1],i=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,o=0;return function(t){let a=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===a?!n.containerState.marker||t===n.containerState.marker:wx(t)){if(n.containerState.type||(n.containerState.type=a,e.enter(a,{_container:!0})),"listUnordered"===a)return e.enter("listItemPrefix"),42===t||45===t?e.check(Eh,r,s)(t):s(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(a){return wx(a)&&++o<10?(e.consume(a),t):(!n.interrupt||o<2)&&(n.containerState.marker?a===n.containerState.marker:41===a||46===a)?(e.exit("listItemValue"),s(a)):r(a)}(t)}return r(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(wM,n.interrupt?r:l,e.attempt(Eb,c,u))}function l(e){return n.containerState.initialBlankLine=!0,i++,c(e)}function u(t){return wN(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):r(t)}function c(r){return n.containerState.size=i+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(r)}}},Eb={partial:!0,tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return!wN(e)&&a&&"listItemPrefixWhitespace"===a[1].type?t(e):r(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Ey={partial:!0,tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return a&&"listItemIndent"===a[1].type&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?t(e):r(e)},"listItemIndent",n.containerState.size+1)}},Ev={name:"setextUnderline",resolveTo:function(e,t){let r,n,a,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){r=i;break}"paragraph"===e[i][1].type&&(n=i)}else"content"===e[i][1].type&&e.splice(i,1),a||"definition"!==e[i][1].type||(a=i);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",a?(e.splice(n,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,r){let n,a=this;return function(t){var o;let s,l=a.events.length;for(;l--;)if("lineEnding"!==a.events[l][1].type&&"linePrefix"!==a.events[l][1].type&&"content"!==a.events[l][1].type){s="paragraph"===a.events[l][1].type;break}return!a.parser.lazy[a.now().line]&&(a.interrupt||s)?(e.enter("setextHeadingLine"),n=t,o=t,e.enter("setextHeadingLineSequence"),function t(r){return r===n?(e.consume(r),t):(e.exit("setextHeadingLineSequence"),wN(r)?wO(e,i,"lineSuffix")(r):i(r))}(o)):r(t)};function i(n){return null===n||wT(n)?(e.exit("setextHeadingLine"),t(n)):r(n)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,r){let n,a=this;return function(t){var n;return e.enter("definition"),n=t,w7.call(a,e,i,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function i(t){return(n=Er(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):r(t)}function o(t){return wA(t)?Et(e,s)(t):s(t)}function s(t){return w8(e,l,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(En,u,u)(t)}function u(t){return wN(t)?wO(e,c,"whitespace")(t):c(t)}function c(i){return null===i||wT(i)?(e.exit("definition"),a.parser.defined.push(n),t(i)):r(i)}}}},"disable",0,{null:[]},"document",0,{42:Eg,43:Eg,45:Eg,48:Eg,49:Eg,50:Eg,51:Eg,52:Eg,53:Eg,54:Eg,55:Eg,56:Eg,57:Eg,62:wQ},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let r,n,a=e.length-2,i=3;return"whitespace"===e[3][1].type&&(i+=2),a-2>i&&"whitespace"===e[a][1].type&&(a-=2),"atxHeadingSequence"===e[a][1].type&&(i===a-1||a-4>i&&"whitespace"===e[a-2][1].type)&&(a-=i+1===a?2:4),a>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[a][1].end},n={type:"chunkText",start:e[i][1].start,end:e[a][1].end,contentType:"text"},wh(e,i,a-i+1,[["enter",r,t],["enter",n,t],["exit",n,t],["exit",r,t]])),e},tokenize:function(e,t,r){let n=0;return function(a){var i;return e.enter("atxHeading"),i=a,e.enter("atxHeadingSequence"),function a(i){return 35===i&&n++<6?(e.consume(i),a):null===i||wA(i)?(e.exit("atxHeadingSequence"),function r(n){return 35===n?(e.enter("atxHeadingSequence"),function t(n){return 35===n?(e.consume(n),t):(e.exit("atxHeadingSequence"),r(n))}(n)):null===n||wT(n)?(e.exit("atxHeading"),t(n)):wN(n)?wO(e,r,"whitespace")(n):(e.enter("atxHeadingText"),function t(n){return null===n||35===n||wA(n)?(e.exit("atxHeadingText"),r(n)):(e.consume(n),t)}(n))}(i)):r(i)}(i)}}},42:Eh,45:[Ev,Eh],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,r){let n,a,i,o,s,l=this;return function(t){var r;return r=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),u};function u(o){return 33===o?(e.consume(o),c):47===o?(e.consume(o),a=!0,f):63===o?(e.consume(o),n=3,l.interrupt?t:O):wv(o)?(e.consume(o),i=String.fromCharCode(o),m):r(o)}function c(a){return 45===a?(e.consume(a),n=2,d):91===a?(e.consume(a),n=5,o=0,p):wv(a)?(e.consume(a),n=4,l.interrupt?t:O):r(a)}function d(n){return 45===n?(e.consume(n),l.interrupt?t:O):r(n)}function p(n){let a="CDATA[";return n===a.charCodeAt(o++)?(e.consume(n),o===a.length)?l.interrupt?t:S:p:r(n)}function f(t){return wv(t)?(e.consume(t),i=String.fromCharCode(t),m):r(t)}function m(o){if(null===o||47===o||62===o||wA(o)){let s=47===o,u=i.toLowerCase();return!s&&!a&&Ei.includes(u)?(n=1,l.interrupt?t(o):S(o)):Ea.includes(i.toLowerCase())?(n=6,s)?(e.consume(o),h):l.interrupt?t(o):S(o):(n=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(o):a?function t(r){return wN(r)?(e.consume(r),t):E(r)}(o):g(o))}return 45===o||w_(o)?(e.consume(o),i+=String.fromCharCode(o),m):r(o)}function h(n){return 62===n?(e.consume(n),l.interrupt?t:S):r(n)}function g(t){return 47===t?(e.consume(t),E):58===t||95===t||wv(t)?(e.consume(t),b):wN(t)?(e.consume(t),g):E(t)}function b(t){return 45===t||46===t||58===t||95===t||w_(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),v):wN(t)?(e.consume(t),y):g(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),s=t,_):wN(t)?(e.consume(t),v):function t(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||wA(r)?y(r):(e.consume(r),t)}(t)}function _(t){return t===s?(e.consume(t),s=null,w):null===t||wT(t)?r(t):(e.consume(t),_)}function w(e){return 47===e||62===e||wN(e)?g(e):r(e)}function E(t){return 62===t?(e.consume(t),x):r(t)}function x(t){return null===t||wT(t)?S(t):wN(t)?(e.consume(t),x):r(t)}function S(t){return 45===t&&2===n?(e.consume(t),N):60===t&&1===n?(e.consume(t),I):62===t&&4===n?(e.consume(t),L):63===t&&3===n?(e.consume(t),O):93===t&&5===n?(e.consume(t),R):wT(t)&&(6===n||7===n)?(e.exit("htmlFlowData"),e.check(Eo,P,k)(t)):null===t||wT(t)?(e.exit("htmlFlowData"),k(t)):(e.consume(t),S)}function k(t){return e.check(Es,T,P)(t)}function T(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return null===t||wT(t)?k(t):(e.enter("htmlFlowData"),S(t))}function N(t){return 45===t?(e.consume(t),O):S(t)}function I(t){return 47===t?(e.consume(t),i="",C):S(t)}function C(t){if(62===t){let r=i.toLowerCase();return Ei.includes(r)?(e.consume(t),L):S(t)}return wv(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),C):S(t)}function R(t){return 93===t?(e.consume(t),O):S(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===n?(e.consume(t),O):S(t)}function L(t){return null===t||wT(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),L)}function P(r){return e.exit("htmlFlow"),t(r)}}},61:Ev,95:Eh,96:w5,126:w5},"flowInitial",0,{[-2]:w6,[-1]:w6,32:w6},"insideSpan",0,{null:[wX,wH]},"string",0,{38:w4,92:w0},"text",0,{[-5]:Em,[-4]:Em,[-3]:Em,33:Ep,38:w4,42:wX,60:[{name:"autolink",tokenize:function(e,t,r){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a};function a(t){return wv(t)?(e.consume(t),i):64===t?r(t):s(t)}function i(t){return 43===t||45===t||46===t||w_(t)?(n=1,function t(r){return 58===r?(e.consume(r),n=0,o):(43===r||45===r||46===r||w_(r))&&n++<32?(e.consume(r),t):(n=0,s(r))}(t)):s(t)}function o(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||wE(n)?r(n):(e.consume(n),o)}function s(t){return 64===t?(e.consume(t),l):ww(t)?(e.consume(t),s):r(t)}function l(a){return w_(a)?function a(i){return 46===i?(e.consume(i),n=0,l):62===i?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(i),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(i){if((45===i||w_(i))&&n++<63){let r=45===i?t:a;return e.consume(i),r}return r(i)}(i)}(a):r(a)}}},{name:"htmlText",tokenize:function(e,t,r){let n,a,i,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),_):63===t?(e.consume(t),y):wv(t)?(e.consume(t),E):r(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),a=0,f):wv(t)?(e.consume(t),b):r(t)}function u(t){return 45===t?(e.consume(t),p):r(t)}function c(t){return null===t?r(t):45===t?(e.consume(t),d):wT(t)?(i=c,C(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),p):c(t)}function p(e){return 62===e?I(e):45===e?d(e):c(e)}function f(t){let n="CDATA[";return t===n.charCodeAt(a++)?(e.consume(t),a===n.length?m:f):r(t)}function m(t){return null===t?r(t):93===t?(e.consume(t),h):wT(t)?(i=m,C(t)):(e.consume(t),m)}function h(t){return 93===t?(e.consume(t),g):m(t)}function g(t){return 62===t?I(t):93===t?(e.consume(t),g):m(t)}function b(t){return null===t||62===t?I(t):wT(t)?(i=b,C(t)):(e.consume(t),b)}function y(t){return null===t?r(t):63===t?(e.consume(t),v):wT(t)?(i=y,C(t)):(e.consume(t),y)}function v(e){return 62===e?I(e):y(e)}function _(t){return wv(t)?(e.consume(t),w):r(t)}function w(t){return 45===t||w_(t)?(e.consume(t),w):function t(r){return wT(r)?(i=t,C(r)):wN(r)?(e.consume(r),t):I(r)}(t)}function E(t){return 45===t||w_(t)?(e.consume(t),E):47===t||62===t||wA(t)?x(t):r(t)}function x(t){return 47===t?(e.consume(t),I):58===t||95===t||wv(t)?(e.consume(t),S):wT(t)?(i=x,C(t)):wN(t)?(e.consume(t),x):I(t)}function S(t){return 45===t||46===t||58===t||95===t||w_(t)?(e.consume(t),S):function t(r){return 61===r?(e.consume(r),k):wT(r)?(i=t,C(r)):wN(r)?(e.consume(r),t):x(r)}(t)}function k(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),n=t,T):wT(t)?(i=k,C(t)):wN(t)?(e.consume(t),k):(e.consume(t),A)}function T(t){return t===n?(e.consume(t),n=void 0,N):null===t?r(t):wT(t)?(i=T,C(t)):(e.consume(t),T)}function A(t){return null===t||34===t||39===t||60===t||61===t||96===t?r(t):47===t||62===t||wA(t)?x(t):(e.consume(t),A)}function N(e){return 47===e||62===e||wA(e)?x(e):r(e)}function I(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):r(n)}function C(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return wN(t)?wO(e,O,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),i(t)}}}],91:Ef,92:[{name:"hardBreakEscape",tokenize:function(e,t,r){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return wT(n)?(e.exit("hardBreakEscape"),t(n)):r(n)}}},w0],93:El,95:wX,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,r,n=e.length-4,a=3;if(("lineEnding"===e[3][1].type||"space"===e[a][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=a;++t<n;)if("codeTextData"===e[t][1].type){e[a][1].type="codeTextPadding",e[n][1].type="codeTextPadding",a+=2,n-=2;break}}for(t=a-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="codeTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e},tokenize:function(e,t,r){let n,a,i=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(r){return 96===r?(e.consume(r),i++,t):(e.exit("codeTextSequence"),o(r))}(t)};function o(l){return null===l?r(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(a=e.enter("codeTextSequence"),n=0,function r(o){return 96===o?(e.consume(o),n++,r):n===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(a.type="codeTextData",s(o))}(l)):wT(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||wT(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var E_=e.i(4127);let Ew=/[\0\t\n\r]/g;function EE(e,t){let r=Number.parseInt(e,t);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let Ex=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ES(e,t,r){if(t)return t;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),t=120===e||88===e;return EE(r.slice(t?2:1),t?16:10)}return w2(r)||e}let Ek={}.hasOwnProperty;function ET(e){return{line:e.line,column:e.column,offset:e.offset}}function EA(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+_2({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_2({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+_2({start:t.start,end:t.end})+") is still open")}function EN(e){let t=this;t.parser=function(r){var n,a;let i,o,s,l;return"object"==typeof(n={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(a=n,n=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(b),autolinkProtocol:u,autolinkEmail:u,atxHeading:n(m),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:n(f),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:n(f,a),codeText:n(function(){return{type:"inlineCode",value:""}},a),codeTextData:u,data:u,codeFlowValue:u,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(h),hardBreakTrailing:n(h),htmlFlow:n(g,a),htmlFlowData:u,htmlText:n(g,a),htmlTextData:u,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:a,link:n(b),listItem:n(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(y),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:n(m),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,r=this.sliceSerialize(e),n=this.data.characterReferenceType;n?(t=EE(r,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):t=w2(r);let a=this.stack[this.stack.length-1];a.value+=t},characterReference:function(e){this.stack.pop().position.end=ET(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Er(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=t},labelText:function(e){let t=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=t.replace(Ex,ES),r.identifier=Er(t).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=ET(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(r.type)&&(u.call(this,e),c.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,r){let n=-1;for(;++n<r.length;){let a=r[n];Array.isArray(a)?e(t,a):function(e,t){let r;for(r in t)if(Ek.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n)}}}(t,a)}}(t,(e||{}).mdastExtensions||[]);let r={};return function(e){let n={type:"root",children:[]},o={stack:[n],tokenStack:[],config:t,enter:i,exit:s,buffer:a,resume:l,data:r},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,r){let n,a,i,o,s=t-1,l=-1,u=!1;for(;++s<=r;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!n||o||l||i||(i=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let o=s;for(a=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;a&&(e[a][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",a=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}i&&(!a||i<a)&&(n._spread=!0),n.end=Object.assign({},a?e[a][1].start:t[1].end),e.splice(a||s,0,["exit",n,t[2]]),s++,r++}if("listItemPrefix"===t[1].type){let a={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};n=a,e.splice(s,0,["enter",a,t[2]]),s++,r++,i=void 0,o=!0}}}return e[t][1]._spread=u,r}(e,u.pop(),c));for(c=-1;++c<e.length;){let r=t[e[c][0]];Ek.call(r,e[c][1].type)&&r[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},o),e[c][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||EA).call(o,void 0,e[0])}for(n.position={start:ET(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ET(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)n=t.transforms[c](n)||n;return n};function n(e,t){return function(r){i.call(this,e(r),r),t&&t.call(this,r)}}function a(){this.stack.push({type:"fragment",children:[]})}function i(e,t,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,r||void 0]),e.position={start:ET(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let r=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==e.type&&(t?t.call(this,e,n[0]):(n[1]||EA).call(this,e,n[0]));else throw Error("Cannot close `"+e.type+"` ("+_2({start:e.start,end:e.end})+"): it’s not open");r.position.end=ET(e.end)}function l(){return wp(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,r=t[t.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:ET(e.start),end:void 0},t.push(r)),this.stack.push(r)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ET(e.end)}function d(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function m(){return{type:"heading",depth:0,children:[]}}function h(){return{type:"break"}}function g(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(a)(function(e){for(;!w$(e););return e}((function(e){let t={constructs:wy([E_,...(e||{}).extensions||[]]),content:r(wL),defined:[],document:r(wP),flow:r(wB),lazy:{},string:r(wG),text:r(wV)};return t;function r(e){return function(r){return function(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},a={},i=[],o=[],s=[],l={attempt:m(function(e,t){h(e,t.from)}),check:m(f),consume:function(e){wT(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,g()):-1!==e&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=e},enter:function(e,t){let r=t||{};return r.type=e,r.start=p(),u.events.push(["enter",r,u]),s.push(r),r},exit:function(e){let t=s.pop();return t.end=p(),u.events.push(["exit",t,u]),t},interrupt:m(f,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){a[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let r,n=-1,a=[];for(;++n<e.length;){let i,o=e[n];if("string"==typeof o)i=o;else switch(o){case -5:i="\r";break;case -4:i="\n";break;case -3:i="\r\n";break;case -2:i=t?" ":" ";break;case -1:if(!t&&r)continue;i=" ";break;default:i=String.fromCharCode(o)}r=-2===o,a.push(i)}return a.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=wg(o,e),function(){let e;for(;n._index<o.length;){let r=o[n._index];if("string"==typeof r)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;){var t;t=r.charCodeAt(n._bufferIndex),c=c(t)}else c=c(r)}}(),null!==o[o.length-1])?[]:(h(t,0),u.events=wY(i,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function d(e){return function(e,t){let r,n=t.start._index,a=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;if(n===i)r=[e[n].slice(a,o)];else{if(r=e.slice(n,i),a>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(a):r.shift()}o>0&&r.push(e[i].slice(0,o))}return r}(o,e)}function p(){let{_bufferIndex:e,_index:t,line:r,column:a,offset:i}=n;return{_bufferIndex:e,_index:t,line:r,column:a,offset:i}}function f(e,t){t.restore()}function m(e,t){return function(r,a,i){var o;let c,d,f,m;return Array.isArray(r)?h(r):"tokenize"in r?h([r]):(o=r,function(e){let t=null!==e&&o[e],r=null!==e&&o.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function h(e){return(c=e,d=0,0===e.length)?i:b(e[d])}function b(e){return function(r){let a,i,o,c,d;return(a=p(),i=u.previous,o=u.currentConstruct,c=u.events.length,d=Array.from(s),m={from:c,restore:function(){n=a,u.previous=i,u.currentConstruct=o,u.events.length=c,s=d,g()}},f=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?v(r):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,y,v)(r)}}function y(t){return e(f,m),a}function v(e){return(m.restore(),++d<c.length)?b(c[d]):i}}}function h(e,t){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&wh(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){n.line in a&&n.column<2&&(n.column=a[n.line],n.offset+=a[n.line]-1)}}(t,e,r)}}})(a).document().write((o=1,s="",l=!0,function(e,t,r){let n,a,u,c,d,p=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,s="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(Ew.lastIndex=u,c=(n=Ew.exec(e))&&void 0!==n.index?n.index:e.length,d=e.charCodeAt(c),!n){s=e.slice(u);break}if(10===d&&u===c&&i)p.push(-3),i=void 0;else switch(i&&(p.push(-5),i=void 0),u<c&&(p.push(e.slice(u,c)),o+=c-u),d){case 0:p.push(65533),o++;break;case 9:for(a=4*Math.ceil(o/4),p.push(-2);o++<a;)p.push(-1);break;case 10:p.push(-4),o=1;break;default:i=!0,o=1}u=c+1}return r&&(i&&p.push(-5),s&&p.push(s),p.push(null)),p})(r,n,!0))))}}let EI="object"==typeof self?self:globalThis,EC=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new EI[e](t)},ER=e=>{var t;let r,n;return(t=new Map,r=(e,r)=>(t.set(r,e),e),n=a=>{if(t.has(a))return t.get(a);let[i,o]=e[a];switch(i){case 0:case -1:return r(o,a);case 1:{let e=r([],a);for(let t of o)e.push(n(t));return e}case 2:{let e=r({},a);for(let[t,r]of o)e[n(t)]=n(r);return e}case 3:return r(new Date(o),a);case 4:{let{source:e,flags:t}=o;return r(new RegExp(e,t),a)}case 5:{let e=r(new Map,a);for(let[t,r]of o)e.set(n(t),n(r));return e}case 6:{let e=r(new Set,a);for(let t of o)e.add(n(t));return e}case 7:{let{name:e,message:t}=o;return r(EC(e,t),a)}case 8:return r(BigInt(o),a);case"BigInt":return r(Object(BigInt(o)),a);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return r(new DataView(e),o)}}return r(EC(i,o),a)})(0)},{toString:EO}={},{keys:EL}=Object,EP=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let r=EO.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,r]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},ED=([e,t])=>0===e&&("function"===t||"symbol"===t),EM=(e,{json:t,lossy:r}={})=>{var n,a,i;let o,s,l=[];return(n=!(t||r),a=!!t,i=new Map,o=(e,t)=>{let r=l.push(e)-1;return i.set(t,r),r},s=e=>{if(i.has(e))return i.get(e);let[t,r]=EP(e);switch(t){case 0:{let a=e;switch(r){case"bigint":t=8,a=e.toString();break;case"function":case"symbol":if(n)throw TypeError("unable to serialize "+r);a=null;break;case"undefined":return o([-1],e)}return o([t,a],e)}case 1:{if(r){let t=e;return"DataView"===r?t=new Uint8Array(e.buffer):"ArrayBuffer"===r&&(t=new Uint8Array(e)),o([r,[...t]],e)}let n=[],a=o([t,n],e);for(let t of e)n.push(s(t));return a}case 2:{if(r)switch(r){case"BigInt":return o([r,e.toString()],e);case"Boolean":case"Number":case"String":return o([r,e.valueOf()],e)}if(a&&"toJSON"in e)return s(e.toJSON());let i=[],l=o([t,i],e);for(let t of EL(e))(n||!ED(EP(e[t])))&&i.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:r,flags:n}=e;return o([t,{source:r,flags:n}],e)}case 5:{let r=[],a=o([t,r],e);for(let[t,a]of e)(n||!(ED(EP(t))||ED(EP(a))))&&r.push([s(t),s(a)]);return a}case 6:{let r=[],a=o([t,r],e);for(let t of e)(n||!ED(EP(t)))&&r.push(s(t));return a}}let{message:l}=e;return o([t,{name:r,message:l}],e)})(e),l},Ej="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?ER(EM(e,t)):structuredClone(e):(e,t)=>ER(EM(e,t));function EF(e){let t=[],r=-1,n=0,a=0;for(;++r<e.length;){let i=e.charCodeAt(r),o="";if(37===i&&w_(e.charCodeAt(r+1))&&w_(e.charCodeAt(r+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){let t=e.charCodeAt(r+1);i<56320&&t>56319&&t<57344?(o=String.fromCharCode(i,t),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+a+1,o=""),a&&(r+=a,a=0)}return t.join("")+e.slice(n)}function E$(e,t){let r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function EU(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let Ez=function(e){var t,r;if(null==e)return EH;if("function"==typeof e)return EB(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],r=-1;for(;++r<e.length;)t[r]=Ez(e[r]);return EB(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}(e):(t=e,EB(function(e){let r;for(r in t)if(e[r]!==t[r])return!1;return!0}))}if("string"==typeof e){return r=e,EB(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function EB(e){return function(t,r,n){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function EH(){return!0}let EG=[];function EV(e,t,r,n){let a;"function"==typeof t&&"function"!=typeof r?(n=r,r=t):a=t;let i=Ez(a),o=n?-1:1;(function e(a,s,l){let u=a&&"object"==typeof a?a:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return c;function c(){var u;let c,d,p,f=EG;if((!t||i(a,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(u=r(a,l))?u:"number"==typeof u?[!0,u]:null==u?EG:[u])[0])return f;if("children"in a&&a.children&&a.children&&"skip"!==f[0])for(d=(n?a.children.length:-1)+o,p=l.concat(a);d>-1&&d<a.children.length;){if(!1===(c=e(a.children[d],d,p)())[0])return c;d="number"==typeof c[1]?c[1]:d+o}return f}})(e,void 0,[])()}function Eq(e,t,r,n){let a,i,o;"function"==typeof t&&"function"!=typeof r?(i=void 0,o=t,a=r):(i=t,o=r,a=n),EV(e,i,function(e,t){let r=t[t.length-1],n=r?r.children.indexOf(e):void 0;return o(e,n,r)},a)}function EW(e,t){let r=t.referenceType,n="]";if("collapsed"===r?n+="[]":"full"===r&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];let a=e.all(t),i=a[0];i&&"text"===i.type?i.value="["+i.value:a.unshift({type:"text",value:"["});let o=a[a.length-1];return o&&"text"===o.type?o.value+=n:a.push({type:"text",value:n}),a}function EZ(e){let t=e.spread;return null==t?e.children.length>1:t}function EK(e,t,r){let n=0,a=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(r){let t=e.codePointAt(a-1);for(;9===t||32===t;)a--,t=e.codePointAt(a-1)}return a>n?e.slice(n,a):""}let EY={blockquote:function(e,t){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)},break:function(e,t){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:"\n"}]},code:function(e,t){let r=t.value?t.value+"\n":"",n={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(n.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i={type:"element",tagName:"pre",properties:{},children:[i=e.applyData(t,i)]},e.patch(t,i),i},delete:function(e,t){let r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},emphasis:function(e,t){let r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},footnoteReference:function(e,t){let r,n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),i=EF(a.toLowerCase()),o=e.footnoteOrder.indexOf(a),s=e.footnoteCounts.get(a);void 0===s?(s=0,e.footnoteOrder.push(a),r=e.footnoteOrder.length):r=o+1,s+=1,e.footnoteCounts.set(a,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},html:function(e,t){if(e.options.allowDangerousHtml){let r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}},imageReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EW(e,t);let a={src:EF(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)},image:function(e,t){let r={src:EF(t.url)};null!==t.alt&&void 0!==t.alt&&(r.alt=t.alt),null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){let r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EW(e,t);let a={href:EF(n.url||"")};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},link:function(e,t){let r={href:EF(t.url)};null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,r){let n=e.all(t),a=r?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let r=e.children,n=-1;for(;!t&&++n<r.length;)t=EZ(r[n])}return t}(r):EZ(t),i={},o=[];if("boolean"==typeof t.checked){let e,r=n[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},n.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let e=n[s];(a||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||a?o.push(e):o.push(...e.children)}let l=n[n.length-1];l&&(a||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let r={},n=e.all(t),a=-1;for("number"==typeof t.start&&1!==t.start&&(r.start=t.start);++a<n.length;){let e=n[a];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,i),e.applyData(t,i)},paragraph:function(e,t){let r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},root:function(e,t){let r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)},strong:function(e,t){let r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},table:function(e,t){let r=e.all(t),n=r.shift(),a=[];if(n){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],r),a.push(r)}if(r.length>0){let n={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},i=_0(t.children[1]),o=_Q(t.children[t.children.length-1]);i&&o&&(n.position={start:i,end:o}),a.push(n)}let i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)},tableCell:function(e,t){let r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},tableRow:function(e,t,r){let n=r?r.children:void 0,a=0===(n?n.indexOf(t):1)?"th":"td",i=r&&"table"===r.type?r.align:void 0,o=i?i.length:t.children.length,s=-1,l=[];for(;++s<o;){let r=t.children[s],n={},o=i?i[s]:void 0;o&&(n.align=o);let u={type:"element",tagName:a,properties:n,children:[]};r&&(u.children=e.all(r),e.patch(r,u),u=e.applyData(r,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let r={type:"text",value:function(e){let t=String(e),r=/\r?\n|\r/g,n=r.exec(t),a=0,i=[];for(;n;)i.push(EK(t.slice(a,n.index),a>0,!0),n[0]),a=n.index+n[0].length,n=r.exec(t);return i.push(EK(t.slice(a),a>0,!1)),i.join("")}(String(t.value))};return e.patch(t,r),e.applyData(t,r)},thematicBreak:function(e,t){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)},toml:EX,yaml:EX,definition:EX,footnoteDefinition:EX};function EX(){}let EJ={}.hasOwnProperty,EQ={};function E0(e,t){e.position&&(t.position=function(e){let t=_0(e),r=_Q(e);if(t&&r)return{start:t,end:r}}(e))}function E1(e,t){let r=t;if(e&&e.data){let t=e.data.hName,n=e.data.hChildren,a=e.data.hProperties;"string"==typeof t&&("element"===r.type?r.tagName=t:r={type:"element",tagName:t,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&a&&Object.assign(r.properties,Ej(a)),"children"in r&&r.children&&null!=n&&(r.children=n)}return r}function E2(e,t){let r=[],n=-1;for(t&&r.push({type:"text",value:"\n"});++n<e.length;)n&&r.push({type:"text",value:"\n"}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:"\n"}),r}function E4(e){let t=0,r=e.charCodeAt(t);for(;9===r||32===r;)t++,r=e.charCodeAt(t);return e.slice(t)}function E3(e,t){let r,n,a,i,o=(r=t||EQ,n=new Map,a=new Map,i={all:function(e){let t=[];if("children"in e){let r=e.children,n=-1;for(;++n<r.length;){let a=i.one(r[n],e);if(a){if(n&&"break"===r[n-1].type&&(Array.isArray(a)||"text"!==a.type||(a.value=E4(a.value)),!Array.isArray(a)&&"element"===a.type)){let e=a.children[0];e&&"text"===e.type&&(e.value=E4(e.value))}Array.isArray(a)?t.push(...a):t.push(a)}}}return t},applyData:E1,definitionById:n,footnoteById:a,footnoteCounts:new Map,footnoteOrder:[],handlers:{...EY,...r.handlers},one:function(e,t){let r=e.type,n=i.handlers[r];if(EJ.call(i.handlers,r)&&n)return n(i,e,t);if(i.options.passThrough&&i.options.passThrough.includes(r)){if("children"in e){let{children:t,...r}=e,n=Ej(r);return n.children=i.all(e),n}return Ej(e)}return(i.options.unknownHandler||function(e,t){let r=t.data||{},n="value"in t&&!(EJ.call(r,"hProperties")||EJ.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)})(i,e,t)},options:r,patch:E0,wrap:E2},Eq(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?n:a,r=String(e.identifier).toUpperCase();t.has(r)||t.set(r,e)}}),i),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||E$,n=e.options.footnoteBackLabel||EU,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let a=e.footnoteById.get(e.footnoteOrder[l]);if(!a)continue;let i=e.all(a),o=String(a.identifier).toUpperCase(),u=EF(o.toLowerCase()),c=0,d=[],p=e.footnoteCounts.get(o);for(;void 0!==p&&++c<=p;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof r?r:r(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=i[i.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else i.push(...d);let m={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(i,!0)};e.patch(a,m),s.push(m)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ej(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(_d("children"in u),u.children.push({type:"text",value:"\n"},l)),u}function E5(e,t){return e&&"run"in e?async function(r,n){let a=E3(r,{file:n,...t});await e.run(a,n)}:function(r,n){return E3(r,{file:n,...e||t})}}function E6(e){if(e)throw e}var E9=e.i(2073);function E8(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let E7=function(e,t){let r;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');xn(e);let n=0,a=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else o<0&&(r=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(a=i):(s=-1,a=o));return n===a?a=o:a<0&&(a=e.length),e.slice(n,a)},xe=function(e){let t;if(xn(e),0===e.length)return".";let r=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){r=n;break}}else t||(t=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},xt=function(e){let t;xn(e);let r=e.length,n=-1,a=0,i=-1,o=0;for(;r--;){let s=e.codePointAt(r);if(47===s){if(t){a=r+1;break}continue}n<0&&(t=!0,n=r+1),46===s?i<0?i=r:1!==o&&(o=1):i>-1&&(o=-1)}return i<0||n<0||0===o||1===o&&i===n-1&&i===a+1?"":e.slice(i,n)},xr=function(...e){var t;let r,n,a,i=-1;for(;++i<e.length;)xn(e[i]),e[i]&&(a=void 0===a?e[i]:a+"/"+e[i]);return void 0===a?".":(xn(t=a),r=47===t.codePointAt(0),0!==(n=function(e,t){let r,n,a="",i=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)r=e.codePointAt(l);else if(47===r)break;else r=47;if(47===r){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(a.length<2||2!==i||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2)){if(a.length>2){if((n=a.lastIndexOf("/"))!==a.length-1){n<0?(a="",i=0):i=(a=a.slice(0,n)).length-1-a.lastIndexOf("/"),o=l,s=0;continue}}else if(a.length>0){a="",i=0,o=l,s=0;continue}}t&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+e.slice(o+1,l):a=e.slice(o+1,l),i=l-o-1;o=l,s=0}else 46===r&&s>-1?s++:s=-1}return a}(t,!r)).length||r||(n="."),n.length>0&&47===t.codePointAt(t.length-1)&&(n+="/"),r?"/"+n:n)};function xn(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function xa(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let xi=["history","path","basename","stem","extname","dirname"];class xo{constructor(e){let t,r;t=e?xa(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xi.length;){const e=xi[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)xi.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?E7(this.path):void 0}set basename(e){xl(e,"basename"),xs(e,"basename"),this.path=xr(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?xe(this.path):void 0}set dirname(e){xu(this.basename,"dirname"),this.path=xr(e||"",this.basename)}get extname(){return"string"==typeof this.path?xt(this.path):void 0}set extname(e){if(xs(e,"extname"),xu(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=xr(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){xa(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!xa(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,r=-1;for(;++r<t.length;)if(37===t.codePointAt(r)&&50===t.codePointAt(r+1)){let e=t.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),xl(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?E7(this.path,this.extname):void 0}set stem(e){xl(e,"stem"),xs(e,"stem"),this.path=xr(this.dirname||"",e+(this.extname||""))}fail(e,t,r){let n=this.message(e,t,r);throw n.fatal=!0,n}info(e,t,r){let n=this.message(e,t,r);return n.fatal=void 0,n}message(e,t,r){let n=new _6(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function xs(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function xl(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xu(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let xc=function(e){let t=this.constructor.prototype,r=t[e],n=function(){return r.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},xd={}.hasOwnProperty;class xp extends xc{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let r=-1,n=t.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function a(i,...o){let s=e[++r],l=-1;if(i)return void n(i);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let r;return function(...t){let i,o=e.length>t.length;o&&t.push(n);try{i=e.apply(this,t)}catch(e){if(o&&r)throw e;return n(e)}o||(i&&i.then&&"function"==typeof i.then?i.then(a,n):i instanceof Error?n(i):a(i))};function n(e,...a){r||(r=!0,t(e,...a))}function a(e){n(null,e)}})(s,a)(...o):n(null,...o)}(null,...t)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}};return t}()}copy(){let e=new xp,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data((0,E9.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(xg("data",this.frozen),this.namespace[e]=t,this):xd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xg("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let r=e.call(this,...t);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=xv(e),r=this.parser||this.Parser;return xm("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),xm("process",this.parser||this.Parser),xh("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,a){let i=xv(e),o=r.parse(i);function s(e,r){e||!r?a(e):n?n(r):(_d(t,"`done` is defined if `resolve` is not"),t(void 0,r))}r.run(o,i,function(e,t,n){var a,i;if(e||!t||!n)return s(e);let o=r.stringify(t,n);"string"==typeof(a=o)||(i=a)&&"object"==typeof i&&"byteLength"in i&&"byteOffset"in i?n.value=o:n.result=o,s(e,n)})}}processSync(e){let t,r=!1;return this.freeze(),xm("processSync",this.parser||this.Parser),xh("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){r=!0,E6(e),t=n}),xy("processSync","process",r),_d(t,"we either bailed on an error or have a tree"),t}run(e,t,r){xb(e),this.freeze();let n=this.transformers;return r||"function"!=typeof t||(r=t,t=void 0),r?a(void 0,r):new Promise(a);function a(a,i){_d("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=xv(t);n.run(e,o,function(t,n,o){let s=n||e;t?i(t):a?a(s):(_d(r,"`done` is defined if `resolve` is not"),r(void 0,s,o))})}}runSync(e,t){let r,n=!1;return this.run(e,t,function(e,t){E6(e),r=t,n=!0}),xy("runSync","run",n),_d(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let r=xv(t),n=this.compiler||this.Compiler;return xh("stringify",n),xb(e),n(e,r)}use(e,...t){let r=this.attachers,n=this.namespace;if(xg("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?i(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");i(e.plugins),e.settings&&(n.settings=(0,E9.default)(!0,n.settings,e.settings))}function i(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...r]=e;o(t,r)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let n=-1,a=-1;for(;++n<r.length;)if(r[n][0]===e){a=n;break}if(-1===a)r.push([e,...t]);else if(t.length>0){let[n,...i]=t,o=r[a][1];E8(o)&&E8(n)&&(n=(0,E9.default)(!0,o,n)),r[a]=[e,n,...i]}}}}let xf=new xp().freeze();function xm(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function xh(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function xg(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xb(e){if(!E8(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function xy(e,t,r){if(!r)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xv(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new xo(e)}let x_=[],xw={allowDangerousHtml:!0},xE=/^(https?|ircs?|mailto|xmpp)$/i,xx=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function xS(e){var t;let r,n,a,i,o,s=(r=(t=e).rehypePlugins||x_,n=t.remarkPlugins||x_,a=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xw}:xw,xf().use(EN).use(n).use(E5,a).use(r)),l=(i=e.children||"",o=new xo,"string"==typeof i?o.value=i:_p("Unexpected value `"+i+"` for `children` prop, expected `string`"),o);return function(e,t){let r=t.allowedElements,n=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||xk;for(let e of xx)Object.hasOwn(t,e.from)&&_p("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&i&&_p("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:"root"===e.type?e.children:[e]}),Eq(e,function(e,t,a){if("raw"===e.type&&a&&"number"==typeof t)return o?a.children.splice(t,1):a.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in wc)if(Object.hasOwn(wc,t)&&Object.hasOwn(e.properties,t)){let r=e.properties[t],n=wc[t];(null===n||n.includes(e.tagName))&&(e.properties[t]=l(String(r||""),t,e))}}if("element"===e.type){let o=r?!r.includes(e.tagName):!!i&&i.includes(e.tagName);if(!o&&n&&"number"==typeof t&&(o=!n(e,t,a)),o&&a&&"number"==typeof t)return s&&e.children?a.children.splice(t,1,...e.children):a.children.splice(t,1),t}}),function(e,t){var r,n,a,i;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=s,n=t.jsxDEV,o=function(e,t,a,i){let o=Array.isArray(a.children),s=_0(e);return n(t,a,i,o,{columnNumber:s?s.column-1:void 0,fileName:r,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");a=t.jsx,i=t.jsxs,o=function(e,t,r,n){let o=Array.isArray(r.children)?i:a;return n?o(t,r,n):o(t,r)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?_X:_Y,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=wn(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:J.Fragment,components:a,ignoreInvalidStyle:!0,jsx:J.jsx,jsxs:J.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function xk(e){let t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),a=e.indexOf("/");return -1===t||-1!==a&&t>a||-1!==r&&t>r||-1!==n&&t>n||xE.test(e.slice(0,t))?e:""}function xT(e,t){let r=String(e);if("string"!=typeof t)throw TypeError("Expected character");let n=0,a=r.indexOf(t);for(;-1!==a;)n++,a=r.indexOf(t,a+t.length);return n}let xA="phrasing",xN=["autolink","link","image","label"];function xI(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xC(e){this.config.enter.autolinkProtocol.call(this,e)}function xR(e){this.config.exit.autolinkProtocol.call(this,e)}function xO(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];_d("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function xL(e){this.config.exit.autolinkEmail.call(this,e)}function xP(e){this.exit(e)}function xD(e){!function(e,t,r){let n=Ez((r||{}).ignore||[]),a=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){var a;let e=r[n];t.push(["string"==typeof(a=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(a),"g"):a,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),i=-1;for(;++i<a.length;)EV(e,"text",o);function o(e,t){let r,o=-1;for(;++o<t.length;){let e=t[o],a=r?r.children:void 0;if(n(e,a?a.indexOf(e):void 0,r))return;r=e}if(r)return function(e,t){let r=t[t.length-1],n=a[i][0],o=a[i][1],s=0,l=r.children.indexOf(e),u=!1,c=[];n.lastIndex=0;let d=n.exec(e.value);for(;d;){let r=d.index,a={index:d.index,input:d.input,stack:[...t,e]},i=o(...d,a);if("string"==typeof i&&(i=i.length>0?{type:"text",value:i}:void 0),!1===i?n.lastIndex=r+1:(s!==r&&c.push({type:"text",value:e.value.slice(s,r)}),Array.isArray(i)?c.push(...i):i&&c.push(i),s=r+d[0].length,u=!0),!n.global)break;d=n.exec(e.value)}return u?(s<e.value.length&&c.push({type:"text",value:e.value.slice(s)}),r.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xM],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,xj]],{ignore:["link","linkReference"]})}function xM(e,t,r,n,a){let i,o="";if(!xF(a))return!1;if(/^w/i.test(t)&&(r=t+r,t="",o="http://"),(i=r.split(".")).length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),a=xT(e,"("),i=xT(e,")");for(;-1!==n&&a>i;)e+=r.slice(0,n+1),n=(r=r.slice(n+1)).indexOf(")"),i++;return[e,r]}(r+n);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function xj(e,t,r,n){return!(!xF(n,!0)||/[-\d_]$/.test(r))&&{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function xF(e,t){let r=e.input.charCodeAt(e.index-1);return(0===e.index||wC(r)||wI(r))&&(!t||47!==r)}function x$(){this.buffer()}function xU(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xz(){this.buffer()}function xB(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xH(e){let t=this.resume(),r=this.stack[this.stack.length-1];_d("footnoteReference"===r.type),r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xG(e){this.exit(e)}function xV(e){let t=this.resume(),r=this.stack[this.stack.length-1];_d("footnoteDefinition"===r.type),r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xq(e){this.exit(e)}function xW(e,t,r,n){let a=r.createTracker(n),i=a.move("[^"),o=r.enter("footnoteReference"),s=r.enter("reference");return i+=a.move(r.safe(r.associationId(e),{after:"]",before:i})),s(),o(),i+=a.move("]")}function xZ(e,t,r){return 0===t?e:xK(e,t,r)}function xK(e,t,r){return(r?"":" ")+e}xW.peek=function(){return"["};let xY=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function xX(e){this.enter({type:"delete",children:[]},e)}function xJ(e){this.exit(e)}function xQ(e,t,r,n){let a=r.createTracker(n),i=r.enter("strikethrough"),o=a.move("~~");return o+=r.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function x0(e){return e.length}function x1(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}xQ.peek=function(){return"~"};function x2(e,t,r){let n=e.value||"",a="`",i=-1;for(;RegExp("(^|[^`])"+a+"([^`]|$)").test(n);)a+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++i<r.unsafe.length;){let e,t=r.unsafe[i],a=r.compilePattern(t);if(t.atBreak)for(;e=a.exec(n);){let t=e.index;10===n.charCodeAt(t)&&13===n.charCodeAt(t-1)&&t--,n=n.slice(0,t)+" "+n.slice(e.index+1)}}return a+n+a}x2.peek=function(){return"`"};Ez(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let x4=function(e,t,r,n){let a=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(r),i=r.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(r);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===r.options.incrementListMarker?0:t.children.indexOf(e))+i);let o=i.length+1;("tab"===a||"mixed"===a&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=r.createTracker(n);s.move(i+" ".repeat(o-i.length)),s.shift(o);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,s.current()),function(e,t,r){return t?(r?"":" ".repeat(o))+e:(r?i:i+" ".repeat(o-i.length))+e});return l(),u};function x3(e){let t=e._align;_d(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function x5(e){this.exit(e),this.data.inTable=void 0}function x6(e){this.enter({type:"tableRow",children:[]},e)}function x9(e){this.exit(e)}function x8(e){this.enter({type:"tableCell",children:[]},e)}function x7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Se));let r=this.stack[this.stack.length-1];_d("inlineCode"===r.type),r.value=t,this.exit(e)}function Se(e,t){return"|"===t?t:e}function St(e){let t=this.stack[this.stack.length-2];_d("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function Sr(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];_d("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,a=t.children,i=-1;for(;++i<a.length;){let e=a[i];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Sn(e,t,r,n){let a=e.children[0],i="boolean"==typeof e.checked&&a&&"paragraph"===a.type,o="["+(e.checked?"x":" ")+"] ",s=r.createTracker(n);i&&s.move(o);let l=x4(e,t,r,{...n,...s.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let Sa={tokenize:function(e,t,r){let n=0;return function t(i){return(87===i||119===i)&&n<3?(n++,e.consume(i),t):46===i&&3===n?(e.consume(i),a):r(i)};function a(e){return null===e?r(e):t(e)}},partial:!0},Si={tokenize:function(e,t,r){let n,a,i;return o;function o(t){return 46===t||95===t?e.check(Ss,l,s)(t):null===t||wA(t)||wC(t)||45!==t&&wI(t)?l(t):(i=!0,e.consume(t),o)}function s(t){return 95===t?n=!0:(a=n,n=void 0),e.consume(t),o}function l(e){return a||n||!i?r(e):t(e)}},partial:!0},So={tokenize:function(e,t){let r=0,n=0;return a;function a(o){return 40===o?(r++,e.consume(o),a):41===o&&n<r?i(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(Ss,t,i)(o):null===o||wA(o)||wC(o)?t(o):(e.consume(o),a)}function i(t){return 41===t&&n++,e.consume(t),a}},partial:!0},Ss={tokenize:function(e,t,r){return n;function n(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),n):38===o?(e.consume(o),i):93===o?(e.consume(o),a):60===o||null===o||wA(o)||wC(o)?t(o):r(o)}function a(e){return null===e||40===e||91===e||wA(e)||wC(e)?t(e):n(e)}function i(t){return wv(t)?function t(a){return 59===a?(e.consume(a),n):wv(a)?(e.consume(a),t):r(a)}(t):r(t)}},partial:!0},Sl={tokenize:function(e,t,r){return function(t){return e.consume(t),n};function n(e){return w_(e)?r(e):t(e)}},partial:!0},Su={name:"wwwAutolink",tokenize:function(e,t,r){let n=this;return function(t){return 87!==t&&119!==t||!Sm.call(n,n.previous)||Sy(n.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Sa,e.attempt(Si,e.attempt(So,a),r),r)(t))};function a(r){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(r)}},previous:Sm},Sc={name:"protocolAutolink",tokenize:function(e,t,r){let n=this,a="",i=!1;return function(t){return(72===t||104===t)&&Sh.call(n,n.previous)&&!Sy(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(t),e.consume(t),o):r(t)};function o(t){if(wv(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let r=a.toLowerCase();if("http"===r||"https"===r)return e.consume(t),s}return r(t)}function s(t){return 47===t?(e.consume(t),i)?l:(i=!0,s):r(t)}function l(t){return null===t||wE(t)||wA(t)||wC(t)||wI(t)?r(t):e.attempt(Si,e.attempt(So,u),r)(t)}function u(r){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(r)}},previous:Sh},Sd={name:"emailAutolink",tokenize:function(e,t,r){let n,a,i=this;return function(t){return!Sb(t)||!Sg.call(i,i.previous)||Sy(i.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(n){return Sb(n)?(e.consume(n),t):64===n?(e.consume(n),o):r(n)}(t))};function o(t){return 46===t?e.check(Sl,l,s)(t):45===t||95===t||w_(t)?(a=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),n=!0,o}function l(o){return a&&n&&wv(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):r(o)}},previous:Sg},Sp={},Sf=48;for(;Sf<123;)Sp[Sf]=Sd,58==++Sf?Sf=65:91===Sf&&(Sf=97);function Sm(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||wA(e)}function Sh(e){return!wv(e)}function Sg(e){return!(47===e||Sb(e))}function Sb(e){return 43===e||45===e||46===e||95===e||w_(e)}function Sy(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if(("labelLink"===n.type||"labelImage"===n.type)&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}Sp[43]=Sd,Sp[45]=Sd,Sp[46]=Sd,Sp[95]=Sd,Sp[72]=[Sd,Sc],Sp[104]=[Sd,Sc],Sp[87]=[Sd,Su],Sp[119]=[Sd,Su];let Sv={tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return a&&"gfmFootnoteDefinitionIndent"===a[1].type&&4===a[2].sliceSerialize(a[1],!0).length?t(e):r(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function S_(e,t,r){let n,a=this,i=a.events.length,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);for(;i--;){let e=a.events[i][1];if("labelImage"===e.type){n=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!n||!n._balanced)return r(i);let s=Er(a.sliceSerialize({start:n.end,end:a.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)):r(i)}}function Sw(e,t){let r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},s=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...s),e}function SE(e,t,r){let n,a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?r(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!n||null===s||91===s||wA(s))return r(s);if(93===s){e.exit("chunkString");let n=e.exit("gfmFootnoteCallString");return i.includes(Er(a.sliceSerialize(n)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(s)}return wA(s)||(n=!0),o++,e.consume(s),92===s?u:l}function u(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function Sx(e,t,r){let n,a,i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(t)}function u(t){if(s>999||93===t&&!a||null===t||91===t||wA(t))return r(t);if(93===t){e.exit("chunkString");let r=e.exit("gfmFootnoteDefinitionLabelString");return n=Er(i.sliceSerialize(r)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return wA(t)||(a=!0),s++,e.consume(t),92===t?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(n)||o.push(n),wO(e,p,"gfmFootnoteDefinitionWhitespace")):r(t)}function p(e){return t(e)}}function SS(e,t,r){return e.check(wM,t,e.attempt(Sv,t,r))}function Sk(e){e.exit("gfmFootnoteDefinition")}class ST{constructor(){this.map=[]}add(e,t,r){!function(e,t,r,n){let a=0;if(0!==r||0!==n.length){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=r,e.map[a][2].push(...n);return}a+=1}e.map.push([t,r,n])}}(this,e,t,r)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,r=[];for(;t>0;)t-=1,r.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];r.push(e.slice()),e.length=0;let n=r.pop();for(;n;){for(let t of n)e.push(t);n=r.pop()}this.map.length=0}}function SA(e,t,r){let n,a=this,i=0,o=0;return function(e){let t=a.events.length-1;for(;t>-1;){let e=a.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let n=t>-1?a.events[t][1].type:null,i="tableHead"===n||"tableRow"===n?y:s;return i===y&&a.parser.lazy[a.now().line]?r(e):i(e)};function s(t){var r;return e.enter("tableHead"),e.enter("tableRow"),124===(r=t)||(n=!0,o+=1),l(r)}function l(t){return null===t?r(t):wT(t)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):r(t):wN(t)?wO(e,l,"whitespace")(t):(o+=1,n&&(n=!1,i+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),n=!0,l):(e.enter("data"),u(t))}function u(t){return null===t||124===t||wA(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return 92===t||124===t?(e.consume(t),u):u(t)}function d(t){return(a.interrupt=!1,a.parser.lazy[a.now().line])?r(t):(e.enter("tableDelimiterRow"),n=!1,wN(t))?wO(e,p,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?m(t):124===t?(n=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):r(t)}function f(t){return wN(t)?wO(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(o+=1,n=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||wT(t)?b(t):r(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(r){return 45===r?(e.consume(r),t):58===r?(n=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(r),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(r))}(t)):r(t)}function g(t){return wN(t)?wO(e,b,"whitespace")(t):b(t)}function b(a){if(124===a)return p(a);if(null===a||wT(a))return n&&i===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(a)):r(a);return r(a)}function y(t){return e.enter("tableRow"),v(t)}function v(r){return 124===r?(e.enter("tableCellDivider"),e.consume(r),e.exit("tableCellDivider"),v):null===r||wT(r)?(e.exit("tableRow"),t(r)):wN(r)?wO(e,v,"whitespace")(r):(e.enter("data"),_(r))}function _(t){return null===t||124===t||wA(t)?(e.exit("data"),v(t)):(e.consume(t),92===t?w:_)}function w(t){return 92===t||124===t?(e.consume(t),_):_(t)}}function SN(e,t){let r,n,a,i=-1,o=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,p=new ST;for(;++i<e.length;){let f=e[i],m=f[1];"enter"===f[0]?"tableHead"===m.type?(c=!1,0!==d&&(SC(p,t,d,r,n),n=void 0,d=0),r={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",r,t]])):"tableRow"===m.type||"tableDelimiterRow"===m.type?(o=!0,a=void 0,l=[0,0,0,0],u=[0,i+1,0,0],c&&(c=!1,n={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",n,t]])),s="tableDelimiterRow"===m.type?2:n?3:1):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],a=SI(p,t,l,s,void 0,a),l=[0,0,0,0]),u[2]=i)):"tableCellDivider"===m.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],a=SI(p,t,l,s,void 0,a)),u=[(l=u)[1],i,0,0])):"tableHead"===m.type?(c=!0,d=i):"tableRow"===m.type||"tableDelimiterRow"===m.type?(d=i,0!==l[1]?(u[0]=u[1],a=SI(p,t,l,s,i,a)):0!==u[1]&&(a=SI(p,t,u,s,i,a)),s=0):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)&&(u[3]=i)}for(0!==d&&SC(p,t,d,r,n),p.consume(t.events),i=-1;++i<t.events.length;){let e=t.events[i];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let r=!1,n=[];for(;t<e.length;){let a=e[t];if(r){if("enter"===a[0])"tableContent"===a[1].type&&n.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===a[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=n.length-1;n[e]="left"===n[e]?"center":"right"}}else if("tableDelimiterRow"===a[1].type)break}else"enter"===a[0]&&"tableDelimiterRow"===a[1].type&&(r=!0);t+=1}return n}(t.events,i))}return e}function SI(e,t,r,n,a,i){0!==r[0]&&(i.end=Object.assign({},SR(t.events,r[0])),e.add(r[0],0,[["exit",i,t]]));let o=SR(t.events,r[1]);if(i={type:1===n?"tableHeader":2===n?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(r[1],0,[["enter",i,t]]),0!==r[2]){let a=SR(t.events,r[2]),i=SR(t.events,r[3]),o={type:"tableContent",start:Object.assign({},a),end:Object.assign({},i)};if(e.add(r[2],0,[["enter",o,t]]),2!==n){let n=t.events[r[2]],a=t.events[r[3]];if(n[1].end=Object.assign({},a[1].end),n[1].type="chunkText",n[1].contentType="text",r[3]>r[2]+1){let t=r[2]+1,n=r[3]-r[2]-1;e.add(t,n,[])}}e.add(r[3]+1,0,[["exit",o,t]])}return void 0!==a&&(i.end=Object.assign({},SR(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function SC(e,t,r,n,a){let i=[],o=SR(t.events,r);a&&(a.end=Object.assign({},o),i.push(["exit",a,t])),n.end=Object.assign({},o),i.push(["exit",n,t]),e.add(r+1,0,i)}function SR(e,t){let r=e[t],n="enter"===r[0]?"start":"end";return r[1][n]}let SO={name:"tasklistCheck",tokenize:function(e,t,r){let n=this;return function(t){return null===n.previous&&n._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a):r(t)};function a(t){return wA(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):r(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(t)}function o(n){return wT(n)?t(n):wN(n)?e.check({tokenize:SL},t,r)(n):r(n)}}};function SL(e,t,r){return wO(e,function(e){return null===e?r(e):t(e)},"whitespace")}let SP={};function SD(e){let t,r,n,a=e||SP,i=this.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(wy([{text:Sp},{document:{91:{name:"gfmFootnoteDefinition",tokenize:Sx,continuation:{tokenize:SS},exit:Sk}},text:{91:{name:"gfmFootnoteCall",tokenize:SE},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:S_,resolveTo:Sw}}},(t=(a||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let a=this.previous,i=this.events,o=0;return function(s){return 126===a&&"characterEscape"!==i[i.length-1][1].type?n(s):(e.enter("strikethroughSequenceTemporary"),function i(s){let l=wK(a);if(126===s)return o>1?n(s):(e.consume(s),o++,i);if(o<2&&!t)return n(s);let u=e.exit("strikethroughSequenceTemporary"),c=wK(s);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,r(s)}(s))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let a={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},i={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},o=[["enter",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",i,t]],s=t.parser.constructs.insideSpan.null;s&&wh(o,o.length,0,wY(s,e.slice(n+1,r),t)),wh(o,o.length,0,[["exit",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",a,t]]),wh(e,n-1,r-n+3,o),r=n+o.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:SA,resolveAll:SN}}},{text:{91:SO}}])),s.push([{transforms:[xD],enter:{literalAutolink:xI,literalAutolinkEmail:xC,literalAutolinkHttp:xC,literalAutolinkWww:xC},exit:{literalAutolink:xP,literalAutolinkEmail:xL,literalAutolinkHttp:xR,literalAutolinkWww:xO}},{enter:{gfmFootnoteCallString:x$,gfmFootnoteCall:xU,gfmFootnoteDefinitionLabelString:xz,gfmFootnoteDefinition:xB},exit:{gfmFootnoteCallString:xH,gfmFootnoteCall:xG,gfmFootnoteDefinitionLabelString:xV,gfmFootnoteDefinition:xq}},{canContainEols:["delete"],enter:{strikethrough:xX},exit:{strikethrough:xJ}},{enter:{table:x3,tableData:x8,tableHeader:x8,tableRow:x6},exit:{codeText:x7,table:x5,tableData:x9,tableHeader:x9,tableRow:x9}},{exit:{taskListCheckValueChecked:St,taskListCheckValueUnchecked:St,paragraph:Sr}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xA,notInConstruct:xN},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xA,notInConstruct:xN},{character:":",before:"[ps]",after:"\\/",inConstruct:xA,notInConstruct:xN}]},(n=!1,a&&a.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:function(e,t,r,a){let i=r.createTracker(a),o=i.move("[^"),s=r.enter("footnoteDefinition"),l=r.enter("label");return o+=i.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=i.move("]:"),e.children&&e.children.length>0&&(i.shift(4),o+=i.move((n?"\n":" ")+r.indentLines(r.containerFlow(e,i.current()),n?xK:xZ))),s(),o},footnoteReference:xW},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xY}],handlers:{delete:xQ}},function(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,a=t.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,r){let n=x2(e,t,r);return r.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n},table:function(e,t,r,n){return s(function(e,t,r){let n=e.children,a=-1,i=[],o=t.enter("table");for(;++a<n.length;)i[a]=l(n[a],t,r);return o(),i}(e,r,n),e.align)},tableCell:o,tableRow:function(e,t,r,n){let a=s([l(e,r,n)]);return a.slice(0,a.indexOf("\n"))}}};function o(e,t,r,n){let a=r.enter("tableCell"),o=r.enter("phrasing"),s=r.containerPhrasing(e,{...n,before:i,after:i});return o(),a(),s}function s(e,t){return function(e,t){let r=t||{},n=(r.align||[]).concat(),a=r.stringLength||x0,i=[],o=[],s=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],n=[],i=-1;for(e[c].length>u&&(u=e[c].length);++i<e[c].length;){var d;let o=null==(d=e[c][i])?"":String(d);if(!1!==r.alignDelimiters){let e=a(o);n[i]=e,(void 0===l[i]||e>l[i])&&(l[i]=e)}t.push(o)}o[c]=t,s[c]=n}let p=-1;if("object"==typeof n&&"length"in n)for(;++p<u;)i[p]=x1(n[p]);else{let e=x1(n);for(;++p<u;)i[p]=e}p=-1;let f=[],m=[];for(;++p<u;){let e=i[p],t="",n="";99===e?(t=":",n=":"):108===e?t=":":114===e&&(n=":");let a=!1===r.alignDelimiters?1:Math.max(1,l[p]-t.length-n.length),o=t+"-".repeat(a)+n;!1!==r.alignDelimiters&&((a=t.length+a+n.length)>l[p]&&(l[p]=a),m[p]=a),f[p]=o}o.splice(1,0,f),s.splice(1,0,m),c=-1;let h=[];for(;++c<o.length;){let e=o[c],t=s[c];p=-1;let n=[];for(;++p<u;){let a=e[p]||"",o="",s="";if(!1!==r.alignDelimiters){let e=l[p]-(t[p]||0),r=i[p];114===r?o=" ".repeat(e):99===r?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===r.delimiterStart||p||n.push("|"),!1!==r.padding&&(!1!==r.alignDelimiters||""!==a)&&(!1!==r.delimiterStart||p)&&n.push(" "),!1!==r.alignDelimiters&&n.push(o),n.push(a),!1!==r.alignDelimiters&&n.push(s),!1!==r.padding&&n.push(" "),(!1!==r.delimiterEnd||p!==u-1)&&n.push("|")}h.push(!1===r.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:n,padding:r,stringLength:a})}function l(e,t,r){let n=e.children,a=-1,i=[],s=t.enter("tableRow");for(;++a<n.length;)i[a]=o(n[a],e,t,r);return s(),i}}(a),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Sn}}]})}function SM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Sj(e){return function(e){if(Array.isArray(e))return SM(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return SM(e,void 0);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?SM(e,void 0):void 0}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function SF(e){return(SF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S$(e,t,r){var n;return(n=function(e,t){if("object"!=SF(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=SF(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==SF(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SU(){return(SU=Object.assign.bind()).apply(null,arguments)}function Sz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function SB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sz(Object(r),!0).forEach(function(t){S$(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sz(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var SH={},SG=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function SV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Sq(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SV(Object(r),!0).forEach(function(t){S$(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SV(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var SW=/\n/g;function SZ(e){var t,r,n,a,i=e.codeString,o=e.codeStyle,s=e.containerStyle,l=e.numberStyle,u=e.startingLineNumber;return Q.default.createElement("code",{style:Object.assign({},o,void 0===s?{float:"left",paddingRight:"10px"}:s)},(r=(t={lines:i.replace(/\n$/,"").split("\n"),style:void 0===l?{}:l,startingLineNumber:u}).lines,n=t.startingLineNumber,a=t.style,r.map(function(e,t){var r=t+n;return Q.default.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof a?a(r):a},"".concat(r,"\n"))})))}function SK(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function SY(e,t,r){var n={display:"inline-block",minWidth:"".concat(r.toString().length,".25em"),paddingRight:"1em",textAlign:"right",userSelect:"none"},a="function"==typeof e?e(t):e;return Sq(Sq({},n),a)}function SX(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,a=e.largestLineNumber,i=e.showInlineLineNumbers,o=e.lineProps,s=void 0===o?{}:o,l=e.className,u=void 0===l?[]:l,c=e.showLineNumbers,d=e.wrapLongLines,p=e.wrapLines,f=void 0!==p&&p?Sq({},"function"==typeof s?s(r):s):{};if(f.className=f.className?[].concat(Sj(f.className.trim().split(/\s+/)),Sj(u)):u,r&&i){var m=SY(n,r,a);t.unshift(SK(r,m))}return d&c&&(f.style=Sq({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function SJ(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(e,t){return function e(t){var r=t.node,n=t.stylesheet,a=t.style,i=t.useInlineStyles,o=t.key,s=r.properties,l=r.type,u=r.tagName,c=r.value;if("text"===l)return c;if(u){var d,p,f=(d=0,function(t){return d+=1,t.map(function(t,r){return e({node:t,stylesheet:n,useInlineStyles:i,key:"code-segment-".concat(d,"-").concat(r)})})});if(i){var m=Object.keys(n).reduce(function(e,t){return t.split(".").forEach(function(t){e.includes(t)||e.push(t)}),e},[]),h=s.className&&s.className.includes("token")?["token"]:[],g=s.className&&h.concat(s.className.filter(function(e){return!m.includes(e)}));p=SB(SB({},s),{},{className:g.join(" ")||void 0,style:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,r=e.join(".");return SH[r]||(SH[r]=0===(t=e.length)||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0),SH[r]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return SB(SB({},e),r[t])},t)}(s.className,Object.assign({},s.style,void 0===a?{}:a),n)})}else p=SB(SB({},s),{},{className:s.className.join(" ")});var b=f(r.children);return Q.default.createElement(u,SU({key:o},p),b)}}({node:e,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(t)})})}function SQ(e){return e&&void 0!==e.highlightAuto}var S0=($=e.i(16907).default,U={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},function(e){var t,r,n=e.language,a=e.children,i=e.style,o=void 0===i?U:i,s=e.customStyle,l=void 0===s?{}:s,u=e.codeTagProps,c=void 0===u?{className:n?"language-".concat(n):void 0,style:Sq(Sq({},o['code[class*="language-"]']),o['code[class*="language-'.concat(n,'"]')])}:u,d=e.useInlineStyles,p=void 0===d||d,f=e.showLineNumbers,m=void 0!==f&&f,h=e.showInlineLineNumbers,g=void 0===h||h,b=e.startingLineNumber,y=void 0===b?1:b,v=e.lineNumberContainerStyle,_=e.lineNumberStyle,w=void 0===_?{}:_,E=e.wrapLines,x=e.wrapLongLines,S=void 0!==x&&x,k=e.lineProps,T=e.renderer,A=e.PreTag,N=void 0===A?"pre":A,I=e.CodeTag,C=void 0===I?"code":I,R=e.code,O=void 0===R?(Array.isArray(a)?a[0]:a)||"":R,L=e.astGenerator,P=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,SG);L=L||$;var D=m?Q.default.createElement(SZ,{containerStyle:v,codeStyle:c.style||{},numberStyle:w,startingLineNumber:y,codeString:O}):null,M=o.hljs||o['pre[class*="language-"]']||{backgroundColor:"#fff"},j=SQ(L)?"hljs":"prismjs",F=p?Object.assign({},P,{style:Object.assign({},M,l)}):Object.assign({},P,{className:P.className?"".concat(j," ").concat(P.className):j,style:Object.assign({},l)});if(S?c.style=Sq({whiteSpace:"pre-wrap"},c.style):c.style=Sq({whiteSpace:"pre"},c.style),!L)return Q.default.createElement(N,F,D,Q.default.createElement(C,c,O));(void 0===E&&T||S)&&(E=!0),T=T||SJ;var z=[{type:"text",value:O}],B=function(e){var t=e.astGenerator,r=e.language,n=e.code,a=e.defaultCodeValue;if(SQ(t)){var i=-1!==t.listLanguages().indexOf(r);return"text"===r?{value:a,language:"text"}:i?t.highlight(r,n):t.highlightAuto(n)}try{return r&&"text"!==r?{value:t.highlight(n,r)}:{value:a}}catch(e){return{value:a}}}({astGenerator:L,language:n,code:O,defaultCodeValue:z});null===B.language&&(B.value=z);var H=y+(null!=(t=null==(r=O.match(/\n/g))?void 0:r.length)?t:0),G=function(e,t,r,n,a,i,o,s,l){var u,c=function e(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<t.length;a++){var i=t[a];if("text"===i.type)n.push(SX({children:[i],className:Sj(new Set(r))}));else if(i.children){var o=r.concat(i.properties.className);e(i.children,o).forEach(function(e){return n.push(e)})}}return n}(e.value),d=[],p=-1,f=0;function m(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||u.length>0?function(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return SX({children:e,lineNumber:i,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:a,lineProps:r,className:u,showLineNumbers:n,wrapLongLines:l,wrapLines:t})}(e,i,u):function(e,t){if(n&&t&&a){var r=SY(s,t,o);e.unshift(SK(t,r))}return e}(e,i)}for(;f<c.length;)!function(){var e=c[f],t=e.children[0].value;if(t.match(SW)){var r=t.split("\n");r.forEach(function(t,a){var o=n&&d.length+i,s={type:"text",value:"".concat(t,"\n")};if(0===a){var l=m(c.slice(p+1,f).concat(SX({children:[s],className:e.properties.className})),o);d.push(l)}else if(a===r.length-1){var u=c[f+1]&&c[f+1].children&&c[f+1].children[0],h={type:"text",value:"".concat(t)};if(u){var g=SX({children:[h],className:e.properties.className});c.splice(f+1,0,g)}else{var b=m([h],o,e.properties.className);d.push(b)}}else{var y=m([s],o,e.properties.className);d.push(y)}}),p=f}f++}();if(p!==c.length-1){var h=c.slice(p+1,c.length);if(h&&h.length){var g=m(h,n&&d.length+i);d.push(g)}}return t?d:(u=[]).concat.apply(u,d)}(B,E,void 0===k?{}:k,m,g,y,H,w,S);return Q.default.createElement(N,F,Q.default.createElement(C,c,!g&&D,T({rows:G,stylesheet:o,useInlineStyles:p})))});S0.supportedLanguages=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];let S1={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}},S2=Q.default.memo(({content:e,className:t=""})=>(0,J.jsx)("div",{className:rZ("prose min-w-0 max-w-full overflow-hidden break-words text-sm leading-relaxed text-inherit [&_h1:first-child]:mt-0 [&_h1]:mb-4 [&_h1]:mt-6 [&_h1]:font-semibold [&_h2:first-child]:mt-0 [&_h2]:mb-4 [&_h2]:mt-6 [&_h2]:font-semibold [&_h3:first-child]:mt-0 [&_h3]:mb-4 [&_h3]:mt-6 [&_h3]:font-semibold [&_h4:first-child]:mt-0 [&_h4]:mb-4 [&_h4]:mt-6 [&_h4]:font-semibold [&_h5:first-child]:mt-0 [&_h5]:mb-4 [&_h5]:mt-6 [&_h5]:font-semibold [&_h6:first-child]:mt-0 [&_h6]:mb-4 [&_h6]:mt-6 [&_h6]:font-semibold [&_p:last-child]:mb-0 [&_p]:mb-4",t),children:(0,J.jsx)(xS,{remarkPlugins:[SD],components:{code({inline:e,className:t,children:r,...n}){let a=/language-(\w+)/.exec(t||"");return!e&&a?(0,J.jsx)(S0,{style:S1,language:a[1],PreTag:"div",className:"max-w-full rounded-md text-sm",wrapLines:!0,wrapLongLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},customStyle:{margin:0,maxWidth:"100%",overflowX:"auto",fontSize:"0.875rem"},children:String(r).replace(/\n$/,"")}):(0,J.jsx)("code",{className:"bg-surface rounded-sm px-1 py-0.5 font-mono text-[0.9em]",...n,children:r})},pre:({children:e})=>(0,J.jsx)("div",{className:"my-4 max-w-full overflow-hidden last:mb-0",children:e}),a:({href:e,children:t})=>(0,J.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary no-underline hover:underline",children:t}),blockquote:({children:e})=>(0,J.jsx)("blockquote",{className:"my-4 border-l-4 border-border pl-4 italic text-[var(--color-text-tertiary)]",children:e}),ul:({children:e})=>(0,J.jsx)("ul",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),ol:({children:e})=>(0,J.jsx)("ol",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),table:({children:e})=>(0,J.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,J.jsx)("table",{className:"[&_th]:bg-surface w-full border-collapse [&_td]:border [&_td]:border-border [&_td]:p-2 [&_th]:border [&_th]:border-border [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold",children:e})})},children:e})}));function S4({steps:e,hideFinalText:t,compact:r=!1}){let n=new Map;for(let t of e)"tool_result"===t.kind&&t.toolCallId&&n.set(t.toolCallId,t.text);let a=-1;if(t){for(let t=e.length-1;t>=0;t--)if("text"===e[t].kind){a=t;break}}return(0,J.jsx)("div",{className:rZ("flex flex-col gap-1",r&&"gap-0.5"),children:e.map((e,t)=>{if(t===a)return null;if("tool_call"===e.kind){let a={id:e.id,name:e.name,args:e.args,result:n.get(e.id),status:n.has(e.id)?"completed":"pending"};return(0,J.jsx)(_c,{toolCall:a,compact:r},e.id||`tc-${t}`)}return"text"===e.kind?(0,J.jsx)("div",{className:rZ("px-2 text-sm",r&&"px-1 text-xs"),children:(0,J.jsx)(S2,{content:e.text,className:r?"text-xs leading-5 [&_blockquote]:my-2 [&_blockquote]:pl-2 [&_h1]:mb-2 [&_h1]:mt-3 [&_h1]:text-base [&_h2]:mb-2 [&_h2]:mt-3 [&_h2]:text-base [&_h3]:mb-1.5 [&_h3]:mt-3 [&_h3]:text-sm [&_h4]:mb-1.5 [&_h4]:mt-3 [&_h4]:text-sm [&_ol]:my-2 [&_ol]:pl-5 [&_p]:mb-2 [&_table]:text-[11px] [&_td]:p-1.5 [&_th]:p-1.5 [&_ul]:my-2 [&_ul]:pl-5":void 0})},`txt-${t}`):null})})}function S3(e){switch(e){case"running":case"pending":case"busy":return"running";case"success":return"success";case"error":case"timeout":return"error";case"cancelled":case"interrupted":return"cancelled";case"expired":return"expired";default:return"unknown"}}S2.displayName="MarkdownContent";let S5={"writing-agent":"Writing agent","data-analysis-agent":"Data analysis agent"},S6="[Async tasks update]";function S9(e){return`${e.task_id}:${e.run_id||"legacy"}`}function S8(e){let t=e.trim().split(/\r?\n/);if(t[0]!==S6||!t[1])return null;try{let e=JSON.parse(t[1]);if("string"!=typeof e.task_id||!e.task_id)return null;return{taskId:e.task_id,runId:"string"==typeof e.run_id&&e.run_id?e.run_id:void 0}}catch{return null}}function S7(e,t){let r=S8(e);return!!r&&r.taskId===t.task_id&&(!r.runId||r.runId===t.run_id)}function ke(e){let t=e.liveStatus||e.status||"success";return[S6,JSON.stringify({agent:e.agent_name,kind:"agent",...e.run_id?{run_id:e.run_id}:{},status:t,task_id:e.task_id}),"(Signal only — fetch full result via check_async_task (sub-agents) if relevant to the current step, else acknowledge & continue.)"].join("\n")}let kt={running:{dot:"bg-[var(--color-warning)]",label:"Running",pulse:!0},success:{dot:"bg-[var(--color-success)]",label:"Done",pulse:!1},error:{dot:"bg-[var(--color-error)]",label:"Error",pulse:!1},cancelled:{dot:"bg-muted-foreground",label:"Cancelled",pulse:!1},expired:{dot:"bg-muted-foreground",label:"Expired",pulse:!1},unknown:{dot:"bg-muted-foreground",label:"Unknown",pulse:!1}};function kr(e){let t=S3(e);return"success"===t||"error"===t||"cancelled"===t}function kn(e){return e.filter(e=>"running"===S3(e.liveStatus??e.status)).length}let ka=ro("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),ki=ro("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),ko=ro("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),ks=ro("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);async function kl(e){try{if("u">typeof navigator&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{if("u"<typeof document)return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}finally{t.remove()}}catch{return!1}}let ku=Q.default.memo(({message:e,toolCalls:t,isLoading:r,actionRequests:n,submittedActionRequestKeys:a,onActionRequestSubmitted:i,reviewConfigsMap:o,ui:s,stream:l,onResumeInterrupt:u,graphId:c,onEditMessage:d,autoApprove:p,subAgentSteps:f})=>{let m="human"===e.type,h=vB(e),g=h&&""!==h.trim(),b=t.length>0,y=(0,Q.useMemo)(()=>{let t=e.additional_kwargs?.reasoning_content;return"string"==typeof t&&t.trim()?t.trim():null},[e.additional_kwargs]),v=(0,Q.useMemo)(()=>t.filter(e=>"task"===e.name&&e.args.subagent_type&&""!==e.args.subagent_type&&null!==e.args.subagent_type).map(e=>{let t=e.args.subagent_type;return{id:e.id,name:e.name,subAgentName:t,input:e.args,output:e.result?{result:e.result}:void 0,status:e.status}}),[t]),_=(0,Q.useMemo)(()=>{let e=new Map;if(!n||0===n.length)return e;let r=new Map;n.forEach((e,t)=>{let n=r.get(e.name),a={actionRequest:e,actionIndex:t};n?n.push(a):r.set(e.name,[a])});let a=new Map;for(let n of t){let t=r.get(n.name);if(!t)continue;let i=a.get(n.name)??0;i<t.length&&(e.set(n.id,t[i]),a.set(n.name,i+1))}return e},[n,t]),w=(0,Q.useMemo)(()=>JSON.stringify((n??[]).map(e=>({name:e.name,args:e.args}))),[n]),E=(0,Q.useRef)({});(0,Q.useEffect)(()=>{E.current={}},[w]);let x=(0,Q.useCallback)((e,t)=>{let r=t?.decisions;if(!Array.isArray(r)||!n?.length||1===n.length||r.length===n.length)return void u?.(t);let a=r[0],i={...E.current,[e]:a};E.current=i,n.every((e,t)=>i[t])&&(E.current={},u?.({decisions:n.map((e,t)=>i[t])}))},[n,u]),[S,k]=(0,Q.useState)(!1),[T,A]=(0,Q.useState)(!1),N=(0,Q.useCallback)(async()=>{h&&(await kl(h)?(A(!0),setTimeout(()=>A(!1),2e3)):u_.toast.error("Couldn't copy to clipboard."))},[h]),[I,C]=(0,Q.useState)({}),R=(0,Q.useCallback)(e=>I[e]??!1,[I]),O=(0,Q.useCallback)(e=>{C(t=>({...t,[e]:!t[e]}))},[]);return m&&null!==S8(h)?(0,J.jsx)("div",{className:"flex w-full justify-center py-1.5",children:(0,J.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs text-muted-foreground",children:[(0,J.jsx)(ka,{className:"size-3 text-[var(--brand)]","aria-hidden":"true"}),"Background agent reported back"]})}):(0,J.jsx)("div",{className:rZ("group flex w-full max-w-full overflow-x-hidden",m&&"flex-row-reverse"),children:(0,J.jsxs)("div",{className:rZ("min-w-0 max-w-full",m?"max-w-[70%]":"w-full"),children:[!m&&y&&(0,J.jsxs)("div",{className:"mt-4",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>k(e=>!e),"aria-expanded":S,className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground",children:[(0,J.jsx)(ko,{className:rZ("h-3.5 w-3.5 transition-transform",S&&"rotate-90"),"aria-hidden":"true"}),(0,J.jsx)(ki,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Thinking"]}),S&&(0,J.jsx)("div",{className:"mt-2 whitespace-pre-wrap break-words border-l-2 border-border pl-3 text-sm leading-relaxed text-muted-foreground",children:y})]}),g&&(0,J.jsx)("div",{className:rZ("relative flex items-end gap-0"),children:(0,J.jsx)("div",{className:rZ("mt-4 overflow-hidden break-words text-sm font-normal leading-[150%]",m?"rounded-xl rounded-br-none border border-border px-3 py-2 text-foreground":"text-primary"),style:m?{backgroundColor:"var(--color-user-message-bg)"}:void 0,children:m?(0,J.jsx)("p",{className:"m-0 whitespace-pre-wrap break-words text-sm leading-relaxed",children:h}):g?(0,J.jsx)(S2,{content:h}):null})}),!m&&g&&(0,J.jsx)("div",{className:"mt-1",children:(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ks,{className:"h-4 w-4","aria-hidden":"true"})})}),m&&g&&(0,J.jsxs)("div",{className:"mt-1 flex justify-end gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",children:[(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ks,{className:"h-4 w-4","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button",onClick:()=>d?.(h),"aria-label":"Edit message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:(0,J.jsx)(a4,{className:"h-4 w-4","aria-hidden":"true"})})]}),b&&(0,J.jsx)("div",{className:"mt-4 flex w-full flex-col",children:t.map(e=>{if("task"===e.name)return null;let t=s?.find(t=>t.metadata?.tool_call_id===e.id),n=_.get(e.id),d=n?.actionRequest,f=n?e.id:void 0,m=o?.get(e.name);return(0,J.jsx)(_c,{toolCall:e,uiComponent:t,stream:l,graphId:c,actionRequest:d,actionRequestKey:f,actionRequestSubmitted:f?a?.has(f):void 0,onActionRequestSubmitted:i,reviewConfig:m,onResume:n?e=>x(n.actionIndex,e):u,isLoading:r,autoApprove:p},e.id)})}),!m&&v.length>0&&(0,J.jsx)("div",{className:"flex w-fit max-w-full flex-col gap-4",children:v.map(e=>(0,J.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,J.jsx)("div",{className:"flex items-end gap-2",children:(0,J.jsx)("div",{className:"w-[calc(100%-100px)]",children:(0,J.jsx)(v9,{subAgent:e,onClick:()=>O(e.id),isExpanded:R(e.id)})})}),R(e.id)&&(0,J.jsx)("div",{className:"w-full max-w-full",children:(0,J.jsxs)("div",{className:"bg-surface border-border-light rounded-md border p-4",children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Input"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S2,{content:vH(e.input)})}),(f?.[e.id]?.length??0)>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Steps"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S4,{steps:f[e.id],hideFinalText:!!e.output})})]}),e.output&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Output"}),(0,J.jsx)(S2,{content:vH(e.output)})]})]})})]},e.id))})]})})});ku.displayName="ChatMessage";let kc=ro("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),kd=Q.default.memo(({content:e,summarizedCount:t})=>{let[r,n]=(0,Q.useState)(!1),a=function(e){if(!e)return"";let t=e.match(/<summary>\s*([\s\S]*?)\s*<\/summary>/);if(t)return t[1].trim();let r=e.match(/Here is a summary of the conversation to date:\s*([\s\S]*)$/);return r?r[1].trim():e.trim()}(e);return(0,J.jsxs)("div",{className:"my-3 w-full",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,J.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),"aria-expanded":r,className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[(0,J.jsx)(kc,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),"Conversation compacted","number"==typeof t&&t>0&&(0,J.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",t," earlier"," ",1===t?"message":"messages"," summarized"]}),(0,J.jsx)(ko,{className:rZ("size-3.5 transition-transform",r&&"rotate-90"),"aria-hidden":"true"})]}),(0,J.jsx)("div",{className:"h-px flex-1 bg-border"})]}),r&&(0,J.jsx)("div",{className:"mt-2 overflow-hidden rounded-md border border-border bg-muted/20 px-4 py-3",children:(0,J.jsx)(S2,{content:a})})]})});kd.displayName="CompactionSummary";let kp=ro("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),kf="__other__";function km({questions:e,onSubmit:t,onCancel:r,isLoading:n}){let[a,i]=(0,Q.useState)(()=>e.map(()=>"")),[o,s]=(0,Q.useState)(()=>e.map(()=>null)),l=(e,t)=>i(r=>r.map((r,n)=>n===e?t:r)),u=(e,t)=>s(r=>r.map((r,n)=>n===e?t:r)),c=e=>"text"===e.type&&!1===e.required,d=e.every((e,t)=>c(e)||""!==a[t].trim());return(0,J.jsxs)("div",{className:"w-full rounded-lg border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(kp,{size:16,className:"text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"EvoScientist Needs Your Input"})]}),(0,J.jsx)("div",{className:"space-y-5",children:e.map((e,t)=>(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-2 text-sm font-medium text-foreground",children:[e.question,!c(e)&&(0,J.jsx)("span",{className:"ml-1 text-destructive",children:"*"})]}),"multiple_choice"===e.type?(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[e.choices?.map(e=>{let r=o[t]===e.value;return(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,e.value),l(t,e.value)},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",r?"border-[var(--brand-solid)] bg-[var(--brand-solid)] text-[var(--brand-foreground)]":"border-border bg-background hover:bg-accent"),children:e.value},e.value)}),(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,kf),l(t,"")},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",o[t]===kf?"border-[var(--brand)] text-foreground":"border-border bg-background hover:bg-accent"),children:"Other…"}),o[t]===kf&&(0,J.jsx)(_l,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:"Type your answer…",className:"text-sm",rows:2,disabled:n})]}):(0,J.jsx)(_l,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:c(e)?"Type your answer… (optional)":"Type your answer…",className:"text-sm",rows:2,disabled:n})]},t))}),(0,J.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,J.jsx)(na,{variant:"outline",size:"sm",onClick:r,disabled:n,children:"Cancel"}),(0,J.jsx)(na,{size:"sm",onClick:()=>t(a),disabled:!d||n,className:"bg-[var(--brand-solid)] text-[var(--brand-foreground)] hover:opacity-90",children:n?"Submitting…":"Submit"})]})]})}let kh="evoscientist-auto-approve",kg="__new__";function kb(){try{let e=localStorage.getItem(kh);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function ky(e){try{localStorage.setItem(kh,JSON.stringify(e))}catch{}}function kv(e){return!0===kb()[e??kg]}function k_(e,t){let r=kb(),n=e??kg;t?r[n]=!0:delete r[n],ky(r)}function kw(e,t){let r=t?.enabled??!0,n=t?.intervalMs??3e3,a=nj(),[i,o]=(0,Q.useState)([]),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)(null),d=(0,Q.useRef)(0),p=(0,Q.useRef)(!0),f=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{f.current.clear()},[a,e]);let m=(0,Q.useCallback)(async()=>{if(!r||!e){o([]),l(!0);return}let t=++d.current;try{let r=await a.threads.getState(e),n=function(e){if(!e||"object"!=typeof e)return[];let t=[];for(let r of Object.values(e))r&&"object"==typeof r&&"string"==typeof r.task_id&&"string"==typeof r.agent_name&&t.push({task_id:r.task_id,agent_name:r.agent_name,thread_id:"string"==typeof r.thread_id?r.thread_id:r.task_id,run_id:"string"==typeof r.run_id?r.run_id:"",status:"string"==typeof r.status?r.status:"",created_at:"string"==typeof r.created_at?r.created_at:void 0,last_updated_at:"string"==typeof r.last_updated_at?r.last_updated_at:void 0});return t.sort((e,t)=>(t.created_at??"").localeCompare(e.created_at??"")),t}(r.values?.async_tasks),i=await Promise.all(n.map(async e=>{if(!e.run_id)return{...e,liveStatus:e.status,startedAt:e.created_at};let t=`${e.thread_id}:${e.run_id}`;if(f.current.has(t))return{...e,liveStatus:"expired",startedAt:e.created_at,endedAt:e.last_updated_at??e.created_at};try{let t=await a.runs.get(e.thread_id,e.run_id),r=t.status??e.status;return{...e,liveStatus:r,startedAt:t.created_at??e.created_at,endedAt:kr(r)?t.updated_at??e.last_updated_at:void 0}}catch(r){if("object"==typeof r&&null!==r&&404===r.status)return f.current.add(t),{...e,liveStatus:"expired",startedAt:e.created_at,endedAt:e.last_updated_at??e.created_at};return{...e,liveStatus:e.status,startedAt:e.created_at}}}));if(t!==d.current||!p.current)return;o(i),c(null)}catch{t===d.current&&p.current&&c("Couldn't load background agents.")}finally{t===d.current&&p.current&&l(!0)}},[a,e,r]);return(0,Q.useEffect)(()=>{if(p.current=!0,!r)return o([]),l(!0),()=>{p.current=!1};l(!1),m();let e=setInterval(()=>{document.hidden||m()},n);return()=>{p.current=!1,clearInterval(e)}},[m,r,n]),{tasks:i,loaded:s,error:u,refresh:m}}let kE="evoscientist-auto-notify",kx="evoscientist-auto-notify-reported",kS="evo-auto-notify-change";function kk(){try{let e=localStorage.getItem(kE);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kT(){try{let e=localStorage.getItem(kx);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kA(e){try{localStorage.setItem(kx,JSON.stringify(e))}catch{}}function kN(e){return!!e&&!1!==kk()[e]}function kI(e,t){if(!e)return;let r=kT(),n=r[e];r[e]={initialized:!0,keys:Array.from(new Set([...n?.keys??[],...t]))},kA(r)}function kC(e,t){if(!e)return;let r=kT(),n=r[e];r[e]={initialized:n?.initialized??!0,keys:Array.from(new Set([...n?.keys??[],t]))},kA(r)}function kR(e){let[t,r]=(0,Q.useState)(()=>kN(e));return(0,Q.useEffect)(()=>{let t=()=>r(kN(e));return t(),window.addEventListener(kS,t),window.addEventListener("storage",t),()=>{window.removeEventListener(kS,t),window.removeEventListener("storage",t)}},[e]),[t,(0,Q.useCallback)(t=>(function(e,t){if(!e)return;let r=kk();t?delete r[e]:r[e]=!1;try{localStorage.setItem(kE,JSON.stringify(r))}catch{}window.dispatchEvent(new Event(kS))})(e,t),[e])]}let kO={damping:.7,stiffness:.05,mass:1.25},kL=1e3/60,kP=!1;function kD(e,t){let r=(0,Q.useCallback)(t=>(r.current=t,e(t)),t);return r}globalThis.document?.addEventListener("mousedown",()=>{kP=!0}),globalThis.document?.addEventListener("mouseup",()=>{kP=!1}),globalThis.document?.addEventListener("click",()=>{kP=!1});let kM=new Map;function kj(...e){let t={...kO},r=!1;for(let n of e){if("instant"===n){r=!0;continue}"object"==typeof n&&(r=!1,t.damping=n.damping??t.damping,t.stiffness=n.stiffness??t.stiffness,t.mass=n.mass??t.mass)}let n=JSON.stringify(t);return kM.has(n)||kM.set(n,Object.freeze(t)),r?"instant":kM.get(n)}let kF=ro("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),k$=ro("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),kU=ro("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),kz=lO?e=>{e()}:Q.default.startTransition,kB=l5(ur,()=>(e,t,r={})=>{let{mutate:n}=l4(),a=(0,Q.useRef)(e),i=(0,Q.useRef)(t),o=(0,Q.useRef)(r),s=(0,Q.useRef)(0),[l,u,c]=(e=>{let[,t]=(0,Q.useState)({}),r=(0,Q.useRef)(!1),n=(0,Q.useRef)(e),a=(0,Q.useRef)({data:!1,error:!1,isValidating:!1}),i=(0,Q.useCallback)(e=>{let i=!1,o=n.current;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&o[t]!==e[t]&&(o[t]=e[t],a.current[t]&&(i=!0));i&&!r.current&&t({})},[]);return lP(()=>(r.current=!1,()=>{r.current=!0})),[n,a.current,i]})({data:lb,error:lb,isMutating:!1}),d=l.current,p=(0,Q.useCallback)(async(e,t)=>{let[r,l]=lz(a.current);if(!i.current)throw Error("Can’t trigger the mutation: missing fetcher.");if(!r)throw Error("Can’t trigger the mutation: missing key.");let u=l_(l_({populateCache:!1,throwOnError:!0},o.current),t),d=lH();s.current=d,c({isMutating:!0});try{let t=await n(r,i.current(l,{arg:e}),l_(u,{throwOnError:!0}));return s.current<=d&&(kz(()=>c({data:t,isMutating:!1,error:void 0})),null==u.onSuccess||u.onSuccess.call(u,t,r,u)),t}catch(e){if(s.current<=d&&(kz(()=>c({error:e,isMutating:!1})),null==u.onError||u.onError.call(u,e,r,u),u.throwOnError))throw e}},[]),f=(0,Q.useCallback)(()=>{s.current=lH(),c({data:lb,error:lb,isMutating:!1})},[]);return lP(()=>{a.current=e,i.current=t,o.current=r}),{trigger:p,reset:f,get data(){return u.data=!0,d.data},get error(){return u.error=!0,d.error},get isMutating(){return u.isMutating=!0,d.isMutating}}}),kH={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",dockerfile:"dockerfile",makefile:"makefile"},kG=Q.default.memo(({file:e,onSaveFile:t,onClose:r,editDisabled:n})=>{let[a,i]=(0,Q.useState)(null===e),[o,s]=(0,Q.useState)(String(e?.path||"")),[l,u]=(0,Q.useState)(String(e?.content||"")),c=kB({kind:"files-update",fileName:o,fileContent:l},async({fileName:e,fileContent:r})=>{if(e&&r)return await t(e,r)},{onSuccess:()=>i(!1),onError:e=>u_.toast.error(`Failed to save file: ${e}`)});(0,Q.useEffect)(()=>{s(String(e?.path||"")),u(String(e?.content||"")),i(null===e)},[e]);let d=(0,Q.useMemo)(()=>{let e=String(o||"");return e.split(".").pop()?.toLowerCase()||""},[o]),p=(0,Q.useMemo)(()=>"md"===d||"markdown"===d,[d]),f=(0,Q.useMemo)(()=>kH[d]||"text",[d]),m=(0,Q.useCallback)(()=>{l&&kl(l)},[l]),h=(0,Q.useCallback)(()=>{if(l&&o){let e=new Blob([l],{type:"text/plain"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},[l,o]),g=(0,Q.useCallback)(()=>{i(!0)},[]),b=(0,Q.useCallback)(()=>{null===e?r():(s(String(e.path)),u(String(e.content)),i(!1))},[e,r]),y=(0,Q.useMemo)(()=>""!==o.trim()&&!o.includes("/")&&!o.includes(" "),[o]);return(0,J.jsx)(rK,{open:!0,onOpenChange:r,children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e?.path||"New File"}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kF,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),a&&null===e?(0,J.jsx)(nu,{value:o,onChange:e=>s(e.target.value),placeholder:"Enter filename…",className:"text-base font-medium","aria-invalid":!y}):(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e?.path})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{onClick:g,variant:"ghost",size:"sm",className:"h-8 px-2",disabled:n,children:[(0,J.jsx)(n$,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsxs)(na,{onClick:m,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(ks,{size:16,className:"mr-1"}),"Copy"]}),(0,J.jsxs)(na,{onClick:h,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download"]})]})})]}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:a?(0,J.jsx)(_l,{value:l,onChange:e=>u(e.target.value),placeholder:"Enter file content…",className:"h-full min-h-[400px] resize-none font-mono text-sm"}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:l?p?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S2,{content:l})}):(0,J.jsx)(S0,{language:f,style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:l}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})}),a&&(0,J.jsxs)("div",{className:"mt-4 flex justify-end gap-2 border-t border-border pt-4",children:[(0,J.jsxs)(na,{onClick:b,variant:"outline",size:"sm",children:[(0,J.jsx)(rs,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{onClick:()=>c.trigger(),size:"sm",disabled:c.isMutating||!o.trim()||!l.trim()||!y,children:[c.isMutating?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kU,{size:16,className:"mr-1"}),"Save"]})]})]})})});function kV({files:e,setFiles:t,editDisabled:r}){let[n,a]=(0,Q.useState)(null),i=(0,Q.useCallback)(async(r,n)=>{await t({...e,[r]:n}),a({path:r,content:n})},[e,t]);return(0,J.jsxs)(J.Fragment,{children:[0===Object.keys(e).length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No files created yet"})}):(0,J.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(256px,1fr))] gap-2",children:Object.keys(e).map(t=>{let r,n=String(t),i=e[t];if("object"==typeof i&&null!==i&&"content"in i){let e=i.content;r=Array.isArray(e)?e.join("\n"):String(e||"")}else r=String(i||"");return(0,J.jsxs)("button",{type:"button",onClick:()=>a({path:n,content:r}),className:"cursor-pointer space-y-1 truncate rounded-md border border-border px-2 py-3 shadow-sm transition-colors",style:{backgroundColor:"var(--color-file-button)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button-hover)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button)"},children:[(0,J.jsx)(kF,{size:24,className:"mx-auto text-muted-foreground"}),(0,J.jsx)("span",{className:"mx-auto block w-full truncate break-words text-center text-sm leading-relaxed text-foreground",children:n})]},n)})}),n&&(0,J.jsx)(kG,{file:n,onSaveFile:i,onClose:()=>a(null),editDisabled:r})]})}kG.displayName="FileViewDialog",Q.default.memo(({todos:e,files:t,setFiles:r})=>{let{isLoading:n,interrupt:a}=vZ(),[i,o]=(0,Q.useState)(!1),[s,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(e.length),c=(0,Q.useRef)(Object.keys(t).length);(0,Q.useEffect)(()=>{0===u.current&&e.length>0&&o(!0),u.current=e.length},[e.length]);let d=Object.keys(t).length;(0,Q.useEffect)(()=>{0===c.current&&d>0&&l(!0),c.current=d},[d]);let p=(0,Q.useCallback)(e=>{switch(e){case"completed":return(0,J.jsx)(vX,{size:12,className:"text-[var(--color-success)]"});case"in_progress":return(0,J.jsx)(vJ,{size:12,className:"text-[var(--color-warning)]"});default:return(0,J.jsx)(vQ,{size:10,className:"text-[var(--color-text-tertiary)]"})}},[]),f=(0,Q.useMemo)(()=>({pending:e.filter(e=>"pending"===e.status),in_progress:e.filter(e=>"in_progress"===e.status),completed:e.filter(e=>"completed"===e.status)}),[e]),m={pending:"Pending",in_progress:"In Progress",completed:"Completed"};return(0,J.jsx)("div",{className:"min-h-0 w-full flex-1",children:(0,J.jsx)("div",{className:"font-inter flex h-full w-full flex-col p-0",children:(0,J.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-hidden",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"AGENT TASKS"}),(0,J.jsx)("button",{onClick:()=>o(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",i?"rotate-180":"rotate-0"),"aria-label":"Toggle tasks panel",children:(0,J.jsx)(la,{size:14})})]}),i&&(0,J.jsx)("div",{className:"bg-muted-secondary rounded-xl px-3 pb-2",children:(0,J.jsx)(ij,{className:"h-full",children:0===e.length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tasks created yet"})}):(0,J.jsx)("div",{className:"ml-1 p-0.5",children:Object.entries(f).map(([e,t])=>(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:m[e]}),t.map((t,r)=>(0,J.jsxs)("div",{className:"mb-1.5 flex items-start gap-2 rounded-sm p-1 text-sm",children:[p(t.status),(0,J.jsx)("span",{className:"flex-1 break-words leading-relaxed text-inherit",children:t.content})]},`${e}_${t.id}_${r}`))]}))})})}),(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"FILE SYSTEM"}),(0,J.jsx)("button",{onClick:()=>l(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",s?"rotate-180":"rotate-0"),"aria-label":"Toggle files panel",children:(0,J.jsx)(la,{size:14})})]}),s&&(0,J.jsx)(kV,{files:t,setFiles:r,editDisabled:!0===n||void 0!==a})]})})})}).displayName="TasksFilesSidebar";let kq=ro("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),kW=ro("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),kZ=ro("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),kK=ro("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),kY=ro("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),kX=ro("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),kJ={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",sh:"bash",bash:"bash",zsh:"bash",json:"json",jsonl:"json",xml:"xml",html:"html",css:"css",scss:"scss",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",tex:"latex",bib:"latex",r:"r"},kQ=new Set(["png","jpg","jpeg","gif","webp","svg","bmp"]),k0=new Set([...Object.keys(kJ),"txt","md","markdown","log","csv","tsv","cfg","conf","env","gitignore"]);function k1(e,t=!1){let r=new URLSearchParams({path:e});return t&&r.set("download","1"),`/api/workspace/file?${r.toString()}`}let k2=Q.default.memo(({path:e,size:t,onClose:r,onChanged:n})=>{let[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(!1),[p,f]=(0,Q.useState)(""),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(!1),[_,w]=(0,Q.useState)(!1),[E,x]=(0,Q.useState)(null),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]);let k=e?e.split("/").pop()||e:"",T=(0,Q.useMemo)(()=>k.includes(".")?k.split(".").pop().toLowerCase():"",[k]),A=kQ.has(T)?"image":"pdf"===T?"pdf":k0.has(T)?"text":"binary",N="text"===A&&null!=t&&t>2097152;if((0,Q.useEffect)(()=>{if(!e||"text"!==A||N)return void i(null);let t=!1;return s(!0),u(null),d(!1),b(null),fetch(k1(e)).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||`Failed to load file (${e.status})`)}return e.text()}).then(e=>{t||i(e)}).catch(e=>{t||u(e.message??"Failed to load file.")}).finally(()=>{t||s(!1)}),()=>{t=!0}},[e,A,N]),!e)return null;let I="md"===T||"markdown"===T,C=kJ[T]||"text",R=c&&null!==a&&p!==a,O=e=>{R?x(e):"close"===e?r():d(!1)},L=async()=>{h(!0),b(null);try{let t=await fetch(k1(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:p})}),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to save.");if(!S.current)return;i(p),d(!1),n?.()}catch(e){S.current&&b(e instanceof Error?e.message:"Failed to save.")}finally{S.current&&h(!1)}},P=async()=>{v(!0),b(null);try{let t=await fetch(k1(e),{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to delete.")}n?.(),r()}catch(e){S.current&&(w(!1),b(e instanceof Error?e.message:"Failed to delete."))}finally{S.current&&v(!1)}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(rK,{open:!0,onOpenChange:e=>{e||O("close")},children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between gap-3 border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kF,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{O("cancel-edit")},disabled:m,children:[(0,J.jsx)(kX,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 bg-[var(--brand-solid)] px-3 text-[var(--brand-foreground)] hover:opacity-90",onClick:L,disabled:m||!R,children:[m?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kU,{size:16,className:"mr-1"}),m?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:["text"===A&&!N&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{f(a??""),b(null),d(!0)},disabled:o||null===a,"aria-label":"Edit file",children:[(0,J.jsx)(a4,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsx)("a",{href:k1(e,!0),download:k,children:(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",asChild:!0,children:(0,J.jsxs)("span",{children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download"]})})}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>w(!0),disabled:y,"aria-label":"Delete file",title:"Delete file",children:y?(0,J.jsx)(a1,{size:16,className:"animate-spin"}):(0,J.jsx)(a8,{size:16})})]})})]}),g&&(0,J.jsx)("p",{role:"alert",className:"mb-2 text-sm text-destructive",children:g}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:c?(0,J.jsx)("textarea",{value:p,onChange:e=>f(e.target.value),spellCheck:!1,"aria-label":"File content",className:"h-full w-full resize-none rounded-md border border-border bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"File is empty…"}):"image"===A?(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,J.jsx)("img",{src:k1(e),alt:k,className:"max-h-full max-w-full object-contain"})})}):"pdf"===A?(0,J.jsx)("iframe",{src:k1(e),title:k,className:"h-full w-full rounded-md border border-border"}):"binary"===A||N?(0,J.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-12 text-center",children:[(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:N?"This file is too large to preview inline.":"This file type can't be previewed."}),(0,J.jsx)("a",{href:k1(e,!0),download:k,children:(0,J.jsxs)(na,{variant:"outline",size:"sm",children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download file"]})})]}):o?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):l?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:l})}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:a&&a.length>0?I?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S2,{content:a})}):(0,J.jsx)(S0,{language:C,style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:a}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})})]})}),(0,J.jsx)(rK,{open:null!==E,onOpenChange:e=>{e||x(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",k,"” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>x(null),children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{x(null),"close"===E&&r(),"cancel-edit"===E&&d(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})}),(0,J.jsx)(rK,{open:_,onOpenChange:e=>{y||w(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete file?"}),(0,J.jsxs)(r2,{children:["“",k,"” will be permanently removed from the workspace. This can't be undone."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>w(!1),disabled:y,children:"Cancel"}),(0,J.jsx)(na,{onClick:P,disabled:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:y?"Deleting…":"Delete"})]})]})})]})});async function k4(e){let t=await fetch(`/api/workspace?${new URLSearchParams({path:e})}`),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to list workspace.");return r?.entries??[]}async function k3(){let e=await fetch("/api/workspace?recursive=1"),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||"Failed to load workspace.");return{entries:t?.entries??[],truncated:!!t?.truncated}}k2.displayName="WorkspaceFileDialog";let k5=[{key:"docs",label:"Papers & docs",Icon:kF,exts:["pdf","tex","bib","md","markdown","txt","docx","doc","rtf","odt"]},{key:"figures",label:"Figures",Icon:kZ,exts:["png","jpg","jpeg","gif","svg","webp","bmp","tiff","tif","eps"]},{key:"data",label:"Data",Icon:kK,exts:["json","jsonl","csv","tsv","xlsx","xls","parquet","pkl","npy","npz","h5","hdf5","db","sqlite","yaml","yml","xml"]},{key:"code",label:"Code",Icon:kY,exts:["py","ipynb","js","ts","tsx","jsx","sh","bash","r","jl","cpp","cc","c","h","hpp","java","go","rs","m","rb"]}],k6={key:"other",label:"Other",Icon:v0},k9={};for(let e of k5)for(let t of e.exts)k9[t]=e.key;function k8(){let[e,t]=(0,Q.useState)("tree"),[r,n]=(0,Q.useState)({}),[a,i]=(0,Q.useState)(new Set),[o,s]=(0,Q.useState)(new Set),[l,u]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(null),[p,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(null),_=(0,Q.useCallback)(async e=>{s(t=>new Set(t).add(e));try{let t=await k4(e);return n(r=>({...r,[e]:t})),""===e&&b(null),t}catch(t){throw""===e&&b(t instanceof Error?t.message:"Failed to load."),t}finally{s(t=>{let r=new Set(t);return r.delete(e),r})}},[]),w=(0,Q.useCallback)(async()=>{f(!0);try{let{entries:e,truncated:t}=await k3();d(e),h(t),b(null)}catch(e){b(e instanceof Error?e.message:"Failed to load.")}finally{f(!1)}},[]);(0,Q.useEffect)(()=>{u(!0),_("").catch(()=>{}).finally(()=>u(!1))},[]),(0,Q.useEffect)(()=>{"type"!==e||null!==c||p||w()},[e]);let E=(0,Q.useCallback)(async()=>{(b(null),"type"===e)?await w():(u(!0),await Promise.allSettled(["",...a].map(e=>_(e))),u(!1))},[e,a,_,w]),x=(0,Q.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):(n.add(e),r[e]||_(e).catch(()=>{})),n})},[r,_]),S=(0,Q.useMemo)(()=>{let e={};for(let t of c??[]){let r=k9[t.ext]??k6.key;(e[r]??=[]).push(t)}for(let t of Object.values(e))t.sort((e,t)=>t.mtime-e.mtime);return e},[c]),k="type"===e?p:l,T=(e,t)=>{let n=r[e];return n?0===n.length&&0===t?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"}):n.map(e=>{let r=a.has(e.path),n=o.has(e.path);return(0,J.jsxs)("div",{children:[(0,J.jsxs)("button",{type:"button",onClick:()=>"dir"===e.type?x(e.path):v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-sm text-foreground transition-colors hover:bg-muted",style:{paddingLeft:`${14*t+4}px`},title:e.name,children:["dir"===e.type?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground",children:n?(0,J.jsx)(a1,{className:"size-3 animate-spin"}):r?(0,J.jsx)(la,{className:"size-3.5"}):(0,J.jsx)(ko,{className:"size-3.5"})}),(0,J.jsx)(kq,{className:"size-4 shrink-0 text-[var(--brand)]"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"size-4 shrink-0"}),(0,J.jsx)(kF,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,J.jsx)("span",{className:"truncate",children:e.name})]}),"dir"===e.type&&r&&T(e.path,t+1)]},e.path)}):null};return(0,J.jsxs)("div",{className:"flex min-h-0 flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 pb-1.5",children:[(0,J.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted p-0.5 text-xs",children:["tree","type"].map(r=>(0,J.jsx)("button",{type:"button",onClick:()=>t(r),className:rZ("rounded px-2 py-0.5 font-medium transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),"aria-pressed":e===r,children:"tree"===r?"Tree":"By type"},r))}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)("a",{href:"/api/workspace/download",download:!0,className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Download the whole workspace as a zip",children:[(0,J.jsx)(k$,{className:"size-3.5"}),"All"]}),(0,J.jsx)("button",{type:"button",onClick:E,disabled:k,className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50","aria-label":"Refresh workspace",title:"Refresh",children:(0,J.jsx)(kW,{className:rZ("size-3.5",k&&"animate-spin")})})]})]}),g?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:g}):"tree"===e?l&&!r[""]?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(0,J.jsx)("div",{className:"-mx-1",children:T("",0)}):p&&null===c?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(()=>{if(!c)return null;if(0===c.length)return(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"});let e=[...k5,k6];return(0,J.jsxs)("div",{className:"space-y-3",children:[m&&(0,J.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Showing the first files only — the workspace has more than the limit."}),e.map(e=>{let t=S[e.key];if(!t||0===t.length)return null;let r=e.Icon;return(0,J.jsxs)("div",{children:[(0,J.jsxs)("div",{className:"mb-0.5 flex items-center gap-1.5 px-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:[(0,J.jsx)(r,{className:"size-3.5"}),e.label,(0,J.jsxs)("span",{className:"text-muted-foreground",children:["(",t.length,")"]})]}),t.map(e=>{let t=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,J.jsxs)("button",{type:"button",onClick:()=>v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md px-1 py-1 text-left text-sm text-foreground transition-colors hover:bg-muted",title:e.path,children:[(0,J.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,J.jsx)("span",{className:"truncate",children:e.name}),t&&(0,J.jsx)("span",{className:"ml-auto shrink-0 truncate pl-2 text-[11px] text-muted-foreground",children:t})]},e.path)})]},e.key)})]})})(),(0,J.jsx)(k2,{path:y?.path??null,size:y?.size,onClose:()=>v(null),onChanged:E})]})}let k7=["Survey recent papers on a topic","Design an experiment plan","Analyze workspace files"],Te=(e,t)=>{switch(e){case"completed":return(0,J.jsx)(vX,{size:16,className:rZ("text-[var(--color-success)]",t)});case"in_progress":return(0,J.jsx)(vJ,{size:16,className:rZ("text-[var(--color-warning)]",t)});default:return(0,J.jsx)(vQ,{size:16,className:rZ("text-[var(--color-text-tertiary)]",t)})}},Tt=Q.default.memo(({assistant:e,onShowAgents:t,onNotifyReady:r})=>{let n,a,i,o,s,l,u,[c,d]=(0,Q.useState)(null),p=(0,Q.useRef)(null),f=(0,Q.useRef)(null),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(""),[b,y]=(0,Q.useState)([]),[v,_]=(0,Q.useState)(!1),[w]=ec("threadId"),[E,x]=(0,Q.useState)(()=>kv(w)),[S,k]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),A=(0,Q.useRef)(w),N=(0,Q.useRef)(!1),{scrollRef:I,contentRef:C,scrollToBottom:R}=((e={})=>{let[t,r]=(0,Q.useState)(!1),[n,a]=(0,Q.useState)(!1!==e.initial),[i,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);s.current=e;let l=(0,Q.useCallback)(()=>{if(!kP)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),u=(0,Q.useCallback)(e=>{d.isAtBottom=e,a(e)},[]),c=(0,Q.useCallback)(e=>{d.escapedFromLock=e,r(e)},[]),d=(0,Q.useMemo)(()=>{let r;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(scrollTop){if(g.current){let{scrollBehavior:e}=getComputedStyle(g.current);"auto"!==e&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=scrollTop,d.ignoreScrollToTop=g.current.scrollTop,"auto"!==e&&(g.current.style.scrollBehavior=e)}},get targetScrollTop(){if(!g.current||!b.current)return 0;return g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!b.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(r?.targetScrollTop===t)return r.calculatedScrollTop;let n=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:b.current}),t),0);return r={targetScrollTop:t,calculatedScrollTop:n},requestAnimationFrame(()=>{r=void 0}),n},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),p=(0,Q.useCallback)((e={})=>{let t;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||u(!0);let r=Date.now()+(Number(e.wait)||0),n=kj(s.current,e.animation),{ignoreEscapes:a=!1}=e,i=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{t=Date.now()}):t=r+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:u}=d,c=performance.now(),f=(c-(d.lastTick??c))/kL;if(d.animation||(d.animation={behavior:n,promise:e,ignoreEscapes:a}),d.animation.behavior===n&&(d.lastTick=c),l()||r>Date.now())return o();if(u<Math.min(i,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if("instant"===n)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*f,d.scrollTop+=d.accumulated,d.scrollTop!==u&&(d.accumulated=0)}return o()}return t>Date.now()?(i=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop)?p({animation:kj(s.current,s.current.resize),ignoreEscapes:a,duration:Math.max(0,t-Date.now())||void 0}):d.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return(!0!==e.wait&&(d.animation=void 0),d.animation?.behavior===n)?d.animation.promise:o()},[u,l,d]),f=(0,Q.useCallback)(()=>{c(!0),u(!1)},[c,u]),m=(0,Q.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:r}=d,{lastScrollTop:n=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,r&&r>t&&(n=r),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===r)return;if(l()){c(!0),u(!1);return}let e=t>n,a=t<n;if(d.animation?.ignoreEscapes){d.scrollTop=n;return}a&&(c(!0),u(!1)),e&&c(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[c,u,l,d]),h=(0,Q.useCallback)(({target:e,deltaY:t})=>{let r=e;for(;!["scroll","auto"].includes(getComputedStyle(r).overflow);){if(!r.parentElement)return;r=r.parentElement}r===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,d]),g=kD(e=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",h),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",h,{passive:!0})},[]),b=kD(e=>{let t;d.resizeObserver?.disconnect(),e&&(d.resizeObserver=new ResizeObserver(([e])=>{let{height:r}=e.contentRect,n=r-(t??r);if(d.resizeDifference=n,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),n>=0){let e=kj(s.current,t?s.current.resize:s.current.initial);p({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else d.isNearBottom&&(c(!1),u(!0));t=r,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===n&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e))},[]);return{contentRef:b,scrollRef:g,scrollToBottom:p,stopScroll:f,isAtBottom:n||i,isNearBottom:i,escapedFromLock:t,state:d}})(),{stream:O,messages:L,todos:P,files:D,ui:M,setFiles:j,isLoading:F,isThreadLoading:$,interrupt:U,sendMessage:z,stopStream:B,resumeInterrupt:H,subAgentActivity:G,asyncTasks:V,summarizationEvent:q}=vZ(),{tasks:W}=kw(w,{enabled:Object.keys(V??{}).length>0}),Z=(0,Q.useMemo)(()=>kn(W),[W]),[K]=kR(w),Y=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{Y.current=!1},[w]),(0,Q.useEffect)(()=>{F&&(Y.current=!1)},[F]),(0,Q.useEffect)(()=>{var e;if(!W||0===W.length||!w||!K)return;if(!(w&&kT()[w]?.initialized===!0))return void kI(w,W.filter(e=>kr(e.liveStatus)).map(S9));if(F||Y.current||h.trim())return;let t=function(e){if(!e)return new Set;let t=kT()[e];return new Set(Array.isArray(t?.keys)?t.keys:[])}(w);for(let r of W){if(!kr(r.liveStatus))continue;let n=S9(r);if(!t.has(n)){if(L.some(e=>"human"===e.type&&S7(vB(e),r))){kC(w,n);continue}Y.current=!0,kC(w,n),z(ke(r)),u_.toast.success(`Auto-reported ${S5[e=r.agent_name]??e} to the main chat.`);break}}},[W,K,F,h,L,z,w]),(0,Q.useEffect)(()=>{F&&R()},[F,R]);let X=(0,Q.useRef)({sendMessage:z,isLoading:F,messages:L,threadId:w});X.current={sendMessage:z,isLoading:F,messages:L,threadId:w};let ee=(0,Q.useRef)(r);ee.current=r,(0,Q.useEffect)(()=>(ee.current?.((e,t)=>{let r=X.current;return r.threadId!==t?"wrong-thread":r.isLoading?"busy":r.messages.some(t=>"human"===t.type&&S7(vB(t),e))?"duplicate":(kC(t,S9(e)),r.sendMessage(ke(e)),"sent")}),()=>ee.current?.(null)),[]);let et=(0,Q.useMemo)(()=>{for(let e=L.length-1;e>=0;e--){let t=L[e];if("ai"!==t.type)continue;let r=t.response_metadata,n=function(e,t){if("string"!=typeof e||!e.trim())return null;let r=e.trim(),n=r.lastIndexOf("/"),a=n>=0?r.slice(0,n):"";n>=0&&(r=r.slice(n+1)),r=r.replace(/-\d{8}$/,"");let i="string"==typeof t&&t.trim()||a;return{name:r,provider:i?i.charAt(0).toUpperCase()+i.slice(1):null}}(r?.model_name??r?.model,r?.model_provider);if(n)return n}return null},[L]),er=(0,Q.useMemo)(()=>{let e={},t=Object.keys(G);if(0===t.length)return e;let r=[],n={};for(let e of L)if("ai"===e.type)for(let t of e.tool_calls??[])"task"===t.name&&t.id&&r.push(t.id);else if("tool"===e.type){let t=e.tool_call_id;t&&(n[t]=vB(e))}let a=e=>e.replace(/\s+/g," ").trim(),i=new Set;for(let o of r){let r=a(n[o]??"");if(!r)continue;let s=t.find(e=>{if(i.has(e))return!1;let t=a(function(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if("text"===r.kind)return r.text}return""}(G[e]));return""!==t&&(r.includes(t)||t.includes(r))});s&&(e[o]=G[s],i.add(s))}let o=t.filter(e=>!i.has(e)),s=0;for(let t of r)e[t]||n[t]||s<o.length&&(e[t]=G[o[s++]]);return e},[L,G]),en=U?.value,ea=en?.type==="ask_user"||Array.isArray(en?.action_requests)&&en.action_requests.length>0,ei=F||!e||ea,eo=(0,Q.useCallback)(()=>{x(!0),k_(w,!0),k(!1)},[w]),es=(0,Q.useCallback)(()=>{x(!1),k_(w,!1),k(!1),T.current=null},[w]);(0,Q.useEffect)(()=>{let e=A.current;if(e!==w){if(null===e&&null!==w&&N.current){let e;(e=kb())[kg]&&(e[w]=!0),kg in e&&(delete e[kg],ky(e))}else null===e&&null!==w&&k_(null,!1);x(kv(w)),T.current=null,k(!1),y([]),N.current=!1,A.current=w}},[w]);let el=(0,Q.useCallback)(async e=>{let t=Array.from(e.target.files??[]);if(e.target.value="",0!==t.length){_(!0);try{let e=new FormData;t.forEach(t=>e.append("files",t));let r=await fetch("/api/workspace/upload",{method:"POST",body:e}),n=await r.json();if(!r.ok||!n.files)throw Error(n.error||"Failed to upload files.");y(e=>[...e,...n.files]),u_.toast.success(`${n.files.length} file${1===n.files.length?"":"s"} uploaded to the workspace.`)}catch(e){u_.toast.error(e instanceof Error?e.message:"Failed to upload files.")}finally{_(!1)}}},[]),eu=(0,Q.useCallback)(e=>{y(t=>t.filter(t=>t.path!==e))},[]),ed=(0,Q.useCallback)(e=>{e&&e.preventDefault();let t=h.trim();if(!t||F||v||ei)return;N.current=null===w&&E;let r=b.length>0?`
|
|
71
71
|
|
|
72
72
|
Workspace files uploaded for this request:
|
|
73
73
|
${b.map(e=>`- ${e.path}`).join("\n")}`:"";z(`${t}${r}`),g(""),y([])},[h,E,F,v,b,z,g,ei,w]),ep=(0,Q.useCallback)(e=>{ei||!e.nativeEvent.isComposing&&229!==e.keyCode&&("Enter"!==e.key||e.shiftKey||(e.preventDefault(),ed()))},[ed,ei]),ef=(0,Q.useCallback)(e=>{g(e),requestAnimationFrame(()=>{let t=f.current;t&&(t.focus(),t.setSelectionRange(e.length,e.length))})},[]),em=(0,Q.useCallback)(e=>{g(e),requestAnimationFrame(()=>f.current?.focus())},[]);(0,Q.useEffect)(()=>{if(!E)return;let e=U?.value&&U.value.action_requests;if(!U||!Array.isArray(e)||0===e.length){T.current=null;return}T.current!==U&&(T.current=U,H({decisions:e.map(()=>({type:"approve"}))}))},[E,U,H]);let eh=(0,Q.useMemo)(()=>{let e=U?.value;return e?.type==="ask_user"&&Array.isArray(e.questions)?e.questions:null},[U]),eg=(0,Q.useCallback)(e=>{H({status:"answered",answers:e})},[H]),eb=(0,Q.useCallback)(()=>{H({status:"cancelled"})},[H]),ey=(0,Q.useMemo)(()=>{let e=new Map,t=new Set;L.filter(e=>{let r,n=O.getMessagesMetadata(e)?.streamMetadata,a=n?.langgraph_checkpoint_ns;if("string"==typeof a&&a.includes("|")||function(e){if("human"===e.type){var t;if("human"!==e.type)return!1;let r=e.additional_kwargs;return r?.lc_source==="summarization"}return"ai"===e.type&&!!(t=vB(e))&&(!!(/\bconversation that has been summarized\b/.test(t)||/\bHere is a summary of the conversation to date\b/.test(t)||/<summary>[\s\S]*<\/summary>/.test(t))||/##\s+SESSION INTENT\b/.test(t))}(e))return!1;if("human"!==e.type)return!0;let i=(r=S8(vB(e)))?`${r.taskId}:${r.runId||"legacy"}`:null;return!i||!t.has(i)&&(t.add(i),!0)}).forEach(t=>{if("ai"===t.type){let r,n=(r=[],t.additional_kwargs?.tool_calls&&Array.isArray(t.additional_kwargs.tool_calls)?r.push(...t.additional_kwargs.tool_calls):t.tool_calls&&Array.isArray(t.tool_calls)?r.push(...t.tool_calls.filter(e=>""!==e.name)):Array.isArray(t.content)&&r.push(...t.content.filter(e=>"tool_use"===e.type)),r.map(e=>{let t=e.function?.arguments||e.args||e.input||{};return{id:e.id,name:e.function?.name||e.name||e.type||"",args:t&&"object"==typeof t?t:{}}})).filter(e=>"ToolSelectionResponse"!==e.name||F&&!U).map((e,r)=>{let n=e.name||"unknown";return{id:e.id||`${t.id??"ai-message"}-tool-${r}-${n}`,name:n,args:e.args,status:U?"interrupted":"pending"}});e.set(t.id,{message:t,toolCalls:n})}else if("tool"===t.type){let r=t.tool_call_id;if(!r)return;for(let[,n]of e.entries()){let e=n.toolCalls.findIndex(e=>e.id===r);if(-1!==e){n.toolCalls[e]={...n.toolCalls[e],status:"completed",result:vB(t)};break}}}else"human"===t.type&&e.set(t.id,{message:t,toolCalls:[]})});let r=Array.from(e.values());return r.map((e,t)=>{let n=t>0?r[t-1].message:null;return{...e,showAvatar:e.message.type!==n?.type}})},[L,U,F,O]),ev=(0,Q.useMemo)(()=>{if(!q)return null;let e=new Set(ey.map(e=>e.message.id));for(let t=q.cutoffIndex;t<L.length;t++){let r=L[t]?.id;if(null!=r&&e.has(r))return r}return null},[q,L,ey]),e_={in_progress:P.filter(e=>"in_progress"===e.status),pending:P.filter(e=>"pending"===e.status),completed:P.filter(e=>"completed"===e.status)},ew=P.length>0,eE=Object.keys(D).length>0,ex=(0,Q.useMemo)(()=>{let e=U?.value&&U.value.action_requests;return Array.isArray(e)?e:[]},[U]),[eS,ek]=(0,Q.useState)(()=>new Set);(0,Q.useEffect)(()=>{0===ex.length&&ek(new Set)},[ex.length]);let eT=(0,Q.useCallback)(e=>{ek(t=>{let r=new Set(t);return r.add(e),r})},[]),eA=(0,Q.useMemo)(()=>{let e=U?.value&&U.value.review_configs;if(!Array.isArray(e))return new Map;let t=[];for(let r of e){let e=r.actionName??r.action_name;e&&t.push([e,{actionName:e,allowedDecisions:r.allowedDecisions??r.allowed_decisions}])}return new Map(t)},[U]);return(0,J.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,J.jsx)(rK,{open:S,onOpenChange:k,children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Enable Auto-approve?"}),(0,J.jsx)(r2,{children:"EvoScientist will run tool actions in this research without asking you to review each one. Turn this on only when you trust the current task and deployment."})]}),(0,J.jsxs)("div",{className:"flex items-start gap-3 rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100",children:[(0,J.jsx)(v3,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),(0,J.jsx)("p",{children:"Auto-approve stays on for this research only — it follows this conversation across views and reloads, and other research keeps its own setting. Turn it off here anytime."})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),(0,J.jsx)(na,{onClick:eo,className:"bg-amber-600 text-white hover:bg-amber-700",children:"Enable Auto-approve"})]})]})}),(0,J.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden overscroll-contain",ref:I,children:(0,J.jsx)("div",{className:"mx-auto w-full max-w-[960px] px-4 pb-4 pt-3 sm:px-5",ref:C,children:$?(0,J.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"Loading…"})}):(0,J.jsxs)(J.Fragment,{children:[0===ey.length&&!F&&(0,J.jsxs)("div",{className:"flex min-h-[42vh] flex-col items-center justify-center px-3 text-center",children:[(0,J.jsx)("h2",{className:"text-pretty text-lg font-semibold sm:text-xl",children:"Start Research"}),(0,J.jsx)("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"Ask EvoScientist to review literature, inspect workspace files, or plan the next experiment."}),(0,J.jsx)("div",{className:"mt-4 flex max-w-2xl flex-wrap justify-center gap-2",children:k7.map(e=>(0,J.jsx)("button",{type:"button",onClick:()=>em(e),className:"max-w-full rounded-full border border-border bg-card px-2.5 py-1.5 text-xs text-foreground shadow-sm transition-colors hover:border-[var(--color-border)] hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring sm:text-sm",children:e},e))})]}),ey.map((t,r)=>{let n=M?.filter(e=>e.metadata?.message_id===t.message.id),a=r===ey.length-1,i=ev===t.message.id;return(0,J.jsxs)(Q.default.Fragment,{children:[i&&q&&(0,J.jsx)(kd,{content:q.content,summarizedCount:q.cutoffIndex}),(0,J.jsx)(ku,{message:t.message,toolCalls:t.toolCalls,isLoading:F,actionRequests:a?ex:void 0,submittedActionRequestKeys:eS,onActionRequestSubmitted:eT,reviewConfigsMap:a?eA:void 0,ui:n,stream:O,onResumeInterrupt:H,graphId:e?.graph_id,onEditMessage:ef,autoApprove:E,subAgentSteps:er})]},t.message.id)}),q&&!ev&&(0,J.jsx)(kd,{content:q.content,summarizedCount:q.cutoffIndex}),eh&&(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(km,{questions:eh,onSubmit:eg,onCancel:eb,isLoading:F})})]})})}),(0,J.jsx)("div",{className:"flex-shrink-0 bg-background",children:(0,J.jsxs)("div",{className:rZ("mb-2 flex flex-shrink-0 flex-col overflow-hidden rounded-lg border border-border bg-background sm:mb-4","mx-auto w-[calc(100%-16px)] max-w-[960px] transition-colors duration-200 ease-in-out sm:w-[calc(100%-24px)]","focus-within:ring-2 focus-within:ring-ring"),children:[(0,J.jsxs)("div",{className:"flex max-h-60 flex-col overflow-y-auto border-b border-border bg-sidebar empty:hidden sm:max-h-72",children:[!c&&(0,J.jsx)(J.Fragment,{children:(n=P.find(e=>"in_progress"===e.status),i=(a=P.length)-e_.pending.length,o=a===i,s=ew?(0,J.jsx)("button",{type:"button",onClick:()=>d(e=>"tasks"===e?null:"tasks"),className:"grid w-full cursor-pointer grid-cols-[auto_auto_1fr] items-center gap-2.5 px-3 py-2.5 text-left sm:px-4","aria-expanded":"tasks"===c,children:o?[(0,J.jsx)(vX,{size:16,className:"text-[var(--color-success)]"},"icon"),(0,J.jsx)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:"All tasks completed"},"label")]:null!=n?[(0,J.jsx)("div",{children:Te(n.status)},"icon"),(0,J.jsxs)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:["Task"," ",a-e_.pending.length," ","of ",a]},"label"),(0,J.jsx)("span",{className:"min-w-0 gap-2 truncate text-sm text-muted-foreground",children:n.content},"content")]:[(0,J.jsx)(vQ,{size:16,className:"text-[var(--color-text-tertiary)]"},"icon"),(0,J.jsxs)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:["Task"," ",a-e_.pending.length," of"," ",a]},"label")]}):null,l=eE?(0,J.jsxs)("button",{type:"button",onClick:()=>d(e=>"files"===e?null:"files"),className:"flex flex-shrink-0 cursor-pointer items-center gap-2 px-3 py-2.5 text-left text-sm sm:px-4","aria-expanded":"files"===c,children:[(0,J.jsx)(v0,{size:16}),"Files (State)",(0,J.jsx)("span",{className:"h-4 min-w-4 rounded-full bg-[var(--brand-solid)] px-0.5 text-center text-[10px] leading-[16px] text-[var(--brand-foreground)]",children:Object.keys(D).length})]}):null,u=(0,J.jsxs)("button",{type:"button",onClick:()=>d(e=>"workspace"===e?null:"workspace"),className:"flex flex-shrink-0 cursor-pointer items-center gap-2 px-3 py-2.5 text-left text-sm sm:px-4","aria-expanded":"workspace"===c,"aria-label":"Open workspace",children:[(0,J.jsx)(v1,{size:16,"aria-hidden":"true"}),(0,J.jsx)("span",{children:"Workspace"})]}),(0,J.jsxs)("div",{className:"flex items-center",children:[(0,J.jsx)("div",{className:"min-w-0 flex-1",children:s}),l,u]}))}),c&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"sticky top-0 flex items-stretch bg-sidebar text-sm",children:[ew&&(0,J.jsx)("button",{type:"button",className:"py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"tasks"===e?null:"tasks"),"aria-expanded":"tasks"===c,children:"Tasks"}),eE&&(0,J.jsxs)("button",{type:"button",className:"inline-flex items-center gap-2 py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"files"===e?null:"files"),"aria-expanded":"files"===c,children:["Files (State)",(0,J.jsx)("span",{className:"h-4 min-w-4 rounded-full bg-[var(--brand-solid)] px-0.5 text-center text-[10px] leading-[16px] text-[var(--brand-foreground)]",children:Object.keys(D).length})]}),(0,J.jsx)("button",{type:"button",className:"inline-flex items-center gap-2 py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"workspace"===e?null:"workspace"),"aria-expanded":"workspace"===c,children:"Workspace"}),(0,J.jsx)("button",{"aria-label":"Close",className:"flex-1",onClick:()=>d(null)})]}),(0,J.jsxs)("div",{ref:p,className:"px-3 sm:px-4",children:["tasks"===c&&Object.entries(e_).filter(([e,t])=>t.length>0).map(([e,t])=>(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:{pending:"Pending",in_progress:"In Progress",completed:"Completed"}[e]}),(0,J.jsx)("div",{className:"grid grid-cols-[auto_1fr] gap-3 rounded-sm p-1 pl-0 text-sm",children:t.map((t,r)=>(0,J.jsxs)(Q.Fragment,{children:[Te(t.status,"mt-0.5"),(0,J.jsx)("span",{className:"break-words text-inherit",children:t.content})]},`${e}_${t.id}_${r}`))})]},e)),"files"===c&&(0,J.jsx)("div",{className:"mb-6",children:(0,J.jsx)(kV,{files:D,setFiles:j,editDisabled:!0===F||void 0!==U})}),"workspace"===c&&(0,J.jsx)("div",{className:"mb-6 pt-2",children:(0,J.jsx)(k8,{})})]})]})]}),E&&(0,J.jsxs)("div",{"aria-live":"polite",className:"flex items-center justify-between gap-3 border-b border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100",children:[(0,J.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,J.jsx)(v3,{className:"size-3.5 shrink-0","aria-hidden":"true"}),"Tool actions will run without review."]}),(0,J.jsx)("button",{type:"button",onClick:es,className:"shrink-0 rounded px-2 py-1 font-semibold transition-colors hover:bg-amber-200 focus-visible:ring-2 focus-visible:ring-amber-700 dark:hover:bg-amber-900",children:"Turn Off"})]}),(et||Z>0)&&(0,J.jsxs)("div",{className:"flex items-center gap-1.5 border-t border-border px-3 py-1.5 text-xs text-muted-foreground",children:[et&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v4,{className:"size-3.5 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"font-medium text-foreground",children:et.name}),et.provider&&(0,J.jsxs)("span",{children:["· ",et.provider]})]}),Z>0&&(0,J.jsxs)("button",{type:"button",onClick:t,title:`${Z} background agent${1===Z?"":"s"} running — click to view`,"aria-label":`${Z} background agent${1===Z?"":"s"} running — view`,className:"ml-auto flex shrink-0 items-center gap-1.5 rounded px-1.5 py-0.5 font-medium text-[var(--brand)] transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,J.jsx)("span",{className:"size-2 animate-pulse rounded-full bg-[var(--color-warning)]","aria-hidden":"true"}),Z," agent",1===Z?"":"s"]})]}),(0,J.jsxs)("form",{onSubmit:ed,className:"flex flex-col",children:[b.length>0&&(0,J.jsx)("div",{"aria-label":"Attached files",className:"flex flex-wrap gap-2 border-b border-border px-3 py-2",children:b.map(e=>(0,J.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1 text-xs text-foreground",children:[(0,J.jsx)(v0,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)("span",{className:"max-w-48 truncate",title:e.path,children:e.name}),(0,J.jsx)("button",{type:"button",onClick:()=>eu(e.path),"aria-label":`Remove ${e.name} from this message`,title:`Remove ${e.name} from this message`,className:"rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(rs,{className:"size-3.5","aria-hidden":"true"})})]},e.path))}),(0,J.jsx)("textarea",{ref:f,value:h,onChange:e=>g(e.target.value),onKeyDown:ep,"aria-label":"Message",disabled:ea,placeholder:ea?"Respond to the request above to continue…":F?"Researching…":"Ask EvoScientist anything…",className:"font-inherit field-sizing-content flex-1 resize-none border-0 bg-transparent px-3.5 pb-2.5 pt-3 text-sm leading-6 text-primary outline-none placeholder:text-tertiary disabled:cursor-not-allowed sm:px-4",rows:1}),(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 sm:p-2.5",children:[(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsx)("input",{ref:m,type:"file",multiple:!0,onChange:el,disabled:ei||v,className:"hidden"}),(0,J.jsx)("button",{type:"button",onClick:()=>m.current?.click(),disabled:ei||v,"aria-label":"Upload files to workspace",title:"Upload files to workspace (max 50 MB each)",className:"inline-flex size-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:(0,J.jsx)(v5,{className:"size-4","aria-hidden":"true"})}),(0,J.jsxs)("button",{type:"button",onClick:()=>E?es():k(!0),"aria-pressed":E,title:"Auto-approve all tool actions in this conversation",className:rZ("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium transition-colors",E?"bg-amber-600 text-white hover:bg-amber-700":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[(0,J.jsx)(v2,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden min-[360px]:inline",children:E?"Auto-approve On":"Auto-approve"})]})]}),(0,J.jsx)("div",{className:"flex justify-end gap-2",children:(0,J.jsx)(na,{type:F?"button":"submit",variant:F?"destructive":"default",onClick:F?B:ed,disabled:!F&&(ei||v||!h.trim()),"aria-label":F?"Stop generating":"Send message",children:F?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(vK,{size:14}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"Stop"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(vY,{size:18}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"Send"})]})})})]})]})]})})]})});Tt.displayName="ChatInterface";let Tr=ro("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),Tn=ro("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]),Ta=ro("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Ti=Q.default.memo(({skill:e,onClose:t})=>{let[r,n]=(0,Q.useState)(null),[a,i]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null);if((0,Q.useEffect)(()=>{if(!e)return;let t=!1;return n(null),s(null),i(!0),fetch(`/api/skills/detail?name=${encodeURIComponent(e.name)}`).then(async e=>{let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`Failed to load (${e.status})`);return t}).then(e=>{t||n(e)}).catch(e=>{t||s(e.message??"Failed to load skill detail.")}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),!e)return null;let l=r?.title??e.title,u=r?.version??e.version,c=r?.description??e.description,d=r?.installed??e.installed,p=r?.body;return(0,J.jsx)(rK,{open:!0,onOpenChange:t,children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:l}),(0,J.jsxs)("div",{className:"mb-3 flex items-start gap-3 border-b border-border pb-4",children:[(0,J.jsx)(a6,{className:"mt-1 size-6 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("div",{className:"min-w-0 flex-1",children:(0,J.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,J.jsx)("h2",{className:"break-words text-lg font-semibold",children:l}),u&&(0,J.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["v",u]}),null!=e.fileCount&&(0,J.jsxs)("span",{className:"text-xs text-muted-foreground",children:["· ",e.fileCount," file",1===e.fileCount?"":"s"]}),d&&(0,J.jsxs)("span",{className:"bg-[var(--brand)]/10 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-[var(--brand)]",children:[(0,J.jsx)(Ta,{className:"size-3","aria-hidden":"true"}),"Installed"]})]})})]}),(0,J.jsx)(ij,{className:"min-h-0 flex-1",children:(0,J.jsxs)("div",{className:"pr-3",children:[(0,J.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-foreground",children:c||"No description."}),(0,J.jsx)("div",{className:"mt-4 border-t border-border pt-4",children:a?(0,J.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading skill contents…"]}):o?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:o}):p?(0,J.jsx)(S2,{content:p}):(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No additional contents."})})]})})]})})});function To(){let[e,t]=(0,Q.useState)([]),[r,n]=(0,Q.useState)([]),[a,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)({}),[p,f]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async(e=!1)=>{i(!0),u(null),s(null);let[r,a]=await Promise.allSettled([fetch(`/api/skills/catalog${e?"?refresh=1":""}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load catalog");return t.skills??[]}),fetch("/api/skills").then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load skills");return t.skills??[]})]),o="fulfilled"===r.status?r.value:[];if("rejected"===r.status&&s(r.reason instanceof Error?r.reason.message:"Failed to load the official catalog."),t(o),"fulfilled"===a.status){let e=new Set(o.map(e=>e.name));n(a.value.filter(t=>!e.has(t.name)))}else n([]),u(a.reason instanceof Error?a.reason.message:"Failed to load installed skills.");i(!1)},[]);(0,Q.useEffect)(()=>{g()},[g]);let b=async(e,r="install")=>{d(t=>({...t,[e]:r})),u(null);try{let r=await fetch("/api/skills/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}),n=await r.json();if(!r.ok)throw Error(n.error||"Failed to install");t(t=>t.map(t=>t.name===e?{...t,installed:!0,updateAvailable:!1,installedVersion:t.latestVersion??t.installedVersion}:t))}catch(e){u(e instanceof Error?e.message:`Failed to ${r}`)}finally{d(t=>{let r={...t};return delete r[e],r})}},y=async(e,r)=>{d(t=>({...t,[e]:"uninstall"})),u(null);try{let a=await fetch(`/api/skills?name=${encodeURIComponent(e)}`,{method:"DELETE"});if(!a.ok){let e=await a.json();throw Error(e.error||"Failed to uninstall")}r?t(t=>t.map(t=>t.name===e?{...t,installed:!1}:t)):n(t=>t.filter(t=>t.name!==e))}catch(e){u(e instanceof Error?e.message:"Failed to uninstall")}finally{d(t=>{let r={...t};return delete r[e],r})}},v=async()=>{m&&(h(null),await y(m.name,m.isCatalog))};return(0,J.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,J.jsxs)("div",{className:"mx-auto max-w-[960px] px-4 py-5 sm:px-5 sm:py-6",children:[(0,J.jsxs)("header",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,J.jsxs)("div",{children:[(0,J.jsx)("h2",{className:"text-xl font-semibold sm:text-2xl",children:"Research Skills"}),(0,J.jsxs)("p",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:["Install official skills from the"," ",(0,J.jsx)("a",{href:"https://github.com/EvoScientist/EvoSkills",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"EvoSkills"})," ","catalog, or remove ones you don't need."]})]}),(0,J.jsx)("button",{type:"button",onClick:()=>g(!0),disabled:a,"aria-label":"Refresh",className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(Tr,{className:a?"size-4 animate-spin":"size-4","aria-hidden":"true"})})]}),l&&(0,J.jsx)("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:l}),a?(0,J.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground","aria-live":"polite",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading skills…"]}):(0,J.jsxs)("div",{className:"space-y-6",children:[(0,J.jsxs)("section",{children:[(0,J.jsx)("h3",{className:"mb-2.5 text-xs font-semibold uppercase tracking-wider text-tertiary",children:"Official catalog"}),o?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:o}):0===e.length?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No skills found in the catalog."}):(0,J.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",children:e.map(e=>(0,J.jsx)(Ts,{title:e.title,description:e.description,meta:`${e.fileCount} file${1===e.fileCount?"":"s"}`,installed:e.installed,installedVersion:e.installedVersion,latestVersion:e.latestVersion,updateAvailable:e.updateAvailable,busy:c[e.name],onOpen:()=>f({name:e.name,title:e.title,description:e.description,version:e.installed?e.installedVersion:e.latestVersion,fileCount:e.fileCount,installed:e.installed}),onInstall:()=>b(e.name),onUpdate:()=>b(e.name,"update"),onUninstall:()=>h({name:e.name,title:e.title,isCatalog:!0})},e.name))})]}),r.length>0&&(0,J.jsxs)("section",{children:[(0,J.jsx)("h3",{className:"mb-2.5 text-xs font-semibold uppercase tracking-wider text-tertiary",children:"Other installed skills"}),(0,J.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",children:r.map(e=>(0,J.jsx)(Ts,{title:e.title,description:e.description,installed:!0,busy:c[e.name],onOpen:()=>f({name:e.name,title:e.title,description:e.description,installed:!0}),onUninstall:()=>h({name:e.name,title:e.title,isCatalog:!1})},e.name))})]})]})]}),(0,J.jsx)(Ti,{skill:p,onClose:()=>f(null)}),(0,J.jsx)(rK,{open:null!==m,onOpenChange:e=>{e||h(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Uninstall skill?"}),(0,J.jsxs)(r2,{children:["“",m?.title??m?.name,"” will be removed from this Web UI. You can install it again later."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,J.jsx)(na,{onClick:v,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Uninstall"})]})]})})]})}function Ts({title:e,description:t,meta:r,installed:n,installedVersion:a,latestVersion:i,updateAvailable:o,busy:s,onOpen:l,onInstall:u,onUpdate:c,onUninstall:d}){let p=n?a&&`v${a}`:i&&`v${i}`;return(0,J.jsxs)("div",{className:"flex flex-col rounded-lg border border-border bg-card p-3",children:[(0,J.jsxs)("button",{type:"button",onClick:l,className:"-m-1 flex items-start gap-2.5 rounded-md p-1 text-left transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring",title:"View details",children:[(0,J.jsx)(a6,{className:"mt-0.5 size-5 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,J.jsx)("h3",{className:"break-words text-lg font-medium leading-tight",children:e}),p&&(0,J.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:p}),r&&(0,J.jsxs)("span",{className:"shrink-0 text-xs text-muted-foreground",children:["· ",r]})]}),(0,J.jsx)("p",{className:"mt-1 line-clamp-2 text-sm leading-6 text-muted-foreground",children:t||"No description."})]})]}),(0,J.jsxs)("div",{className:"mt-2.5 flex items-center justify-end gap-2",children:[n&&o&&(0,J.jsxs)("button",{type:"button",onClick:c,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",title:i?`Update to v${i}`:"Update",children:["update"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(Tn,{className:"size-3.5","aria-hidden":"true"}),"update"===s?"Updating…":i?`Update → v${i}`:"Update"]}),n?(0,J.jsxs)("button",{type:"button",onClick:d,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:["uninstall"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(a8,{className:"size-3.5","aria-hidden":"true"}),"uninstall"===s?"Removing…":"Uninstall"]}):(0,J.jsxs)("button",{type:"button",onClick:u,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:["install"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(k$,{className:"size-3.5","aria-hidden":"true"}),"install"===s?"Installing…":"Install"]})]})]})}Ti.displayName="SkillDetailDialog";let Tl=ro("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Tu=ro("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Tc={json:"json",yaml:"yaml",yml:"yaml",csv:"text",tsv:"text",log:"text",txt:"text",tex:"latex",bib:"latex",rst:"markdown"},Td=["Core memory","Profile","Projects","Evolution reports"];function Tp(e){let t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}function Tf(e){return e.split("/").pop()||e}function Tm(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}let Th="evoscientist-memory-list-width";function Tg(e,t){return Math.min(Math.max(e,200),t?Math.max(280,t.clientWidth-360):640)}function Tb(){var e;let t,[r,n]=(0,Q.useState)(null),[a,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(null),[p,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,b]=(0,Q.useState)(!1),[y,v]=(0,Q.useState)(""),[_,w]=(0,Q.useState)(!1),[E,x]=(0,Q.useState)(!1),[S,k]=(0,Q.useState)(!1),[T,A]=(0,Q.useState)(""),[N,I]=(0,Q.useState)(!1),[C,R]=(0,Q.useState)(null),[O,L]=(0,Q.useState)(!1),[P,D]=(0,Q.useState)(!1),[M,j]=(0,Q.useState)(!1),F=(0,Q.useRef)(!1),$=(0,Q.useRef)(0),U=(0,Q.useRef)(null),z=function(){let[e,t]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),r=()=>t(e.matches);return r(),e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}(),B=(0,Q.useRef)(null),H=(0,Q.useRef)(null),G=(0,Q.useRef)(null),[V,q]=(0,Q.useState)(()=>{let e=Number(window.localStorage.getItem(Th));return Number.isFinite(e)&&e>=200?e:256});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(Th,String(V))}catch{}},[V]);let W=(0,Q.useCallback)(e=>{if(B.current=e,G.current?.disconnect(),G.current=null,e&&"u">typeof ResizeObserver){let t=new ResizeObserver(()=>{window.matchMedia("(min-width: 768px)").matches&&q(t=>Tg(t,e))});t.observe(e),G.current=t}},[]);(0,Q.useEffect)(()=>()=>H.current?.(),[]);let Z=(0,Q.useCallback)(e=>{e.preventDefault(),H.current?.();let t=e.clientX,r=new AbortController,n=()=>{r.abort(),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select"),H.current=null},a={signal:r.signal};window.addEventListener("pointermove",e=>{q(Tg(V+(e.clientX-t),B.current))},a),window.addEventListener("pointerup",n,a),window.addEventListener("pointercancel",n,a),window.addEventListener("blur",n,a),document.body.style.cursor="col-resize",document.body.style.userSelect="none",H.current=n},[V]),K=(0,Q.useCallback)(async()=>{i(!0),s(null);try{let e=await fetch("/api/memory"),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load memory.");n(t);let r=t.entries.reduce((e,t)=>t.mtime>e?t.mtime:e,0);r>0&&uv(r)}catch(e){s(e instanceof Error?e.message:"Failed to load memory.")}finally{i(!1)}},[]);(0,Q.useEffect)(()=>{K()},[K]);let[Y,X]=(0,Q.useState)(()=>Date.now());(0,Q.useEffect)(()=>{let e=setInterval(()=>X(Date.now()),6e4);return()=>clearInterval(e)},[]);let ee=(0,Q.useMemo)(()=>{let e=r?.entries??[],t=new Map;for(let r of e){let e=function(e){let t=e.split("/");return"profile"===t[0]?"projects"===t[1]?"Projects":"Profile":"evolution-reports"===t[0]?"Evolution reports":1===t.length?"Core memory":t[0]}(r.path);(t.get(e)??t.set(e,[]).get(e)).push(r)}return[...t.keys()].sort((e,t)=>{let r=Td.indexOf(e),n=Td.indexOf(t);return -1!==r||-1!==n?(-1===r?99:r)-(-1===n?99:n):e.localeCompare(t)}).map(e=>({name:e,files:t.get(e).sort((e,t)=>e.path.localeCompare(t.path))}))},[r]),et=(0,Q.useCallback)(async e=>{let t=++$.current;u(e),b(!1),d(null),h(null),f(!0);try{let r=await fetch(`/api/memory?path=${encodeURIComponent(e)}`),n=await r.json();if(t!==$.current)return;if(!r.ok)throw Error(n.error||"Failed to open file.");d(n)}catch(e){if(t!==$.current)return;h(e instanceof Error?e.message:"Failed to open file.")}finally{t===$.current&&f(!1)}},[]);(0,Q.useEffect)(()=>{if(F.current||l)return;let e=ee[0]?.files[0];e&&(F.current=!0,et(e.path))},[ee,l,et]);let er=async()=>{if(!l)return;let e=$.current;w(!0),h(null);try{let t=await fetch("/api/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:l,content:y})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to save.");e===$.current&&(d(r),b(!1)),K()}catch(t){e===$.current&&h(t instanceof Error?t.message:"Failed to save.")}finally{w(!1)}},en=async()=>{if(!l)return;let e=$.current;D(!0);try{let t=await fetch(`/api/memory?path=${encodeURIComponent(l)}`,{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to delete.")}e===$.current&&(u(null),d(null),b(!1)),L(!1),K()}catch(t){e===$.current&&h(t instanceof Error?t.message:"Failed to delete.")}finally{D(!1)}},ea=async()=>{c&&await kl(c.content)&&(x(!0),setTimeout(()=>x(!1),1500))},ei=async()=>{let e=T.trim();if(!e)return void R("Enter a file name.");/\.[A-Za-z0-9]+$/.test(e)||(e+=".md"),I(!0),R(null);try{let t=await fetch("/api/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:`# ${Tf(e).replace(/\.[^.]+$/,"")}
|
|
74
74
|
|
|
75
|
-
`})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to create file.");k(!1),A(""),await K(),await et(r.path),v(r.content),b(!0)}catch(e){R(e instanceof Error?e.message:"Failed to create file.")}finally{I(!1)}},eo=g&&null!=c&&y!==c.content,es=e=>{eo?(U.current=e,j(!0)):e()},el=l&&(t=(e=Tf(l)).lastIndexOf("."))>=0?e.slice(t+1).toLowerCase():"";return(0,J.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,J.jsxs)("header",{className:"flex flex-shrink-0 items-start justify-between gap-3 border-b border-border px-4 py-3 sm:px-5",children:[(0,J.jsxs)("div",{className:"min-w-0",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsx)(a0,{className:"size-5 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("h2",{className:"text-xl font-semibold",children:"EvoMemory"})]}),(0,J.jsxs)("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:["EvoScientist's"," ",(0,J.jsx)("span",{className:"font-medium text-[var(--brand)]",children:"self-evolving memory system"})," ","— it continuously learns and refines what it knows about you, your research taste, and lessons from past experiments, updating itself after every turn. View or edit it directly."]})]}),(0,J.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-1.5",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{A(""),R(null),k(!0)},"aria-label":"New memory file",title:"New memory file",className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1.5 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",children:[(0,J.jsx)(Tu,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"New"})]}),(0,J.jsx)("button",{type:"button",onClick:K,disabled:a,"aria-label":"Refresh",className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(Tr,{className:a?"size-4 animate-spin":"size-4","aria-hidden":"true"})})]})]}),o?(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:o})}):a&&!r?(0,J.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading memory…"]}):r&&!r.exists||r&&0===r.entries.length?(0,J.jsx)(Ty,{dir:r.dir}):(0,J.jsxs)("div",{ref:W,className:"flex min-h-0 flex-1",children:[(0,J.jsx)("aside",{className:rZ("w-full flex-col md:flex md:flex-shrink-0",l?"hidden md:flex":"flex"),style:z?{width:V}:void 0,children:(0,J.jsx)(ij,{className:"h-0 flex-1",children:(0,J.jsxs)("div",{className:"p-1.5",children:[ee.map(e=>(0,J.jsxs)("div",{className:"mb-2.5",children:[(0,J.jsx)("h4",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:e.name}),(0,J.jsx)("div",{className:"flex flex-col",children:e.files.map(e=>{var t;let r=Tp(e.path),n=e.path===l,a=(t=e.mtime,t>0&&Y-t<6e5),i=function(e,t){if(!e)return"";let r=Math.max(0,Math.round((t-e)/1e3));if(r<45)return"just now";let n=Math.round(r/60);if(n<60)return`${n}m ago`;let a=Math.round(n/60);return a<24?`${a}h ago`:`${Math.round(a/24)}d ago`}(e.mtime,Y);return(0,J.jsxs)("button",{type:"button",onClick:()=>{es(()=>et(e.path))},className:rZ("flex items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors focus-visible:ring-2 focus-visible:ring-ring",n?"bg-accent":"hover:bg-accent/60"),"aria-current":n,children:[a?(0,J.jsx)("span",{className:"mt-1.5 size-2 shrink-0 rounded-full bg-[var(--brand)]",title:"Recently updated","aria-label":"Recently updated"}):(0,J.jsx)(kF,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,J.jsx)("span",{className:rZ("block truncate text-sm font-medium",a&&"text-[var(--brand)]"),children:Tf(e.path)}),(0,J.jsxs)("span",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r&&(0,J.jsx)("span",{className:"truncate",children:r}),(0,J.jsx)("span",{className:"shrink-0 tabular-nums",children:Tm(e.size)}),i&&(0,J.jsxs)("span",{className:"shrink-0 tabular-nums",children:["· ",i]})]})]})]},e.path)})})]},e.name)),r?.truncated&&(0,J.jsxs)("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:["Showing the first ",r.entries.length," files."]})]})})}),(0,J.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize file list",onPointerDown:Z,className:"relative hidden w-px shrink-0 cursor-col-resize bg-border transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 hover:bg-[var(--brand)] md:block"}),(0,J.jsx)("section",{className:rZ("min-w-0 flex-1 flex-col",l?"flex":"hidden md:flex"),children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"flex flex-shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2 sm:px-4",children:[(0,J.jsx)("button",{type:"button",onClick:()=>{es(()=>{u(null),d(null),b(!1)})},"aria-label":"Back to list",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring md:hidden",children:(0,J.jsx)(Tl,{className:"size-4","aria-hidden":"true"})}),(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsx)("p",{className:"truncate text-sm font-medium",children:Tf(l)}),c&&(0,J.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[Tp(l)&&`${Tp(l)} \xb7 `,Tm(c.size),c.mtime?` \xb7 ${function(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(e))}catch{return""}}(c.mtime)}`:""]})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:g?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{es(()=>b(!1))},disabled:_,"aria-label":"Cancel editing",children:[(0,J.jsx)(kX,{className:"mr-1 size-4"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 px-3",onClick:er,disabled:_||!eo,"aria-label":"Save memory file",children:[_?(0,J.jsx)(a1,{className:"mr-1 size-4 animate-spin"}):(0,J.jsx)(kU,{className:"mr-1 size-4"}),_?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:ea,disabled:!c,"aria-label":E?"Copied memory content":"Copy memory content",title:E?"Copied memory content":"Copy memory content",children:E?(0,J.jsx)(ln,{className:"size-4"}):(0,J.jsx)(ks,{className:"size-4"})}),(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{c&&(v(c.content),b(!0))},disabled:!c,"aria-label":"Edit memory file",children:[(0,J.jsx)(a4,{className:"mr-1 size-4"}),"Edit"]}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>L(!0),disabled:!c,"aria-label":"Delete memory file",title:"Delete memory file",children:(0,J.jsx)(a8,{className:"size-4"})})]})})]}),m&&(0,J.jsx)("p",{role:"alert",className:"px-4 py-2 text-sm text-destructive",children:m}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:p?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):g?(0,J.jsx)("textarea",{value:y,onChange:e=>v(e.target.value),spellCheck:!1,"aria-label":"Memory file content",className:"h-full w-full resize-none bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"Write memory…"}):c?(0,J.jsx)(ij,{className:"h-full",children:(0,J.jsx)("div",{className:"mx-auto max-w-[780px] px-4 py-4 sm:px-6",children:0===c.content.trim().length?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"This file is empty."}):"md"===el||"markdown"===el?(0,J.jsx)(S2,{content:c.content}):(0,J.jsx)(S0,{language:Tc[el]||"text",style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.85rem"},wrapLongLines:!0,children:c.content})})}):null})]}):(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a memory file to view or edit."})})})]}),(0,J.jsx)(rK,{open:S,onOpenChange:e=>{N||k(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"New memory file"}),(0,J.jsxs)(r2,{children:["Create a markdown file in the memory directory. Use a path like"," ",(0,J.jsx)("code",{className:"font-mono text-xs",children:"notes/idea.md"})," to nest it."]})]}),(0,J.jsx)(nu,{name:"memory-file-path",autoComplete:"off",spellCheck:!1,value:T,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ei())},placeholder:"notes/research-idea.md…",disabled:N,"aria-invalid":!!C||void 0,"aria-describedby":C?"new-memory-error":void 0}),C&&(0,J.jsx)("p",{id:"new-memory-error",role:"alert",className:"text-sm text-destructive",children:C}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>k(!1),disabled:N,children:"Cancel"}),(0,J.jsx)(na,{onClick:ei,disabled:N||!T.trim(),children:N?"Creating…":"Create"})]})]})}),(0,J.jsx)(rK,{open:O,onOpenChange:e=>{P||L(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete memory file?"}),(0,J.jsx)(r2,{children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("code",{children:l}),"will be permanently deleted. This can't be undone."]}):"This memory file will be permanently deleted."})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>L(!1),disabled:P,children:"Cancel"}),(0,J.jsx)(na,{onClick:en,disabled:P||!l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:P?"Deleting…":"Delete"})]})]})}),(0,J.jsx)(rK,{open:M,onOpenChange:e=>{e||(U.current=null,j(!1))},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",l?Tf(l):"this file","” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>{U.current=null,j(!1)},children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{let e=U.current;U.current=null,j(!1),b(!1),e?.()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}function Ty({dir:e}){return(0,J.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,J.jsx)(a0,{className:"size-10 text-muted-foreground/40","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm font-medium",children:"No memory yet"}),(0,J.jsxs)("p",{className:"max-w-md text-sm text-muted-foreground",children:["EvoScientist will write what it learns here as you work together. Memory lives at ",(0,J.jsx)("code",{className:"break-all font-mono text-xs",children:e}),"."]})]})}let Tv=ro("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),T_=ro("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var Tw=e.i(21675);function TE(){let{resolvedTheme:e,setTheme:t}=(0,Tw.useTheme)(),[r,n]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>n(!0),[]);let a=r&&"dark"===e;return(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-8 sm:size-9",onClick:()=>t(a?"light":"dark"),"aria-label":a?"Switch to light mode":"Switch to dark mode",title:a?"Switch to light mode":"Switch to dark mode",children:a?(0,J.jsx)(Tv,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(T_,{className:"size-5","aria-hidden":"true"})})}let Tx={checking:{dot:"bg-[var(--color-warning)]",label:"Connecting…",pulse:!0},online:{dot:"bg-[var(--color-success)]",label:"Connected",pulse:!1},offline:{dot:"bg-[var(--color-error)]",label:"Offline",pulse:!1}};function TS(e){return e.trim().replace(/\/+$/,"")}async function Tk(e){let t=new AbortController,r=setTimeout(()=>t.abort(),4e3);try{return(await fetch(`${e}/info`,{signal:t.signal,cache:"no-store"})).ok}catch{return!1}finally{clearTimeout(r)}}function TT({deploymentUrl:e,onReconnect:t}){let[r,n]=(0,Q.useState)("checking"),[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useRef)(!0),c=(0,Q.useRef)(null),d=(0,Q.useCallback)(async t=>{let r=TS(e);try{let e=await fetch("/api/evosci-config",{cache:"no-store"}),n=await e.json().catch(()=>null),a=n?.deploymentUrl?TS(n.deploymentUrl):"";if(t!==l.current||!u.current)return;if(!a||a===r)return void s(null);let i=await Tk(a);if(t!==l.current||!u.current)return;s(i?a:null)}catch{t===l.current&&u.current&&s(null)}},[e]),p=(0,Q.useCallback)(async()=>{let t=++l.current,r=TS(e);if(!r){t===l.current&&u.current&&(i(null),n("offline"),s(null));return}c.current?.abort();let a=new AbortController;c.current=a;let o=setTimeout(()=>a.abort(),4e3);try{let e=await fetch(`${r}/info`,{signal:a.signal,cache:"no-store"});if(t!==l.current||!u.current)return;if(!e.ok){n("offline"),d(t);return}let o=await e.json().catch(()=>null);if(t!==l.current||!u.current)return;i(o),n("online"),s(null)}catch{t===l.current&&u.current&&(n("offline"),d(t))}finally{clearTimeout(o)}},[e,d]);(0,Q.useEffect)(()=>{u.current=!0,n("checking"),p();let e=setInterval(()=>{document.hidden||p()},1e4),t=()=>p(),r=()=>{document.hidden||p()};return window.addEventListener("focus",t),window.addEventListener("online",t),document.addEventListener("visibilitychange",r),()=>{u.current=!1,c.current?.abort(),clearInterval(e),window.removeEventListener("focus",t),window.removeEventListener("online",t),document.removeEventListener("visibilitychange",r)}},[p]);let f=Tx[r],m="online"===r?`Connected to ${e}${a?.version?` \xb7 langgraph ${a.version}`:""}`:"offline"===r?`Can't reach the backend at ${e}. Is "EvoSci deploy" running? Click to retry.`:`Checking connection to ${e}…`;return(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:p,title:m,"aria-label":m,className:"h-8 gap-1.5 px-2 text-xs font-normal text-muted-foreground",children:[(0,J.jsx)("span",{className:`size-2 shrink-0 rounded-full ${f.dot} ${f.pulse?"animate-pulse":""}`,"aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:f.label})]}),"offline"===r&&null!==o&&void 0!==t&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:()=>{o&&(s(null),n("checking"),t?.(o))},title:`Backend detected at ${o}. Click to reconnect.`,"aria-label":`Reconnect to detected backend ${o}`,className:"h-8 gap-1 px-2 text-xs font-medium text-[var(--brand)] hover:text-[var(--brand)]",children:["Reconnect"," ",(0,J.jsx)("span",{className:"tabular-nums",children:o?function(e){try{let t=new URL(e),r="127.0.0.1"===t.hostname||"localhost"===t.hostname||"0.0.0.0"===t.hostname,n=t.port||("https:"===t.protocol?"443":"80");return r?`:${n}`:`${t.hostname}:${n}`}catch{return e}}(o):""})]})]})}let TA=ro("bell-ring",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]),TN=ro("corner-up-left",[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]);function TI(e){let t="";for(let r of e)if("human"===r.type){let e=vB(r).trim();if(e){t=e;break}}return{prompt:t,steps:function(e){let t=[];for(let r of e)if("ai"===r.type){let e=vz(r.content).trim();for(let n of(e&&t.push({kind:"text",text:e}),function(e){let t=[];if(Array.isArray(e.tool_calls)&&e.tool_calls.length>0){for(let r of e.tool_calls)t.push({id:r.id??"",name:r.name??"tool",args:r.args&&"object"==typeof r.args?r.args:{}});return t}let r=e.additional_kwargs?.tool_calls;if(Array.isArray(r))for(let e of r){let r={},n=e.function?.arguments;if(n&&"object"==typeof n)r=n;else if("string"==typeof n)try{let e=JSON.parse(n);e&&"object"==typeof e&&(r=e)}catch{r={input:n}}t.push({id:e.id??"",name:e.function?.name??"tool",args:r})}return t}(r)))t.push({kind:"tool_call",id:n.id,name:n.name,args:n.args})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()});return t}(e)}}function TC({status:e}){let t=kt[S3(e)];return(0,J.jsx)("span",{className:rZ("size-2 shrink-0 rounded-full",t.dot,t.pulse&&"animate-pulse"),"aria-hidden":"true"})}function TR({onReportToMainChat:e}){let t=nj(),[r]=ec("threadId"),{tasks:n,loaded:a,error:i,refresh:o}=kw(r),[s,l]=(0,Q.useState)(()=>Date.now()),[u,c]=(0,Q.useState)(null),[d,p]=(0,Q.useState)({}),f=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)({}),[g,b]=kR(r),[y,v]=(0,Q.useState)({}),[_,w]=(0,Q.useState)({}),[E,x]=(0,Q.useState)({}),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,Q.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let k=async e=>{let r=(y[e.task_id]??"").trim();if(r&&!_[e.task_id]){w(t=>({...t,[e.task_id]:!0})),x(t=>({...t,[e.task_id]:null}));try{let n=await t.runs.wait(e.thread_id,e.agent_name,{input:{messages:[{type:"human",content:r}]}});if(!S.current)return;v(t=>({...t,[e.task_id]:""}));let{prompt:a,steps:i}=TI(n?.messages??[]);p(t=>({...t,[e.task_id]:{loading:!1,error:null,prompt:a,steps:i}}))}catch{if(!S.current)return;x(t=>({...t,[e.task_id]:"Couldn't reach this agent — try again."}))}finally{S.current&&w(t=>({...t,[e.task_id]:!1}))}}};(0,Q.useEffect)(()=>{if(!u)return;let e=n.find(e=>e.task_id===u);if(!e)return;let r="running"===S3(e.liveStatus),a=[e.run_id,e.last_updated_at,e.endedAt].join(":");if(!r&&f.current.get(u)===a)return;let i=!1;return p(e=>({...e,[u]:{loading:!e[u],error:null,prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}})),(async()=>{try{let n=await t.threads.getState(e.thread_id);if(i)return;let{prompt:o,steps:s}=TI(n.values?.messages??[]);r||f.current.set(u,a),p(e=>({...e,[u]:{loading:!1,error:null,prompt:o,steps:s}}))}catch{if(i)return;f.current.delete(u),p(e=>({...e,[u]:{loading:!1,error:"Couldn't load this agent's steps.",prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}}))}})(),()=>{i=!0}},[u,n,t]);let T=(0,Q.useMemo)(()=>kn(n),[n]);return(0,J.jsxs)("div",{className:"flex h-full flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1 pb-2",children:[(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:T>0?`${T} running`:n.length>0?`${n.length} total`:"Background agents"}),(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{r&&(g||kI(r,n.filter(e=>kr(e.liveStatus)).map(S9)),b(!g))},"aria-pressed":g,"aria-label":`Auto-report ${g?"on":"off"}`,title:g?"Auto-report on: finished agents are sent to the main chat automatically":"Auto-report off: use each agent's “Notify main chat” button",className:rZ("inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",g?"bg-accent text-[var(--brand)]":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[(0,J.jsx)(TA,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"hidden min-[340px]:inline",children:["Auto-report ",g?"On":"Off"]})]}),(0,J.jsx)("button",{type:"button",onClick:o,"aria-label":"Refresh agents",title:"Refresh",className:"rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(kW,{className:"size-3.5","aria-hidden":"true"})})]})]}),i&&(0,J.jsx)("p",{className:"px-1 text-xs text-[var(--color-error)]",children:i}),!a&&(0,J.jsxs)("div",{className:"flex items-center gap-2 px-1 py-4 text-xs text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading…"]}),a&&0===n.length&&(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-10 text-center",children:[(0,J.jsx)(v6,{className:"size-9 text-muted-foreground/60","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No background agents yet."}),(0,J.jsx)("p",{className:"text-xs text-muted-foreground/80",children:"When EvoScientist delegates long tasks (writing, data analysis) they run in the background and show up here."})]}),(0,J.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto",children:n.map(t=>{var n;let a,i,o,l,p=kt[S3(t.liveStatus)],f=u===t.task_id,b=d[t.task_id];return(0,J.jsxs)("div",{className:"rounded-md border border-border bg-background",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>c(f?null:t.task_id),className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-expanded":f,children:[f?(0,J.jsx)(la,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}):(0,J.jsx)(ko,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)(TC,{status:t.liveStatus}),(0,J.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:S5[n=t.agent_name]??n}),(0,J.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[p.label,(a="running"===S3(t.liveStatus)?s:t.endedAt?Date.parse(t.endedAt):s,(i=function(e,t){if(!e)return"";let r=Date.parse(e);if(Number.isNaN(r))return"";let n=Math.max(0,Math.round((t-r)/1e3)),a=Math.floor(n/60);if(a>=60){let e=Math.floor(a/60);return`${e}h ${a%60}m`}return a>0?`${a}m ${n%60}s`:`${n}s`}(t.startedAt??t.created_at,a))?` \xb7 ${i}`:"")]})]}),f&&(0,J.jsxs)("div",{className:"border-t border-border px-2.5 py-2 text-xs",children:[b?.loading&&(0,J.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Loading steps…"]}),b?.error&&(0,J.jsx)("p",{className:"text-[var(--color-error)]",children:b.error}),b&&!b.loading&&!b.error&&(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[b.prompt&&(0,J.jsxs)("div",{children:[(0,J.jsx)("p",{className:"font-semibold text-foreground",children:"Task"}),(0,J.jsx)("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:b.prompt.length>600?b.prompt.slice(0,600)+"…":b.prompt})]}),(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-1 font-semibold text-foreground",children:["Steps"," ",(0,J.jsxs)("span",{className:"font-normal text-muted-foreground",children:["(",b.steps.length,")"]})]}),0===b.steps.length?(0,J.jsx)("p",{className:"text-muted-foreground",children:"No steps yet."}):(0,J.jsx)(S4,{steps:b.steps,compact:!0})]}),kr(t.liveStatus)&&(0,J.jsx)("div",{className:"mt-1 border-t border-border pt-2",children:g?(0,J.jsxs)("p",{className:"inline-flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,J.jsx)(TA,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),"Auto-report on · future completions notify the main chat"]}):(0,J.jsxs)("button",{type:"button",onClick:()=>(t=>{if(!e||!r)return void u_.toast.error("Open the conversation to notify the main agent.");let n=e(t,r);if("sent"===n){h(e=>({...e,[S9(t)]:!0})),u_.toast.success("Reported to the main chat.");return}if("duplicate"===n){h(e=>({...e,[S9(t)]:!0})),u_.toast.info("This result is already in the main chat.");return}u_.toast.error("wrong-thread"===n?"The active conversation changed — reopen this task and try again.":"Main chat is busy — try again when it's idle.")})(t),disabled:!e||!!m[S9(t)],title:e?"Send this result back to the main agent":"Open the conversation to notify the main agent",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[(0,J.jsx)(TN,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),m[S9(t)]?"Reported to main chat":"Notify main chat"]})}),(o="running"===S3(t.liveStatus),l=!!_[t.task_id],(0,J.jsxs)("div",{className:"mt-1 border-t border-border pt-2",children:[(0,J.jsx)("p",{className:"mb-1 text-[11px] text-muted-foreground",children:"Direct follow-up · Main chat is not notified"}),(0,J.jsxs)("form",{onSubmit:e=>{e.preventDefault(),k(t)},className:"flex items-center gap-1.5",children:[(0,J.jsx)("input",{type:"text",name:`agent-message-${t.task_id}`,autoComplete:"off",value:y[t.task_id]??"",onChange:e=>v(r=>({...r,[t.task_id]:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&(e.nativeEvent.isComposing||229===e.keyCode)&&e.preventDefault()},disabled:o||l,placeholder:o?"Agent is working…":"Send a direct follow-up…","aria-label":"Message this agent",className:"min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60"}),(0,J.jsx)("button",{type:"submit",disabled:o||l||!(y[t.task_id]??"").trim(),"aria-label":"Send",title:"Send to this agent",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md bg-[var(--brand-solid)] text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",children:l?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(vY,{className:"size-3.5","aria-hidden":"true"})})]}),E[t.task_id]&&(0,J.jsx)("p",{className:"mt-1 text-[var(--color-error)]",role:"status","aria-live":"polite",children:E[t.task_id]})]}))]})]})]},t.task_id)})})]})}function TO({onClose:e,onReportToMainChat:t}){let[r,n]=ec("inspectorTab"),a="agents"===r?"agents":"workspace";return(0,J.jsxs)("div",{className:"flex h-full flex-col border-l border-border bg-sidebar",children:[(0,J.jsxs)("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 border-b border-border px-2",children:[(0,J.jsxs)("div",{role:"tablist","aria-label":"Inspector",className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"workspace"===a,onClick:()=>n(null),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","workspace"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(v1,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Workspace"]}),(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"agents"===a,onClick:()=>n("agents"),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","agents"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(v6,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Agents"]})]}),(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-7",onClick:e,"aria-label":"Close inspector",title:"Close",children:(0,J.jsx)(rs,{className:"size-4","aria-hidden":"true"})})]}),"agents"===a?(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden p-3",children:(0,J.jsx)(TR,{onReportToMainChat:t})}):(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:(0,J.jsx)(k8,{})})]})}function TL({config:e,configDialogOpen:t,setConfigDialogOpen:r,handleSaveConfig:n}){let a=nj(),[,i]=ec("threadId"),[o,s]=ec("sidebar"),[l,u]=ec("view"),[c,d]=ec("inspector"),[,p]=ec("inspectorTab"),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(0),[b,y]=(0,Q.useState)(null),[v,_]=(0,Q.useState)(null),[w,E]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(null),k=(0,Q.useCallback)(async()=>{let t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e.assistantId),r=async()=>{if(t)return await a.assistants.get(e.assistantId);let r=await a.assistants.search({graphId:e.assistantId,limit:100}),n=r.find(e=>e.metadata?.created_by==="system")??r[0];if(!n)throw Error("No assistant found for this graph.");return n};for(let e=0;e<3;e+=1)try{y(await r());return}catch(t){if(e<2){await new Promise(e=>setTimeout(e,700));continue}console.warn("Couldn't resolve the EvoScientist assistant; addressing the graph by id instead. Is the backend running?",t)}y({assistant_id:e.assistantId,graph_id:e.assistantId,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),config:{},metadata:{},version:1,name:e.assistantId,context:{}})},[a,e.assistantId]);(0,Q.useEffect)(()=>{k()},[k]),(0,Q.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),t=()=>_(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,Q.useEffect)(()=>{!1===v&&o&&c&&d(null)},[c,v,d,o]);let T=(0,Q.useCallback)(()=>s(null),[s]),A=(0,Q.useCallback)(()=>{d(null),p(null)},[d,p]),N=(0,Q.useCallback)(()=>{o?s(null):(!1===v&&A(),s("1"))},[A,v,s,o]),I=(0,Q.useCallback)(()=>{c?A():(!1===v&&s(null),p(null),d("1"))},[A,c,v,d,p,s]),C=(0,Q.useCallback)(()=>{p("agents"),!1===v&&s(null),d("1")},[v,d,s,p]),R=l?o?"Hide navigation":"Show navigation":o?"Hide research":"Show research",O=(0,Q.useCallback)(()=>{k_(null,!1),i(null),u(null),E(e=>e+1)},[i,u]),L=(0,Q.useCallback)(async e=>{k_(null,!1),u(null),await i(e),E(e=>e+1)},[i,u]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:t,onOpenChange:r,onSave:n,initialConfig:e}),(0,J.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,J.jsxs)("header",{className:"flex h-14 items-center justify-between gap-2 border-b border-border px-2.5 sm:px-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2 sm:gap-3",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(ee.default,{src:"/evoscientist-logo.png",alt:"EvoScientist",width:28,height:28,className:"size-6 shrink-0",priority:!0}),o&&(0,J.jsx)("h1",{className:"truncate text-base font-semibold sm:text-lg",children:"EvoScientist"})]}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)(na,{variant:"ghost",size:"icon",onClick:N,"aria-label":R,className:"relative size-8",children:[o?(0,J.jsx)(nz,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nU,{className:"size-5","aria-hidden":"true"}),h>0&&(0,J.jsx)("span",{className:"absolute right-0 top-0 inline-flex min-h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] text-destructive-foreground",children:h})]}),!o&&(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:O,"aria-label":"New chat",className:"size-8",children:(0,J.jsx)(n$,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[(0,J.jsx)(TT,{deploymentUrl:e.deploymentUrl,onReconnect:t=>n({...e,deploymentUrl:t})}),(0,J.jsx)(TE,{}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:I,"aria-label":c?"Hide inspector":"Show workspace",title:c?"Hide inspector":"Show workspace",className:"size-8",children:c?(0,J.jsx)(nH,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nB,{className:"size-5","aria-hidden":"true"})}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:()=>r(!0),"aria-label":"Settings",title:"Settings",className:"size-8",children:(0,J.jsx)(nF,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[o&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close research",className:"absolute inset-0 bg-black/40",onClick:T}),(0,J.jsx)("aside",{"aria-label":l?"Navigation":"Research navigation",className:"relative z-10 h-full w-[min(19rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(uI,{onClose:T,onNewChat:O,onThreadSelect:async e=>{await L(e),T()},onMutateReady:e=>m(()=>e),onInterruptCountChange:g})})]}),c&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex justify-end md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close inspector",className:"absolute inset-0 bg-black/40",onClick:A}),(0,J.jsx)("aside",{"aria-label":"Inspector",className:"relative z-10 h-full w-[min(22rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(TO,{onClose:A,onReportToMainChat:x})})]}),(0,J.jsxs)(aJ,{direction:"horizontal",autoSaveId:"evoscientist-chat",children:[o&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n2,{id:"thread-history",order:1,defaultSize:23,minSize:18,className:"relative min-w-[260px]",children:(0,J.jsx)(uI,{onNewChat:O,onThreadSelect:L,onMutateReady:e=>m(()=>e),onInterruptCountChange:g})}),(0,J.jsx)(aQ,{})]}),(0,J.jsx)(n2,{id:"chat",className:"relative flex flex-col",order:2,children:"skills"===l?(0,J.jsx)(To,{}):"memory"===l?(0,J.jsx)(Tb,{}):(0,J.jsx)(vq,{activeAssistant:b,onHistoryRevalidate:()=>f?.(),children:(0,J.jsx)(Tt,{assistant:b,onShowAgents:C,onNotifyReady:e=>S(()=>e)})},w)}),c&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aQ,{}),(0,J.jsx)(n2,{id:"inspector",order:3,defaultSize:26,minSize:20,className:"relative min-w-[300px]",children:(0,J.jsx)(TO,{onClose:A,onReportToMainChat:x})})]})]})]})]})]})}function TP(){let[e,t]=(0,Q.useState)(null),[r,n]=(0,Q.useState)(!1),[a,i]=ec("assistantId");(0,Q.useEffect)(()=>{let e=ef();e?(t(e),a||i(e.assistantId)):n(!0)},[]),(0,Q.useEffect)(()=>{e&&!a&&i(e.assistantId)},[e,a,i]);let o=(0,Q.useCallback)(e=>{localStorage.setItem(ep,JSON.stringify(e)),t(e)},[]),s=e?.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return e?(0,J.jsx)(nM,{deploymentUrl:e.deploymentUrl,apiKey:s,children:(0,J.jsx)(TL,{config:e,configDialogOpen:r,setConfigDialogOpen:n,handleSaveConfig:o})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:r,onOpenChange:n,onSave:o}),(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsxs)("div",{className:"text-center",children:[(0,J.jsx)("h1",{className:"text-2xl font-bold",children:"Welcome to EvoScientist"}),(0,J.jsx)("p",{className:"mt-2 text-muted-foreground",children:"Configure your deployment to get started"}),(0,J.jsx)(na,{onClick:()=>n(!0),className:"mt-4",children:"Open Configuration"})]})})]})}e.s(["default",0,function(){return(0,J.jsx)(Q.Suspense,{fallback:(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"Loading…"})}),children:(0,J.jsx)(TP,{})})}],52683)}]);
|
|
75
|
+
`})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to create file.");k(!1),A(""),await K(),await et(r.path),v(r.content),b(!0)}catch(e){R(e instanceof Error?e.message:"Failed to create file.")}finally{I(!1)}},eo=g&&null!=c&&y!==c.content,es=e=>{eo?(U.current=e,j(!0)):e()},el=l&&(t=(e=Tf(l)).lastIndexOf("."))>=0?e.slice(t+1).toLowerCase():"";return(0,J.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,J.jsxs)("header",{className:"flex flex-shrink-0 items-start justify-between gap-3 border-b border-border px-4 py-3 sm:px-5",children:[(0,J.jsxs)("div",{className:"min-w-0",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsx)(a0,{className:"size-5 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("h2",{className:"text-xl font-semibold",children:"EvoMemory"})]}),(0,J.jsxs)("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:["EvoScientist's"," ",(0,J.jsx)("span",{className:"font-medium text-[var(--brand)]",children:"self-evolving memory system"})," ","— it continuously learns and refines what it knows about you, your research taste, and lessons from past experiments, updating itself after every turn. View or edit it directly."]})]}),(0,J.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-1.5",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{A(""),R(null),k(!0)},"aria-label":"New memory file",title:"New memory file",className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1.5 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",children:[(0,J.jsx)(Tu,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"New"})]}),(0,J.jsx)("button",{type:"button",onClick:K,disabled:a,"aria-label":"Refresh",className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(Tr,{className:a?"size-4 animate-spin":"size-4","aria-hidden":"true"})})]})]}),o?(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:o})}):a&&!r?(0,J.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading memory…"]}):r&&!r.exists||r&&0===r.entries.length?(0,J.jsx)(Ty,{dir:r.dir}):(0,J.jsxs)("div",{ref:W,className:"flex min-h-0 flex-1",children:[(0,J.jsx)("aside",{className:rZ("w-full flex-col md:flex md:flex-shrink-0",l?"hidden md:flex":"flex"),style:z?{width:V}:void 0,children:(0,J.jsx)(ij,{className:"h-0 flex-1",children:(0,J.jsxs)("div",{className:"p-1.5",children:[ee.map(e=>(0,J.jsxs)("div",{className:"mb-2.5",children:[(0,J.jsx)("h4",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:e.name}),(0,J.jsx)("div",{className:"flex flex-col",children:e.files.map(e=>{var t;let r=Tp(e.path),n=e.path===l,a=(t=e.mtime,t>0&&Y-t<6e5),i=function(e,t){if(!e)return"";let r=Math.max(0,Math.round((t-e)/1e3));if(r<45)return"just now";let n=Math.round(r/60);if(n<60)return`${n}m ago`;let a=Math.round(n/60);return a<24?`${a}h ago`:`${Math.round(a/24)}d ago`}(e.mtime,Y);return(0,J.jsxs)("button",{type:"button",onClick:()=>{es(()=>et(e.path))},className:rZ("flex items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors focus-visible:ring-2 focus-visible:ring-ring",n?"bg-accent":"hover:bg-accent/60"),"aria-current":n,children:[a?(0,J.jsx)("span",{className:"mt-1.5 size-2 shrink-0 rounded-full bg-[var(--brand)]",title:"Recently updated","aria-label":"Recently updated"}):(0,J.jsx)(kF,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,J.jsx)("span",{className:rZ("block truncate text-sm font-medium",a&&"text-[var(--brand)]"),children:Tf(e.path)}),(0,J.jsxs)("span",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r&&(0,J.jsx)("span",{className:"truncate",children:r}),(0,J.jsx)("span",{className:"shrink-0 tabular-nums",children:Tm(e.size)}),i&&(0,J.jsxs)("span",{className:"shrink-0 tabular-nums",children:["· ",i]})]})]})]},e.path)})})]},e.name)),r?.truncated&&(0,J.jsxs)("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:["Showing the first ",r.entries.length," files."]})]})})}),(0,J.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize file list",onPointerDown:Z,className:"relative hidden w-px shrink-0 cursor-col-resize bg-border transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 hover:bg-[var(--brand)] md:block"}),(0,J.jsx)("section",{className:rZ("min-w-0 flex-1 flex-col",l?"flex":"hidden md:flex"),children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"flex flex-shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2 sm:px-4",children:[(0,J.jsx)("button",{type:"button",onClick:()=>{es(()=>{u(null),d(null),b(!1)})},"aria-label":"Back to list",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring md:hidden",children:(0,J.jsx)(Tl,{className:"size-4","aria-hidden":"true"})}),(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsx)("p",{className:"truncate text-sm font-medium",children:Tf(l)}),c&&(0,J.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[Tp(l)&&`${Tp(l)} \xb7 `,Tm(c.size),c.mtime?` \xb7 ${function(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(e))}catch{return""}}(c.mtime)}`:""]})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:g?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{es(()=>b(!1))},disabled:_,"aria-label":"Cancel editing",children:[(0,J.jsx)(kX,{className:"mr-1 size-4"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 px-3",onClick:er,disabled:_||!eo,"aria-label":"Save memory file",children:[_?(0,J.jsx)(a1,{className:"mr-1 size-4 animate-spin"}):(0,J.jsx)(kU,{className:"mr-1 size-4"}),_?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:ea,disabled:!c,"aria-label":E?"Copied memory content":"Copy memory content",title:E?"Copied memory content":"Copy memory content",children:E?(0,J.jsx)(ln,{className:"size-4"}):(0,J.jsx)(ks,{className:"size-4"})}),(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{c&&(v(c.content),b(!0))},disabled:!c,"aria-label":"Edit memory file",children:[(0,J.jsx)(a4,{className:"mr-1 size-4"}),"Edit"]}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>L(!0),disabled:!c,"aria-label":"Delete memory file",title:"Delete memory file",children:(0,J.jsx)(a8,{className:"size-4"})})]})})]}),m&&(0,J.jsx)("p",{role:"alert",className:"px-4 py-2 text-sm text-destructive",children:m}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:p?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):g?(0,J.jsx)("textarea",{value:y,onChange:e=>v(e.target.value),spellCheck:!1,"aria-label":"Memory file content",className:"h-full w-full resize-none bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"Write memory…"}):c?(0,J.jsx)(ij,{className:"h-full",children:(0,J.jsx)("div",{className:"mx-auto max-w-[780px] px-4 py-4 sm:px-6",children:0===c.content.trim().length?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"This file is empty."}):"md"===el||"markdown"===el?(0,J.jsx)(S2,{content:c.content}):(0,J.jsx)(S0,{language:Tc[el]||"text",style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.85rem"},wrapLongLines:!0,children:c.content})})}):null})]}):(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a memory file to view or edit."})})})]}),(0,J.jsx)(rK,{open:S,onOpenChange:e=>{N||k(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"New memory file"}),(0,J.jsxs)(r2,{children:["Create a markdown file in the memory directory. Use a path like"," ",(0,J.jsx)("code",{className:"font-mono text-xs",children:"notes/idea.md"})," to nest it."]})]}),(0,J.jsx)(nu,{name:"memory-file-path",autoComplete:"off",spellCheck:!1,value:T,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ei())},placeholder:"notes/research-idea.md…",disabled:N,"aria-invalid":!!C||void 0,"aria-describedby":C?"new-memory-error":void 0}),C&&(0,J.jsx)("p",{id:"new-memory-error",role:"alert",className:"text-sm text-destructive",children:C}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>k(!1),disabled:N,children:"Cancel"}),(0,J.jsx)(na,{onClick:ei,disabled:N||!T.trim(),children:N?"Creating…":"Create"})]})]})}),(0,J.jsx)(rK,{open:O,onOpenChange:e=>{P||L(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete memory file?"}),(0,J.jsx)(r2,{children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("code",{children:l}),"will be permanently deleted. This can't be undone."]}):"This memory file will be permanently deleted."})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>L(!1),disabled:P,children:"Cancel"}),(0,J.jsx)(na,{onClick:en,disabled:P||!l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:P?"Deleting…":"Delete"})]})]})}),(0,J.jsx)(rK,{open:M,onOpenChange:e=>{e||(U.current=null,j(!1))},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",l?Tf(l):"this file","” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>{U.current=null,j(!1)},children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{let e=U.current;U.current=null,j(!1),b(!1),e?.()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}function Ty({dir:e}){return(0,J.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,J.jsx)(a0,{className:"size-10 text-muted-foreground/40","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm font-medium",children:"No memory yet"}),(0,J.jsxs)("p",{className:"max-w-md text-sm text-muted-foreground",children:["EvoScientist will write what it learns here as you work together. Memory lives at ",(0,J.jsx)("code",{className:"break-all font-mono text-xs",children:e}),"."]})]})}let Tv=ro("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),T_=ro("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var Tw=e.i(21675);function TE(){let{resolvedTheme:e,setTheme:t}=(0,Tw.useTheme)(),[r,n]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>n(!0),[]);let a=r&&"dark"===e;return(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-8 sm:size-9",onClick:()=>t(a?"light":"dark"),"aria-label":a?"Switch to light mode":"Switch to dark mode",title:a?"Switch to light mode":"Switch to dark mode",children:a?(0,J.jsx)(Tv,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(T_,{className:"size-5","aria-hidden":"true"})})}let Tx={checking:{dot:"bg-[var(--color-warning)]",label:"Connecting…",pulse:!0},online:{dot:"bg-[var(--color-success)]",label:"Connected",pulse:!1},offline:{dot:"bg-[var(--color-error)]",label:"Offline",pulse:!1}};function TS(e){return e.trim().replace(/\/+$/,"")}async function Tk(e){let t=new AbortController,r=setTimeout(()=>t.abort(),4e3);try{return(await fetch(`${e}/info`,{signal:t.signal,cache:"no-store"})).ok}catch{return!1}finally{clearTimeout(r)}}function TT({deploymentUrl:e,onReconnect:t}){let[r,n]=(0,Q.useState)("checking"),[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useRef)(!0),c=(0,Q.useRef)(null),d=(0,Q.useCallback)(async t=>{let r=TS(e);try{let e=await fetch("/api/evosci-config",{cache:"no-store"}),n=await e.json().catch(()=>null),a=n?.deploymentUrl?TS(n.deploymentUrl):"";if(t!==l.current||!u.current)return;if(!a||a===r)return void s(null);let i=await Tk(a);if(t!==l.current||!u.current)return;s(i?a:null)}catch{t===l.current&&u.current&&s(null)}},[e]),p=(0,Q.useCallback)(async()=>{let t=++l.current,r=TS(e);if(!r){t===l.current&&u.current&&(i(null),n("offline"),s(null));return}c.current?.abort();let a=new AbortController;c.current=a;let o=setTimeout(()=>a.abort(),4e3);try{let e=await fetch(`${r}/info`,{signal:a.signal,cache:"no-store"});if(t!==l.current||!u.current)return;if(!e.ok){n("offline"),d(t);return}let o=await e.json().catch(()=>null);if(t!==l.current||!u.current)return;i(o),n("online"),s(null)}catch{t===l.current&&u.current&&(n("offline"),d(t))}finally{clearTimeout(o)}},[e,d]);(0,Q.useEffect)(()=>{u.current=!0,n("checking"),p();let e=setInterval(()=>{document.hidden||p()},1e4),t=()=>p(),r=()=>{document.hidden||p()};return window.addEventListener("focus",t),window.addEventListener("online",t),document.addEventListener("visibilitychange",r),()=>{u.current=!1,c.current?.abort(),clearInterval(e),window.removeEventListener("focus",t),window.removeEventListener("online",t),document.removeEventListener("visibilitychange",r)}},[p]);let f=Tx[r],m="online"===r?`Connected to ${e}${a?.version?` \xb7 langgraph ${a.version}`:""}`:"offline"===r?`Can't reach the backend at ${e}. Is "EvoSci deploy" running? Click to retry.`:`Checking connection to ${e}…`;return(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:p,title:m,"aria-label":m,className:"h-8 gap-1.5 px-2 text-xs font-normal text-muted-foreground",children:[(0,J.jsx)("span",{className:`size-2 shrink-0 rounded-full ${f.dot} ${f.pulse?"animate-pulse":""}`,"aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:f.label})]}),"offline"===r&&null!==o&&void 0!==t&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:()=>{o&&(s(null),n("checking"),t?.(o))},title:`Backend detected at ${o}. Click to reconnect.`,"aria-label":`Reconnect to detected backend ${o}`,className:"h-8 gap-1 px-2 text-xs font-medium text-[var(--brand)] hover:text-[var(--brand)]",children:["Reconnect"," ",(0,J.jsx)("span",{className:"tabular-nums",children:o?function(e){try{let t=new URL(e),r="127.0.0.1"===t.hostname||"localhost"===t.hostname||"0.0.0.0"===t.hostname,n=t.port||("https:"===t.protocol?"443":"80");return r?`:${n}`:`${t.hostname}:${n}`}catch{return e}}(o):""})]})]})}let TA=ro("bell-ring",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]),TN=ro("corner-up-left",[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]);function TI(e){let t="";for(let r of e)if("human"===r.type){let e=vB(r).trim();if(e){t=e;break}}return{prompt:t,steps:function(e){let t=[];for(let r of e)if("ai"===r.type){let e=vz(r.content).trim();for(let n of(e&&t.push({kind:"text",text:e}),function(e){let t=[];if(Array.isArray(e.tool_calls)&&e.tool_calls.length>0){for(let r of e.tool_calls)t.push({id:r.id??"",name:r.name??"tool",args:r.args&&"object"==typeof r.args?r.args:{}});return t}let r=e.additional_kwargs?.tool_calls;if(Array.isArray(r))for(let e of r){let r={},n=e.function?.arguments;if(n&&"object"==typeof n)r=n;else if("string"==typeof n)try{let e=JSON.parse(n);e&&"object"==typeof e&&(r=e)}catch{r={input:n}}t.push({id:e.id??"",name:e.function?.name??"tool",args:r})}return t}(r)))t.push({kind:"tool_call",id:n.id,name:n.name,args:n.args})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()});return t}(e)}}function TC({status:e}){let t=kt[S3(e)];return(0,J.jsx)("span",{className:rZ("size-2 shrink-0 rounded-full",t.dot,t.pulse&&"animate-pulse"),"aria-hidden":"true"})}function TR({onReportToMainChat:e}){let t=nj(),[r]=ec("threadId"),{tasks:n,loaded:a,error:i,refresh:o}=kw(r),[s,l]=(0,Q.useState)(()=>Date.now()),[u,c]=(0,Q.useState)(null),[d,p]=(0,Q.useState)({}),f=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)({}),[g,b]=kR(r),[y,v]=(0,Q.useState)({}),[_,w]=(0,Q.useState)({}),[E,x]=(0,Q.useState)({}),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,Q.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let k=async e=>{let r=(y[e.task_id]??"").trim();if(r&&!_[e.task_id]){w(t=>({...t,[e.task_id]:!0})),x(t=>({...t,[e.task_id]:null}));try{let n=await t.runs.wait(e.thread_id,e.agent_name,{input:{messages:[{type:"human",content:r}]}});if(!S.current)return;let a=Array.isArray(n?.messages)?n.messages:[];if(0===a.length)return void x(t=>({...t,[e.task_id]:"The agent didn't return a reply — it may have hit an error."}));v(t=>({...t,[e.task_id]:""}));let{prompt:i,steps:o}=TI(a);p(t=>({...t,[e.task_id]:{loading:!1,error:null,prompt:i,steps:o}}))}catch(r){if(!S.current)return;let t=r instanceof TypeError||"object"==typeof r&&null!==r&&"number"==typeof r.status;x(r=>({...r,[e.task_id]:t?"Couldn't reach this agent — try again.":"The agent hit an error processing this follow-up."}))}finally{S.current&&w(t=>({...t,[e.task_id]:!1}))}}};(0,Q.useEffect)(()=>{if(!u)return;let e=n.find(e=>e.task_id===u);if(!e||"expired"===S3(e.liveStatus))return;let r="running"===S3(e.liveStatus),a=[e.run_id,e.last_updated_at,e.endedAt].join(":");if(!r&&f.current.get(u)===a)return;let i=!1;return p(e=>({...e,[u]:{loading:!e[u],error:null,prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}})),(async()=>{try{let n=await t.threads.getState(e.thread_id);if(i)return;let{prompt:o,steps:s}=TI(n.values?.messages??[]);r||f.current.set(u,a),p(e=>({...e,[u]:{loading:!1,error:null,prompt:o,steps:s}}))}catch{if(i)return;f.current.delete(u),p(e=>({...e,[u]:{loading:!1,error:"Couldn't load this agent's steps.",prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}}))}})(),()=>{i=!0}},[u,n,t]);let T=(0,Q.useMemo)(()=>kn(n),[n]);return(0,J.jsxs)("div",{className:"flex h-full flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1 pb-2",children:[(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:T>0?`${T} running`:n.length>0?`${n.length} total`:"Background agents"}),(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{r&&(g||kI(r,n.filter(e=>kr(e.liveStatus)).map(S9)),b(!g))},"aria-pressed":g,"aria-label":`Auto-report ${g?"on":"off"}`,title:g?"Auto-report on: finished agents are sent to the main chat automatically":"Auto-report off: use each agent's “Notify main chat” button",className:rZ("inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",g?"bg-accent text-[var(--brand)]":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[(0,J.jsx)(TA,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"hidden min-[340px]:inline",children:["Auto-report ",g?"On":"Off"]})]}),(0,J.jsx)("button",{type:"button",onClick:o,"aria-label":"Refresh agents",title:"Refresh",className:"rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(kW,{className:"size-3.5","aria-hidden":"true"})})]})]}),i&&(0,J.jsx)("p",{className:"px-1 text-xs text-[var(--color-error)]",children:i}),!a&&(0,J.jsxs)("div",{className:"flex items-center gap-2 px-1 py-4 text-xs text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading…"]}),a&&0===n.length&&(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-10 text-center",children:[(0,J.jsx)(v6,{className:"size-9 text-muted-foreground/60","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No background agents yet."}),(0,J.jsx)("p",{className:"text-xs text-muted-foreground/80",children:"When EvoScientist delegates long tasks (writing, data analysis) they run in the background and show up here."})]}),(0,J.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto",children:n.map(t=>{var n;let a,i,o,l=S3(t.liveStatus),p=kt[l],f=u===t.task_id,b="expired"===l,w=d[t.task_id];return(0,J.jsxs)("div",{className:"rounded-md border border-border bg-background",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>c(f?null:t.task_id),className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-expanded":f,children:[f?(0,J.jsx)(la,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}):(0,J.jsx)(ko,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)(TC,{status:t.liveStatus}),(0,J.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:S5[n=t.agent_name]??n}),(0,J.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[p.label,(a=function(e,t){let r=S3(e.liveStatus);if("expired"===r)return"";let n="running"===r?t:e.endedAt?Date.parse(e.endedAt):t;return function(e,t){if(!e)return"";let r=Date.parse(e);if(Number.isNaN(r))return"";let n=Math.max(0,Math.round((t-r)/1e3)),a=Math.floor(n/60);if(a>=60){let e=Math.floor(a/60);return`${e}h ${a%60}m`}return a>0?`${a}m ${n%60}s`:`${n}s`}(e.startedAt??e.created_at,n)}(t,s))?` \xb7 ${a}`:""]})]}),f&&b&&(0,J.jsx)("div",{className:"border-t border-border px-2.5 py-2 text-xs",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"This task ran before a backend restart and its records are gone, so its steps and result can no longer be loaded. Any files it produced are still in the workspace."})}),f&&!b&&(0,J.jsxs)("div",{className:"border-t border-border px-2.5 py-2 text-xs",children:[w?.loading&&(0,J.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Loading steps…"]}),w?.error&&(0,J.jsx)("p",{className:"text-[var(--color-error)]",children:w.error}),w&&!w.loading&&!w.error&&(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[w.prompt&&(0,J.jsxs)("div",{children:[(0,J.jsx)("p",{className:"font-semibold text-foreground",children:"Task"}),(0,J.jsx)("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:w.prompt.length>600?w.prompt.slice(0,600)+"…":w.prompt})]}),(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-1 font-semibold text-foreground",children:["Steps"," ",(0,J.jsxs)("span",{className:"font-normal text-muted-foreground",children:["(",w.steps.length,")"]})]}),0===w.steps.length?(0,J.jsx)("p",{className:"text-muted-foreground",children:"No steps yet."}):(0,J.jsx)(S4,{steps:w.steps,compact:!0})]}),kr(t.liveStatus)&&(0,J.jsx)("div",{className:"mt-1 border-t border-border pt-2",children:g?(0,J.jsxs)("p",{className:"inline-flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,J.jsx)(TA,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),"Auto-report on · future completions notify the main chat"]}):(0,J.jsxs)("button",{type:"button",onClick:()=>(t=>{if(!e||!r)return void u_.toast.error("Open the conversation to notify the main agent.");let n=e(t,r);if("sent"===n){h(e=>({...e,[S9(t)]:!0})),u_.toast.success("Reported to the main chat.");return}if("duplicate"===n){h(e=>({...e,[S9(t)]:!0})),u_.toast.info("This result is already in the main chat.");return}u_.toast.error("wrong-thread"===n?"The active conversation changed — reopen this task and try again.":"Main chat is busy — try again when it's idle.")})(t),disabled:!e||!!m[S9(t)],title:e?"Send this result back to the main agent":"Open the conversation to notify the main agent",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[(0,J.jsx)(TN,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),m[S9(t)]?"Reported to main chat":"Notify main chat"]})}),(i="running"===S3(t.liveStatus),o=!!_[t.task_id],(0,J.jsxs)("div",{className:"mt-1 border-t border-border pt-2",children:[(0,J.jsx)("p",{className:"mb-1 text-[11px] text-muted-foreground",children:"Direct follow-up · Main chat is not notified"}),(0,J.jsxs)("form",{onSubmit:e=>{e.preventDefault(),k(t)},className:"flex items-center gap-1.5",children:[(0,J.jsx)("input",{type:"text",name:`agent-message-${t.task_id}`,autoComplete:"off",value:y[t.task_id]??"",onChange:e=>v(r=>({...r,[t.task_id]:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&(e.nativeEvent.isComposing||229===e.keyCode)&&e.preventDefault()},disabled:i||o,placeholder:i?"Agent is working…":"Send a direct follow-up…","aria-label":"Message this agent",className:"min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60"}),(0,J.jsx)("button",{type:"submit",disabled:i||o||!(y[t.task_id]??"").trim(),"aria-label":"Send",title:"Send to this agent",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md bg-[var(--brand-solid)] text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",children:o?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(vY,{className:"size-3.5","aria-hidden":"true"})})]}),E[t.task_id]&&(0,J.jsx)("p",{className:"mt-1 text-[var(--color-error)]",role:"status","aria-live":"polite",children:E[t.task_id]})]}))]})]})]},t.task_id)})})]})}function TO({onClose:e,onReportToMainChat:t}){let[r,n]=ec("inspectorTab"),a="agents"===r?"agents":"workspace";return(0,J.jsxs)("div",{className:"flex h-full flex-col border-l border-border bg-sidebar",children:[(0,J.jsxs)("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 border-b border-border px-2",children:[(0,J.jsxs)("div",{role:"tablist","aria-label":"Inspector",className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"workspace"===a,onClick:()=>n(null),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","workspace"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(v1,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Workspace"]}),(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"agents"===a,onClick:()=>n("agents"),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","agents"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(v6,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Agents"]})]}),(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-7",onClick:e,"aria-label":"Close inspector",title:"Close",children:(0,J.jsx)(rs,{className:"size-4","aria-hidden":"true"})})]}),"agents"===a?(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden p-3",children:(0,J.jsx)(TR,{onReportToMainChat:t})}):(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:(0,J.jsx)(k8,{})})]})}function TL({config:e,configDialogOpen:t,setConfigDialogOpen:r,handleSaveConfig:n}){let a=nj(),[,i]=ec("threadId"),[o,s]=ec("sidebar"),[l,u]=ec("view"),[c,d]=ec("inspector"),[,p]=ec("inspectorTab"),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(0),[b,y]=(0,Q.useState)(null),[v,_]=(0,Q.useState)(null),[w,E]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(null),k=(0,Q.useCallback)(async()=>{let t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e.assistantId),r=async()=>{if(t)return await a.assistants.get(e.assistantId);let r=await a.assistants.search({graphId:e.assistantId,limit:100}),n=r.find(e=>e.metadata?.created_by==="system")??r[0];if(!n)throw Error("No assistant found for this graph.");return n};for(let e=0;e<3;e+=1)try{y(await r());return}catch(t){if(e<2){await new Promise(e=>setTimeout(e,700));continue}console.warn("Couldn't resolve the EvoScientist assistant; addressing the graph by id instead. Is the backend running?",t)}y({assistant_id:e.assistantId,graph_id:e.assistantId,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),config:{},metadata:{},version:1,name:e.assistantId,context:{}})},[a,e.assistantId]);(0,Q.useEffect)(()=>{k()},[k]),(0,Q.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),t=()=>_(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,Q.useEffect)(()=>{!1===v&&o&&c&&d(null)},[c,v,d,o]);let T=(0,Q.useCallback)(()=>s(null),[s]),A=(0,Q.useCallback)(()=>{d(null),p(null)},[d,p]),N=(0,Q.useCallback)(()=>{o?s(null):(!1===v&&A(),s("1"))},[A,v,s,o]),I=(0,Q.useCallback)(()=>{c?A():(!1===v&&s(null),p(null),d("1"))},[A,c,v,d,p,s]),C=(0,Q.useCallback)(()=>{p("agents"),!1===v&&s(null),d("1")},[v,d,s,p]),R=l?o?"Hide navigation":"Show navigation":o?"Hide research":"Show research",O=(0,Q.useCallback)(()=>{k_(null,!1),i(null),u(null),E(e=>e+1)},[i,u]),L=(0,Q.useCallback)(async e=>{k_(null,!1),u(null),await i(e),E(e=>e+1)},[i,u]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:t,onOpenChange:r,onSave:n,initialConfig:e}),(0,J.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,J.jsxs)("header",{className:"flex h-14 items-center justify-between gap-2 border-b border-border px-2.5 sm:px-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2 sm:gap-3",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(ee.default,{src:"/evoscientist-logo.png",alt:"EvoScientist",width:28,height:28,className:"size-6 shrink-0",priority:!0}),o&&(0,J.jsx)("h1",{className:"truncate text-base font-semibold sm:text-lg",children:"EvoScientist"})]}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)(na,{variant:"ghost",size:"icon",onClick:N,"aria-label":R,className:"relative size-8",children:[o?(0,J.jsx)(nz,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nU,{className:"size-5","aria-hidden":"true"}),h>0&&(0,J.jsx)("span",{className:"absolute right-0 top-0 inline-flex min-h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] text-destructive-foreground",children:h})]}),!o&&(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:O,"aria-label":"New chat",className:"size-8",children:(0,J.jsx)(n$,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[(0,J.jsx)(TT,{deploymentUrl:e.deploymentUrl,onReconnect:t=>n({...e,deploymentUrl:t})}),(0,J.jsx)(TE,{}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:I,"aria-label":c?"Hide inspector":"Show workspace",title:c?"Hide inspector":"Show workspace",className:"size-8",children:c?(0,J.jsx)(nH,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nB,{className:"size-5","aria-hidden":"true"})}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:()=>r(!0),"aria-label":"Settings",title:"Settings",className:"size-8",children:(0,J.jsx)(nF,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[o&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close research",className:"absolute inset-0 bg-black/40",onClick:T}),(0,J.jsx)("aside",{"aria-label":l?"Navigation":"Research navigation",className:"relative z-10 h-full w-[min(19rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(uI,{onClose:T,onNewChat:O,onThreadSelect:async e=>{await L(e),T()},onMutateReady:e=>m(()=>e),onInterruptCountChange:g})})]}),c&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex justify-end md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close inspector",className:"absolute inset-0 bg-black/40",onClick:A}),(0,J.jsx)("aside",{"aria-label":"Inspector",className:"relative z-10 h-full w-[min(22rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(TO,{onClose:A,onReportToMainChat:x})})]}),(0,J.jsxs)(aJ,{direction:"horizontal",autoSaveId:"evoscientist-chat",children:[o&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n2,{id:"thread-history",order:1,defaultSize:23,minSize:18,className:"relative min-w-[260px]",children:(0,J.jsx)(uI,{onNewChat:O,onThreadSelect:L,onMutateReady:e=>m(()=>e),onInterruptCountChange:g})}),(0,J.jsx)(aQ,{})]}),(0,J.jsx)(n2,{id:"chat",className:"relative flex flex-col",order:2,children:"skills"===l?(0,J.jsx)(To,{}):"memory"===l?(0,J.jsx)(Tb,{}):(0,J.jsx)(vq,{activeAssistant:b,onHistoryRevalidate:()=>f?.(),children:(0,J.jsx)(Tt,{assistant:b,onShowAgents:C,onNotifyReady:e=>S(()=>e)})},w)}),c&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aQ,{}),(0,J.jsx)(n2,{id:"inspector",order:3,defaultSize:26,minSize:20,className:"relative min-w-[300px]",children:(0,J.jsx)(TO,{onClose:A,onReportToMainChat:x})})]})]})]})]})]})}function TP(){let[e,t]=(0,Q.useState)(null),[r,n]=(0,Q.useState)(!1),[a,i]=ec("assistantId");(0,Q.useEffect)(()=>{let e=ef();e?(t(e),a||i(e.assistantId)):n(!0)},[]),(0,Q.useEffect)(()=>{e&&!a&&i(e.assistantId)},[e,a,i]);let o=(0,Q.useCallback)(e=>{localStorage.setItem(ep,JSON.stringify(e)),t(e)},[]),s=e?.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return e?(0,J.jsx)(nM,{deploymentUrl:e.deploymentUrl,apiKey:s,children:(0,J.jsx)(TL,{config:e,configDialogOpen:r,setConfigDialogOpen:n,handleSaveConfig:o})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:r,onOpenChange:n,onSave:o}),(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsxs)("div",{className:"text-center",children:[(0,J.jsx)("h1",{className:"text-2xl font-bold",children:"Welcome to EvoScientist"}),(0,J.jsx)("p",{className:"mt-2 text-muted-foreground",children:"Configure your deployment to get started"}),(0,J.jsx)(na,{onClick:()=>n(!0),className:"mt-4",children:"Open Configuration"})]})})]})}e.s(["default",0,function(){return(0,J.jsx)(Q.Suspense,{fallback:(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"Loading…"})}),children:(0,J.jsx)(TP,{})})}],52683)}]);
|