@rekayasa/erica-bubble 1.1.5 → 1.1.6-b
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/index.cjs +50 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +3230 -2909
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require("react");u=l(u,1);let d=require("@copilotkit/react-core/v2"),f=require("react/jsx-runtime"),p=require("echarts");p=l(p,1);var m=(e,t,n)=>{typeof n==`string`||n instanceof Blob?e.append(t,n):n instanceof Date?e.append(t,n.toISOString()):e.append(t,JSON.stringify(n))},h={bodySerializer:e=>{let t=new FormData;return Object.entries(e).forEach(([e,n])=>{n!=null&&(Array.isArray(n)?n.forEach(n=>m(t,e,n)):m(t,e,n))}),t}},g={bodySerializer:e=>JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t)};Object.entries({$body_:`body`,$headers_:`headers`,$path_:`path`,$query_:`query`});function _({onRequest:e,onSseError:t,onSseEvent:n,responseTransformer:r,responseValidator:i,sseDefaultRetryDelay:a,sseMaxRetryAttempts:o,sseMaxRetryDelay:s,sseSleepFn:c,url:l,...u}){let d,f=c??(e=>new Promise(t=>setTimeout(t,e)));return{stream:async function*(){let c=a??3e3,p=0,m=u.signal??new AbortController().signal;for(;!m.aborted;){p++;let a=u.headers instanceof Headers?u.headers:new Headers(u.headers);d!==void 0&&a.set(`Last-Event-ID`,d);try{let t={redirect:`follow`,...u,body:u.serializedBody,headers:a,signal:m},o=new Request(l,t);e&&(o=await e(l,t));let s=await(u.fetch??globalThis.fetch)(o);if(!s.ok)throw Error(`SSE failed: ${s.status} ${s.statusText}`);if(!s.body)throw Error(`No body in SSE response`);let f=s.body.pipeThrough(new TextDecoderStream).getReader(),p=``,h=()=>{try{f.cancel()}catch{}};m.addEventListener(`abort`,h);try{for(;;){let{done:e,value:t}=await f.read();if(e)break;p+=t,p=p.replace(/\r\n?/g,`
|
|
2
2
|
`);let a=p.split(`
|
|
3
3
|
|
|
4
4
|
`);p=a.pop()??``;for(let e of a){let t=e.split(`
|
|
5
5
|
`),a=[],o;for(let e of t)if(e.startsWith(`data:`))a.push(e.replace(/^data:\s*/,``));else if(e.startsWith(`event:`))o=e.replace(/^event:\s*/,``);else if(e.startsWith(`id:`))d=e.replace(/^id:\s*/,``);else if(e.startsWith(`retry:`)){let t=Number.parseInt(e.replace(/^retry:\s*/,``),10);Number.isNaN(t)||(c=t)}let s,l=!1;if(a.length){let e=a.join(`
|
|
6
|
-
`);try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:o,id:d,retry:c}),a.length&&(yield s)}}}finally{m.removeEventListener(`abort`,h),f.releaseLock()}break}catch(e){if(t?.(e),o!==void 0&&p>=o)break;await f(Math.min(c*2**(p-1),s??3e4))}}}()}}var v=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},y=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},b=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},x=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(y(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=v(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):S({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},S=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},C=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=b(r),s=Object.entries(i).map(([t,i])=>S({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},w=/\{[^{}]+\}/g,T=({path:e,url:t})=>{let n=t,r=t.match(w);if(r)for(let t of r){let r=!1,i=t.substring(1,t.length-1),a=`simple`;i.endsWith(`*`)&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(`.`)?(i=i.substring(1),a=`label`):i.startsWith(`;`)&&(i=i.substring(1),a=`matrix`);let o=e[i];if(o==null)continue;if(Array.isArray(o)){n=n.replace(t,x({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,C({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${S({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},E=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=T({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function ee(e){let t=e.body!==void 0;if(t&&e.bodySerializer)return`serializedBody`in e?e.serializedBody!==void 0&&e.serializedBody!==``?e.serializedBody:null:e.body===``?null:e.body;if(t)return e.body}var D=async(e,t)=>{let n=typeof t==`function`?await t(e):t;if(n)return e.scheme===`bearer`?`Bearer ${n}`:e.scheme===`basic`?`Basic ${btoa(n)}`:n},te=({parameters:e={},...t}={})=>n=>{let r=[];if(n&&typeof n==`object`)for(let i in n){let a=n[i];if(a==null)continue;let o=e[i]||t;if(Array.isArray(a)){let e=x({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=C({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=S({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join(`&`)},ne=e=>{if(!e)return`stream`;let t=e.split(`;`)[0]?.trim();if(t){if(t.startsWith(`application/json`)||t.endsWith(`+json`))return`json`;if(t===`multipart/form-data`)return`formData`;if([`application/`,`audio/`,`image/`,`video/`].some(e=>t.startsWith(e)))return`blob`;if(t.startsWith(`text/`))return`text`}},re=(e,t)=>t?!!(e.headers.has(t)||e.query?.[t]||e.headers.get(`Cookie`)?.includes(`${t}=`)):!1,ie=async({security:e,...t})=>{for(let n of e){if(re(t,n.name))continue;let e=await D(n,t.auth);if(!e)continue;let r=n.name??`Authorization`;switch(n.in){case`query`:t.query||={},t.query[r]=e;break;case`cookie`:t.headers.append(`Cookie`,`${r}=${e}`);break;default:t.headers.set(r,e);break}}},ae=e=>E({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer==`function`?e.querySerializer:te(e.querySerializer),url:e.url}),oe=(e,t)=>{let n={...e,...t};return n.baseUrl?.endsWith(`/`)&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=ce(e.headers,t.headers),n},se=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},ce=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?se(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},le=class{fns=[];clear(){this.fns=[]}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){let t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e==`number`?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}},ue=()=>({error:new le,request:new le,response:new le}),de=te({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),fe={"Content-Type":`application/json`},pe=(e={})=>({...g,headers:fe,parseAs:`auto`,querySerializer:de,...e}),me=((e={})=>{let t=oe(pe(),e),n=()=>({...t}),r=e=>(t=oe(t,e),n()),i=ue(),a=async e=>{let n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:ce(t.headers,e.headers),serializedBody:void 0};n.security&&await ie({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body!==void 0&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),(n.body===void 0||n.serializedBody===``)&&n.headers.delete(`Content-Type`);let r=n;return{opts:r,url:ae(r)}},o=async e=>{let n=e.throwOnError??t.throwOnError,r=e.responseStyle??t.responseStyle,o,s;try{let{opts:t,url:n}=await a(e),r={redirect:`follow`,...t,body:ee(t)};o=new Request(n,r);for(let e of i.request.fns)e&&(o=await e(o,t));let c=t.fetch;s=await c(o);for(let e of i.response.fns)e&&(s=await e(s,o,t));let l={request:o,response:s};if(s.ok){let e=(t.parseAs===`auto`?ne(s.headers.get(`Content-Type`)):t.parseAs)??`json`;if(s.status===204||s.headers.get(`Content-Length`)===`0`){let n;switch(e){case`arrayBuffer`:case`blob`:case`text`:n=await s[e]();break;case`formData`:n=new FormData;break;case`stream`:n=s.body;break;default:n={};break}return t.responseStyle===`data`?n:{data:n,...l}}let n;switch(e){case`arrayBuffer`:case`blob`:case`formData`:case`text`:n=await s[e]();break;case`json`:{let e=await s.text();n=e?JSON.parse(e):{};break}case`stream`:return t.responseStyle===`data`?s.body:{data:s.body,...l}}return e===`json`&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),t.responseStyle===`data`?n:{data:n,...l}}let u=await s.text(),d;try{d=JSON.parse(u)}catch{}throw d??u}catch(t){let a=t;for(let t of i.error.fns)t&&(a=await t(a,s,o,e));if(a||={},n)throw a;return r===`data`?void 0:{error:a,request:o,response:s}}},s=e=>t=>o({...t,method:e}),c=e=>async t=>{let{opts:n,url:r}=await a(t);return _({...n,body:n.body,method:e,onRequest:async(e,t)=>{let r=new Request(e,t);for(let e of i.request.fns)e&&(r=await e(r,n));return r},serializedBody:ee(n),url:r})};return{buildUrl:e=>ae({...t,...e}),connect:s(`CONNECT`),delete:s(`DELETE`),get:s(`GET`),getConfig:n,head:s(`HEAD`),interceptors:i,options:s(`OPTIONS`),patch:s(`PATCH`),post:s(`POST`),put:s(`PUT`),request:o,setConfig:r,sse:{connect:c(`CONNECT`),delete:c(`DELETE`),get:c(`GET`),head:c(`HEAD`),options:c(`OPTIONS`),patch:c(`PATCH`),post:c(`POST`),put:c(`PUT`),trace:c(`TRACE`)},trace:s(`TRACE`)}})(pe({baseUrl:`http://localhost:9000/api/widget`}));function he(e,t){me.setConfig({baseUrl:e,headers:t?{Authorization:`Bearer ${t}`}:void 0})}var ge=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_e=new class extends ge{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ve={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ye=new class{#e=ve;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!==`production`&&this.#t&&e!==this.#e&&console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!==`production`&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function be(e){setTimeout(e,0)}var xe=typeof window>`u`||`Deno`in globalThis;function O(){}function Se(e,t){return typeof e==`function`?e(t):e}function Ce(e){return typeof e==`number`&&e>=0&&e!==1/0}function we(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Te(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function Ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Oe(o,t.options))return!1}else if(!Ae(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function De(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ke(t.options.mutationKey)!==ke(a))return!1}else if(!Ae(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Oe(e,t){return(t?.queryKeyHashFn||ke)(e)}function ke(e){return JSON.stringify(e,(e,t)=>Fe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ae(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Ae(e[n],t[n])):!1}var je=Object.prototype.hasOwnProperty;function Me(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Pe(e)&&Pe(t);if(!r&&!(Fe(e)&&Fe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:je.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Me(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ne(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Pe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Fe(e){if(!Ie(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ie(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ie(e){return Object.prototype.toString.call(e)===`[object Object]`}function Le(e){return new Promise(t=>{ye.setTimeout(t,e)})}function Re(e,t,n){if(typeof n.structuralSharing==`function`)return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!==`production`)try{return Me(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return Me(e,t)}return t}function ze(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Be(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ve=Symbol();function He(e,t){return process.env.NODE_ENV!==`production`&&e.queryFn===Ve&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ve?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ue(e,t){return typeof e==`function`?e(...t):!!e}function We(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Ge=(()=>{let e=()=>xe;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ke(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var qe=be;function Je(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=qe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var A=Je(),Ye=new class extends ge{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Xe(e){return Math.min(1e3*2**e,3e4)}function Ze(e){return(e??`online`)===`online`?Ye.isOnline():!0}var Qe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function $e(e){let t=!1,n=0,r,i=Ke(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Qe(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_e.isFocused()&&(e.networkMode===`always`||Ye.isOnline())&&e.canRun(),u=()=>Ze(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Ge.isServer()?0:3),o=e.retryDelay??Xe,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Le(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var et=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ce(this.gcTime)&&(this.#e=ye.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ge.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(ye.clearTimeout(this.#e),this.#e=void 0)}},tt=class extends et{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=it(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=it(this.options);e.data!==void 0&&(this.setState(rt(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=Re(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ve||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Te(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!we(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}process.env.NODE_ENV!==`production`&&(Array.isArray(this.options.queryKey)||console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`));let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=He(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=$e({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Qe&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw process.env.NODE_ENV!==`production`&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qe){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...nt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...rt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),A.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function nt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ze(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function rt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function it(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var at=class extends ge{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ke(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),st(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ct(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ct(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ne(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&<(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||Te(this.options.staleTime,this.#t)!==Te(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return dt(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(O)),t}#g(){this.#b();let e=Te(this.options.staleTime,this.#t);if(Ge.isServer()||this.#r.isStale||!Ce(e))return;let t=we(this.#r.dataUpdatedAt,e)+1;this.#d=ye.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Ge.isServer()||k(this.options.enabled,this.#t)===!1||!Ce(this.#p)||this.#p===0)&&(this.#f=ye.setInterval(()=>{(this.options.refetchIntervalInBackground||_e.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(ye.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(ye.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&st(e,t),o=i&<(e,n,t,r);(a||o)&&(l={...l,...nt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Re(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Re(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ut(e,t),refetch:this.refetch,promise:this.#o,isEnabled:k(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Ke())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ne(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){A.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ot(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function st(e,t){return ot(e,t)||e.state.data!==void 0&&ct(e,t,t.refetchOnMount)}function ct(e,t,n){if(k(t.enabled,e)!==!1&&Te(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ut(e,t)}return!1}function lt(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ut(e,n)}function ut(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(Te(t.staleTime,e))}function dt(e,t){return!Ne(e.getCurrentResult(),t)}function ft(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{We(e,()=>t.signal,()=>n=!0)},u=He(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Be:ze;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?mt:pt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:pt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function pt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function mt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ht=class extends et{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||gt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$e({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),A.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function gt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var _t=class extends ge{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ht({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=vt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=vt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=vt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=vt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){A.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>De(t,e))}findAll(e={}){return this.getAll().filter(t=>De(e,t))}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function vt(e){return e.options.scope?.id}var yt=class extends ge{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Oe(r,t),a=this.get(i);return a||(a=new tt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ee(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ee(e,t)):t}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new yt,this.#t=e.mutationCache||new _t,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_e.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ye.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Se(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return A.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;A.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return A.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=A.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return A.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=A.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e.behavior=ft(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e.behavior=ft(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ye.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ke(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ae(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ke(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ae(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Oe(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ve&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},xt=u.createContext(void 0),St=e=>{let t=u.useContext(xt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ct=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,f.jsx)(xt.Provider,{value:e,children:t})),wt=u.createContext(!1),Tt=()=>u.useContext(wt);wt.Provider;function Et(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dt=u.createContext(Et()),Ot=()=>u.useContext(Dt),kt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ue(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},At=e=>{u.useEffect(()=>{e.clearReset()},[e])},jt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ue(n,[e.error,r])),Mt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Nt=(e,t)=>e.isLoading&&e.isFetching&&!t,Pt=(e,t)=>e?.suspense&&t.isPending,Ft=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function It(e,t,n){if(process.env.NODE_ENV!==`production`&&(typeof e!=`object`||Array.isArray(e)))throw Error(`Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object`);let r=Tt(),i=Ot(),a=St(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);process.env.NODE_ENV!==`production`&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=r?`isRestoring`:`optimistic`,Mt(o),kt(o,i,s),At(i);let c=!a.getQueryCache().get(o.queryHash),[l]=u.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(u.useSyncExternalStore(u.useCallback(e=>{let t=f?l.subscribe(A.batchCalls(e)):O;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u.useEffect(()=>{l.setOptions(o)},[o,l]),Pt(o,d))throw Ft(o,l,i);if(jt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!Ge.isServer()&&Nt(d,r)&&(c?Ft(o,l,i):s?.promise)?.catch(O).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}function Lt(e,t){return It(e,at,t)}var Rt=e=>(e?.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads`,...e}),zt=e=>(e.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/{threadUid}`,...e}),Bt=e=>(e.client??me).post({...h,security:[{scheme:`bearer`,type:`http`}],url:`/attachments/upload`,...e,headers:{"Content-Type":null,...e.headers}}),Vt=e=>(e.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/attachments/{filename}`,...e}),Ht=e=>(e?.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/unique-thread-id`,...e}),Ut=e=>(e.client??me).post({security:[{scheme:`bearer`,type:`http`}],url:`/chat/sandbox`,...e,headers:{"Content-Type":`application/json`,...e.headers}}),Wt=e=>(e.client??me).delete({security:[{scheme:`bearer`,type:`http`}],url:`/chat/sandbox/{threadId}`,...e}),Gt=e=>(e.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/artifacts/{threadId}/{filename}`,...e}),Kt={list:async(e=15)=>{let{data:t}=await Rt({query:{page:1,page_size:e},throwOnError:!0});return t.data??[]},get:async e=>{let{data:t}=await zt({path:{threadUid:e},throwOnError:!0});return t.data},getUniqueThreadId:async()=>{let{data:e}=await Ht({throwOnError:!0});return e.data.thread_id},createSandbox:async e=>{let{data:t}=await Ut({body:{thread_id:e},throwOnError:!0});return t.data},deleteSandbox:async e=>{let{data:t}=await Wt({path:{threadId:e},throwOnError:!1});return t}},qt={all:()=>[`widget-threads`],detail:e=>[`widget-threads`,e],uniqueId:e=>[`widget-threads`,`unique-id`,e],sandbox:e=>[`widget-threads`,`sandbox`,e]},Jt=(e=15)=>Lt({queryKey:qt.all(),queryFn:()=>Kt.list(e),staleTime:15e3,refetchOnWindowFocus:!0}),Yt=(e=!0,t)=>Lt({queryKey:qt.uniqueId(t),queryFn:()=>Kt.getUniqueThreadId(),enabled:e,staleTime:0,gcTime:0}),Xt=(e,t=!0)=>Lt({queryKey:qt.sandbox(e),queryFn:()=>Kt.createSandbox(e),enabled:!!e&&t,staleTime:0,gcTime:0,retry:3,retryDelay:1e3}),Zt=(0,u.createContext)(null);function Qt({threadId:e,children:t}){let[n,r]=(0,u.useState)(void 0);return(0,f.jsx)(Zt.Provider,{value:{step:n,setStep:r,threadId:e},children:t})}Object.freeze({status:`aborted`});function j(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var $t=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},en=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},tn={};function nn(e){return e&&Object.assign(tn,e),tn}function rn(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function an(e,t){return typeof t==`bigint`?t.toString():t}function on(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function sn(e){return e==null}function cn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var ln=Symbol(`evaluating`);function M(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ln)return r===void 0&&(r=ln,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function un(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function dn(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function fn(e){return JSON.stringify(e)}function pn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var mn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function hn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var gn=on(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _n(e){if(hn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(hn(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function vn(e){return _n(e)?{...e}:Array.isArray(e)?[...e]:e}var yn=new Set([`string`,`number`,`symbol`]);function bn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Sn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Cn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return xn(e,dn(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return un(this,`shape`,e),e},checks:[]}))}function wn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return xn(e,dn(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return un(this,`shape`,r),r},checks:[]}))}function Tn(e,t){if(!_n(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xn(e,dn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return un(this,`shape`,n),n}}))}function En(e,t){if(!_n(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xn(e,dn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return un(this,`shape`,n),n}}))}function Dn(e,t){return xn(e,dn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return un(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function On(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return xn(t,dn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return un(this,`shape`,i),i},checks:[]}))}function kn(e,t,n){return xn(t,dn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return un(this,`shape`,i),i}}))}function An(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function jn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Mn(e){return typeof e==`string`?e:e?.message}function Nn(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Mn(e.inst?._zod.def?.error?.(e))??Mn(t?.error?.(e))??Mn(n.customError?.(e))??Mn(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Pn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Fn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var In=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,an,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ln=j(`$ZodError`,In),Rn=j(`$ZodError`,In,{Parent:Error});function zn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Bn(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Vn=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new $t;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Nn(e,a,nn())));throw mn(t,i?.callee),t}return o.value},Hn=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Nn(e,a,nn())));throw mn(t,i?.callee),t}return o.value},Un=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $t;return a.issues.length?{success:!1,error:new(e??Ln)(a.issues.map(e=>Nn(e,i,nn())))}:{success:!0,data:a.value}},Wn=Un(Rn),Gn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Nn(e,i,nn())))}:{success:!0,data:a.value}},Kn=Gn(Rn),qn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Vn(e)(t,n,i)},Jn=e=>(t,n,r)=>Vn(e)(t,n,r),Yn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Hn(e)(t,n,i)},Xn=e=>async(t,n,r)=>Hn(e)(t,n,r),Zn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Un(e)(t,n,i)},Qn=e=>(t,n,r)=>Un(e)(t,n,r),$n=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Gn(e)(t,n,i)},er=e=>async(t,n,r)=>Gn(e)(t,n,r),tr=/^[cC][^\s-]{8,}$/,nr=/^[0-9a-z]+$/,rr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ir=/^[0-9a-vA-V]{20}$/,ar=/^[A-Za-z0-9]{27}$/,or=/^[a-zA-Z0-9_-]{21}$/,sr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,cr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lr=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ur=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,dr=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function fr(){return new RegExp(dr,`u`)}var pr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,mr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,hr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,gr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_r=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vr=/^[A-Za-z0-9_-]*$/,yr=/^\+[1-9]\d{6,14}$/,br=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,xr=RegExp(`^${br}$`);function Sr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Cr(e){return RegExp(`^${Sr(e)}$`)}function wr(e){let t=Sr({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${br}T(?:${r})$`)}var Tr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Er=/^[^A-Z]*$/,Dr=/^[^a-z]*$/,Or=j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),kr=j(`$ZodCheckMaxLength`,(e,t)=>{var n;Or.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!sn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Pn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ar=j(`$ZodCheckMinLength`,(e,t)=>{var n;Or.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!sn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Pn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jr=j(`$ZodCheckLengthEquals`,(e,t)=>{var n;Or.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!sn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Pn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Mr=j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Or.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Nr=j(`$ZodCheckRegex`,(e,t)=>{Mr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Pr=j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Er,Mr.init(e,t)}),Fr=j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Dr,Mr.init(e,t)}),Ir=j(`$ZodCheckIncludes`,(e,t)=>{Or.init(e,t);let n=bn(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Lr=j(`$ZodCheckStartsWith`,(e,t)=>{Or.init(e,t);let n=RegExp(`^${bn(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Rr=j(`$ZodCheckEndsWith`,(e,t)=>{Or.init(e,t);let n=RegExp(`.*${bn(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),zr=j(`$ZodCheckOverwrite`,(e,t)=>{Or.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Br=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
6
|
+
`);try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:o,id:d,retry:c}),a.length&&(yield s)}}}finally{m.removeEventListener(`abort`,h),f.releaseLock()}break}catch(e){if(t?.(e),o!==void 0&&p>=o)break;await f(Math.min(c*2**(p-1),s??3e4))}}}()}}var v=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},y=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},b=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},x=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(y(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=v(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):S({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},S=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},C=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=b(r),s=Object.entries(i).map(([t,i])=>S({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},w=/\{[^{}]+\}/g,T=({path:e,url:t})=>{let n=t,r=t.match(w);if(r)for(let t of r){let r=!1,i=t.substring(1,t.length-1),a=`simple`;i.endsWith(`*`)&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(`.`)?(i=i.substring(1),a=`label`):i.startsWith(`;`)&&(i=i.substring(1),a=`matrix`);let o=e[i];if(o==null)continue;if(Array.isArray(o)){n=n.replace(t,x({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,C({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${S({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},E=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=T({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function ee(e){let t=e.body!==void 0;if(t&&e.bodySerializer)return`serializedBody`in e?e.serializedBody!==void 0&&e.serializedBody!==``?e.serializedBody:null:e.body===``?null:e.body;if(t)return e.body}var D=async(e,t)=>{let n=typeof t==`function`?await t(e):t;if(n)return e.scheme===`bearer`?`Bearer ${n}`:e.scheme===`basic`?`Basic ${btoa(n)}`:n},te=({parameters:e={},...t}={})=>n=>{let r=[];if(n&&typeof n==`object`)for(let i in n){let a=n[i];if(a==null)continue;let o=e[i]||t;if(Array.isArray(a)){let e=x({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=C({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=S({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join(`&`)},ne=e=>{if(!e)return`stream`;let t=e.split(`;`)[0]?.trim();if(t){if(t.startsWith(`application/json`)||t.endsWith(`+json`))return`json`;if(t===`multipart/form-data`)return`formData`;if([`application/`,`audio/`,`image/`,`video/`].some(e=>t.startsWith(e)))return`blob`;if(t.startsWith(`text/`))return`text`}},re=(e,t)=>t?!!(e.headers.has(t)||e.query?.[t]||e.headers.get(`Cookie`)?.includes(`${t}=`)):!1,ie=async({security:e,...t})=>{for(let n of e){if(re(t,n.name))continue;let e=await D(n,t.auth);if(!e)continue;let r=n.name??`Authorization`;switch(n.in){case`query`:t.query||={},t.query[r]=e;break;case`cookie`:t.headers.append(`Cookie`,`${r}=${e}`);break;default:t.headers.set(r,e);break}}},ae=e=>E({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer==`function`?e.querySerializer:te(e.querySerializer),url:e.url}),oe=(e,t)=>{let n={...e,...t};return n.baseUrl?.endsWith(`/`)&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=ce(e.headers,t.headers),n},se=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},ce=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?se(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},le=class{fns=[];clear(){this.fns=[]}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){let t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e==`number`?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}},ue=()=>({error:new le,request:new le,response:new le}),de=te({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),fe={"Content-Type":`application/json`},pe=(e={})=>({...g,headers:fe,parseAs:`auto`,querySerializer:de,...e}),me=((e={})=>{let t=oe(pe(),e),n=()=>({...t}),r=e=>(t=oe(t,e),n()),i=ue(),a=async e=>{let n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:ce(t.headers,e.headers),serializedBody:void 0};n.security&&await ie({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body!==void 0&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),(n.body===void 0||n.serializedBody===``)&&n.headers.delete(`Content-Type`);let r=n;return{opts:r,url:ae(r)}},o=async e=>{let n=e.throwOnError??t.throwOnError,r=e.responseStyle??t.responseStyle,o,s;try{let{opts:t,url:n}=await a(e),r={redirect:`follow`,...t,body:ee(t)};o=new Request(n,r);for(let e of i.request.fns)e&&(o=await e(o,t));let c=t.fetch;s=await c(o);for(let e of i.response.fns)e&&(s=await e(s,o,t));let l={request:o,response:s};if(s.ok){let e=(t.parseAs===`auto`?ne(s.headers.get(`Content-Type`)):t.parseAs)??`json`;if(s.status===204||s.headers.get(`Content-Length`)===`0`){let n;switch(e){case`arrayBuffer`:case`blob`:case`text`:n=await s[e]();break;case`formData`:n=new FormData;break;case`stream`:n=s.body;break;default:n={};break}return t.responseStyle===`data`?n:{data:n,...l}}let n;switch(e){case`arrayBuffer`:case`blob`:case`formData`:case`text`:n=await s[e]();break;case`json`:{let e=await s.text();n=e?JSON.parse(e):{};break}case`stream`:return t.responseStyle===`data`?s.body:{data:s.body,...l}}return e===`json`&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),t.responseStyle===`data`?n:{data:n,...l}}let u=await s.text(),d;try{d=JSON.parse(u)}catch{}throw d??u}catch(t){let a=t;for(let t of i.error.fns)t&&(a=await t(a,s,o,e));if(a||={},n)throw a;return r===`data`?void 0:{error:a,request:o,response:s}}},s=e=>t=>o({...t,method:e}),c=e=>async t=>{let{opts:n,url:r}=await a(t);return _({...n,body:n.body,method:e,onRequest:async(e,t)=>{let r=new Request(e,t);for(let e of i.request.fns)e&&(r=await e(r,n));return r},serializedBody:ee(n),url:r})};return{buildUrl:e=>ae({...t,...e}),connect:s(`CONNECT`),delete:s(`DELETE`),get:s(`GET`),getConfig:n,head:s(`HEAD`),interceptors:i,options:s(`OPTIONS`),patch:s(`PATCH`),post:s(`POST`),put:s(`PUT`),request:o,setConfig:r,sse:{connect:c(`CONNECT`),delete:c(`DELETE`),get:c(`GET`),head:c(`HEAD`),options:c(`OPTIONS`),patch:c(`PATCH`),post:c(`POST`),put:c(`PUT`),trace:c(`TRACE`)},trace:s(`TRACE`)}})(pe({baseUrl:`http://localhost:9000/api/widget`}));function he(e,t){me.setConfig({baseUrl:e,headers:t?{Authorization:`Bearer ${t}`}:void 0})}var ge=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_e=new class extends ge{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ve={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ye=new class{#e=ve;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!==`production`&&this.#t&&e!==this.#e&&console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!==`production`&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function be(e){setTimeout(e,0)}var xe=typeof window>`u`||`Deno`in globalThis;function O(){}function Se(e,t){return typeof e==`function`?e(t):e}function Ce(e){return typeof e==`number`&&e>=0&&e!==1/0}function we(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Te(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function Ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Oe(o,t.options))return!1}else if(!Ae(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function De(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ke(t.options.mutationKey)!==ke(a))return!1}else if(!Ae(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Oe(e,t){return(t?.queryKeyHashFn||ke)(e)}function ke(e){return JSON.stringify(e,(e,t)=>Fe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ae(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Ae(e[n],t[n])):!1}var je=Object.prototype.hasOwnProperty;function Me(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Pe(e)&&Pe(t);if(!r&&!(Fe(e)&&Fe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:je.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Me(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ne(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Pe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Fe(e){if(!Ie(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ie(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ie(e){return Object.prototype.toString.call(e)===`[object Object]`}function Le(e){return new Promise(t=>{ye.setTimeout(t,e)})}function Re(e,t,n){if(typeof n.structuralSharing==`function`)return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!==`production`)try{return Me(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return Me(e,t)}return t}function ze(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Be(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ve=Symbol();function He(e,t){return process.env.NODE_ENV!==`production`&&e.queryFn===Ve&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ve?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ue(e,t){return typeof e==`function`?e(...t):!!e}function We(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Ge=(()=>{let e=()=>xe;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ke(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var qe=be;function Je(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=qe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var A=Je(),Ye=new class extends ge{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Xe(e){return Math.min(1e3*2**e,3e4)}function Ze(e){return(e??`online`)===`online`?Ye.isOnline():!0}var Qe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function $e(e){let t=!1,n=0,r,i=Ke(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Qe(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_e.isFocused()&&(e.networkMode===`always`||Ye.isOnline())&&e.canRun(),u=()=>Ze(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Ge.isServer()?0:3),o=e.retryDelay??Xe,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Le(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var et=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ce(this.gcTime)&&(this.#e=ye.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ge.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(ye.clearTimeout(this.#e),this.#e=void 0)}};function tt(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{We(e,()=>t.signal,()=>n=!0)},u=He(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Be:ze;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?rt:nt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:nt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function nt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var it=class extends et{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=st(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=st(this.options);e.data!==void 0&&(this.setState(ot(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Re(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ve||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Te(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!we(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}process.env.NODE_ENV!==`production`&&(Array.isArray(this.options.queryKey)||console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`));let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=He(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?tt(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=$e({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Qe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw process.env.NODE_ENV!==`production`&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...at(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ot(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),A.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function at(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ze(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ot(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function st(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ct=class extends ge{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ke(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ut(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return dt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return dt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ne(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ft(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||Te(this.options.staleTime,this.#t)!==Te(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return mt(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(O)),t}#g(){this.#b();let e=Te(this.options.staleTime,this.#t);if(Ge.isServer()||this.#r.isStale||!Ce(e))return;let t=we(this.#r.dataUpdatedAt,e)+1;this.#d=ye.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Ge.isServer()||k(this.options.enabled,this.#t)===!1||!Ce(this.#p)||this.#p===0)&&(this.#f=ye.setInterval(()=>{(this.options.refetchIntervalInBackground||_e.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(ye.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(ye.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ut(e,t),o=i&&ft(e,n,t,r);(a||o)&&(l={...l,...at(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Re(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Re(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:pt(e,t),refetch:this.refetch,promise:this.#o,isEnabled:k(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Ke())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ne(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){A.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function lt(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&k(t.retryOnMount,e)===!1)}function ut(e,t){return lt(e,t)||e.state.data!==void 0&&dt(e,t,t.refetchOnMount)}function dt(e,t,n){if(k(t.enabled,e)!==!1&&Te(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&pt(e,t)}return!1}function ft(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&pt(e,n)}function pt(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(Te(t.staleTime,e))}function mt(e,t){return!Ne(e.getCurrentResult(),t)}var ht=class extends et{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||gt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$e({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),A.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function gt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var _t=class extends ge{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ht({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=vt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=vt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=vt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=vt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){A.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>De(t,e))}findAll(e={}){return this.getAll().filter(t=>De(e,t))}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function vt(e){return e.options.scope?.id}var yt=class extends ge{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Oe(r,t),a=this.get(i);return a||(a=new it({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ee(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ee(e,t)):t}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new yt,this.#t=e.mutationCache||new _t,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_e.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ye.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Se(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return A.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;A.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return A.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=A.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return A.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=A.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ye.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ke(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ae(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ke(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ae(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Oe(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ve&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},xt=u.createContext(void 0),St=e=>{let t=u.useContext(xt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ct=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,f.jsx)(xt.Provider,{value:e,children:t})),wt=u.createContext(!1),Tt=()=>u.useContext(wt);wt.Provider;function Et(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dt=u.createContext(Et()),Ot=()=>u.useContext(Dt),kt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ue(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},At=e=>{u.useEffect(()=>{e.clearReset()},[e])},jt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ue(n,[e.error,r])),Mt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Nt=(e,t)=>e.isLoading&&e.isFetching&&!t,Pt=(e,t)=>e?.suspense&&t.isPending,Ft=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function It(e,t,n){if(process.env.NODE_ENV!==`production`&&(typeof e!=`object`||Array.isArray(e)))throw Error(`Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object`);let r=Tt(),i=Ot(),a=St(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);process.env.NODE_ENV!==`production`&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Mt(o),kt(o,i,s),At(i);let l=!a.getQueryCache().get(o.queryHash),[d]=u.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),p=!r&&c;if(u.useSyncExternalStore(u.useCallback(e=>{let t=p?d.subscribe(A.batchCalls(e)):O;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),u.useEffect(()=>{d.setOptions(o)},[o,d]),Pt(o,f))throw Ft(o,d,i);if(jt({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!Ge.isServer()&&Nt(f,r)&&(l?Ft(o,d,i):s?.promise)?.catch(O).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}function Lt(e,t){return It(e,ct,t)}var Rt=e=>(e?.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads`,...e}),zt=e=>(e.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/{threadUid}`,...e}),Bt=e=>(e.client??me).post({...h,security:[{scheme:`bearer`,type:`http`}],url:`/attachments/upload`,...e,headers:{"Content-Type":null,...e.headers}}),Vt=e=>(e.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/attachments/{filename}`,...e}),Ht=e=>(e?.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/unique-thread-id`,...e}),Ut=e=>(e.client??me).post({security:[{scheme:`bearer`,type:`http`}],url:`/chat/sandbox`,...e,headers:{"Content-Type":`application/json`,...e.headers}}),Wt=e=>(e.client??me).delete({security:[{scheme:`bearer`,type:`http`}],url:`/chat/sandbox/{threadId}`,...e}),Gt=e=>(e.client??me).get({security:[{scheme:`bearer`,type:`http`}],url:`/artifacts/{threadId}/{filename}`,...e}),Kt={list:async(e=15)=>{let{data:t}=await Rt({query:{page:1,page_size:e},throwOnError:!0});return t.data??[]},get:async e=>{let{data:t}=await zt({path:{threadUid:e},throwOnError:!0});return t.data},getUniqueThreadId:async()=>{let{data:e}=await Ht({throwOnError:!0});return e.data.thread_id},createSandbox:async e=>{let{data:t}=await Ut({body:{thread_id:e},throwOnError:!0});return t.data},deleteSandbox:async e=>{let{data:t}=await Wt({path:{threadId:e},throwOnError:!1});return t}},qt={all:()=>[`widget-threads`],detail:e=>[`widget-threads`,e],uniqueId:e=>[`widget-threads`,`unique-id`,e],sandbox:e=>[`widget-threads`,`sandbox`,e]},Jt=(e=15)=>Lt({queryKey:qt.all(),queryFn:()=>Kt.list(e),staleTime:15e3,refetchOnWindowFocus:!0}),Yt=(e=!0,t)=>Lt({queryKey:qt.uniqueId(t),queryFn:()=>Kt.getUniqueThreadId(),enabled:e,staleTime:0,gcTime:0}),Xt=(e,t=!0)=>Lt({queryKey:qt.sandbox(e),queryFn:()=>Kt.createSandbox(e),enabled:!!e&&t,staleTime:0,gcTime:0,retry:3,retryDelay:1e3}),Zt=(0,u.createContext)(null);function Qt({threadId:e,children:t}){let[n,r]=(0,u.useState)(void 0);return(0,f.jsx)(Zt.Provider,{value:{step:n,setStep:r,threadId:e},children:t})}var $t;function j(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var en=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},tn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};($t=globalThis).__zod_globalConfig??($t.__zod_globalConfig={});var nn=globalThis.__zod_globalConfig;function rn(e){return e&&Object.assign(nn,e),nn}function an(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function on(e,t){return typeof t==`bigint`?t.toString():t}function sn(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function cn(e){return e==null}function ln(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var un=Symbol(`evaluating`);function M(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==un)return r===void 0&&(r=un,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fn(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function pn(e){return JSON.stringify(e)}function mn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var hn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function gn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _n=sn(()=>{if(nn.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function vn(e){if(gn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(gn(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function yn(e){return vn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var bn=new Set([`string`,`number`,`symbol`]);function xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Cn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function wn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Sn(e,fn(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return dn(this,`shape`,e),e},checks:[]}))}function Tn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Sn(e,fn(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return dn(this,`shape`,r),r},checks:[]}))}function En(e,t){if(!vn(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Sn(e,fn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return dn(this,`shape`,n),n}}))}function Dn(e,t){if(!vn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Sn(e,fn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return dn(this,`shape`,n),n}}))}function On(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Sn(e,fn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return dn(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function kn(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Sn(t,fn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return dn(this,`shape`,i),i},checks:[]}))}function An(e,t,n){return Sn(t,fn(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return dn(this,`shape`,i),i}}))}function jn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Mn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Nn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pn(e){return typeof e==`string`?e:e?.message}function Fn(e,t,n){let r=e.message?e.message:Pn(e.inst?._zod.def?.error?.(e))??Pn(t?.error?.(e))??Pn(n.customError?.(e))??Pn(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function In(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ln(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Rn=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,on,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zn=j(`$ZodError`,Rn),Bn=j(`$ZodError`,Rn,{Parent:Error});function Vn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Hn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Un=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new en;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Fn(e,a,rn())));throw hn(t,i?.callee),t}return o.value},Wn=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Fn(e,a,rn())));throw hn(t,i?.callee),t}return o.value},Gn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new en;return a.issues.length?{success:!1,error:new(e??zn)(a.issues.map(e=>Fn(e,i,rn())))}:{success:!0,data:a.value}},Kn=Gn(Bn),qn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Fn(e,i,rn())))}:{success:!0,data:a.value}},Jn=qn(Bn),Yn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Un(e)(t,n,i)},Xn=e=>(t,n,r)=>Un(e)(t,n,r),Zn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wn(e)(t,n,i)},Qn=e=>async(t,n,r)=>Wn(e)(t,n,r),$n=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gn(e)(t,n,i)},er=e=>(t,n,r)=>Gn(e)(t,n,r),tr=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qn(e)(t,n,i)},nr=e=>async(t,n,r)=>qn(e)(t,n,r),rr=/^[cC][0-9a-z]{6,}$/,ir=/^[0-9a-z]+$/,ar=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,or=/^[0-9a-vA-V]{20}$/,sr=/^[A-Za-z0-9]{27}$/,cr=/^[a-zA-Z0-9_-]{21}$/,lr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ur=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,dr=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,fr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,pr=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function mr(){return new RegExp(pr,`u`)}var hr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,gr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,_r=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,vr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,yr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,br=/^[A-Za-z0-9_-]*$/,xr=/^https?$/,Sr=/^\+[1-9]\d{6,14}$/,Cr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,wr=RegExp(`^${Cr}$`);function Tr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Er(e){return RegExp(`^${Tr(e)}$`)}function Dr(e){let t=Tr({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Cr}T(?:${r})$`)}var Or=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},kr=/^[^A-Z]*$/,Ar=/^[^a-z]*$/,jr=j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Mr=j(`$ZodCheckMaxLength`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!cn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=In(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Nr=j(`$ZodCheckMinLength`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!cn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=In(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pr=j(`$ZodCheckLengthEquals`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!cn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=In(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Fr=j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;jr.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ir=j(`$ZodCheckRegex`,(e,t)=>{Fr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Lr=j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=kr,Fr.init(e,t)}),Rr=j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ar,Fr.init(e,t)}),zr=j(`$ZodCheckIncludes`,(e,t)=>{jr.init(e,t);let n=xn(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Br=j(`$ZodCheckStartsWith`,(e,t)=>{jr.init(e,t);let n=RegExp(`^${xn(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Vr=j(`$ZodCheckEndsWith`,(e,t)=>{jr.init(e,t);let n=RegExp(`.*${xn(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Hr=j(`$ZodCheckOverwrite`,(e,t)=>{jr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ur=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
7
7
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
8
|
-
`))}},
|
|
8
|
+
`))}},Wr={major:4,minor:4,patch:3},P=j(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Wr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=jn(e),i;for(let a of t){if(a._zod.def.when){if(Mn(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new en;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=jn(e,t))});else{if(e.issues.length===t)continue;r||=jn(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(jn(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new en;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new en;return o.then(e=>t(e,r,a))}return t(o,r,a)}}M(e,`~standard`,()=>({validate:t=>{try{let n=Kn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Jn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Gr=j(`$ZodString`,(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Or(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),F=j(`$ZodStringFormat`,(e,t)=>{Fr.init(e,t),Gr.init(e,t)}),Kr=j(`$ZodGUID`,(e,t)=>{t.pattern??=ur,F.init(e,t)}),qr=j(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=dr(e)}else t.pattern??=dr();F.init(e,t)}),Jr=j(`$ZodEmail`,(e,t)=>{t.pattern??=fr,F.init(e,t)}),Yr=j(`$ZodURL`,(e,t)=>{F.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===xr.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Xr=j(`$ZodEmoji`,(e,t)=>{t.pattern??=mr(),F.init(e,t)}),Zr=j(`$ZodNanoID`,(e,t)=>{t.pattern??=cr,F.init(e,t)}),Qr=j(`$ZodCUID`,(e,t)=>{t.pattern??=rr,F.init(e,t)}),$r=j(`$ZodCUID2`,(e,t)=>{t.pattern??=ir,F.init(e,t)}),ei=j(`$ZodULID`,(e,t)=>{t.pattern??=ar,F.init(e,t)}),ti=j(`$ZodXID`,(e,t)=>{t.pattern??=or,F.init(e,t)}),ni=j(`$ZodKSUID`,(e,t)=>{t.pattern??=sr,F.init(e,t)}),ri=j(`$ZodISODateTime`,(e,t)=>{t.pattern??=Dr(t),F.init(e,t)}),ii=j(`$ZodISODate`,(e,t)=>{t.pattern??=wr,F.init(e,t)}),ai=j(`$ZodISOTime`,(e,t)=>{t.pattern??=Er(t),F.init(e,t)}),oi=j(`$ZodISODuration`,(e,t)=>{t.pattern??=lr,F.init(e,t)}),si=j(`$ZodIPv4`,(e,t)=>{t.pattern??=hr,F.init(e,t),e._zod.bag.format=`ipv4`}),ci=j(`$ZodIPv6`,(e,t)=>{t.pattern??=gr,F.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),li=j(`$ZodCIDRv4`,(e,t)=>{t.pattern??=_r,F.init(e,t)}),ui=j(`$ZodCIDRv6`,(e,t)=>{t.pattern??=vr,F.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function di(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var fi=j(`$ZodBase64`,(e,t)=>{t.pattern??=yr,F.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{di(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function pi(e){if(!br.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return di(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var mi=j(`$ZodBase64URL`,(e,t)=>{t.pattern??=br,F.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{pi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),hi=j(`$ZodE164`,(e,t)=>{t.pattern??=Sr,F.init(e,t)});function gi(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var _i=j(`$ZodJWT`,(e,t)=>{F.init(e,t),e._zod.check=n=>{gi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),vi=j(`$ZodUnknown`,(e,t)=>{P.init(e,t),e._zod.parse=e=>e}),yi=j(`$ZodNever`,(e,t)=>{P.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function bi(e,t,n){e.issues.length&&t.issues.push(...Nn(n,e.issues)),t.value[n]=e.value}var xi=j(`$ZodArray`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>bi(t,n,e))):bi(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Si(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Nn(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Ci(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Cn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wi(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Si(e,n,i,t,u,d))):Si(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Ti=j(`$ZodObject`,(e,t)=>{if(P.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=sn(()=>Ci(t));M(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=gn,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Si(n,t,e,s,r,i))):Si(a,t,e,s,r,i)}return i?wi(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ei=j(`$ZodObjectJIT`,(e,t)=>{Ti.init(e,t);let n=e._zod.parse,r=sn(()=>Ci(t)),i=e=>{let t=new Ur([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=pn(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=pn(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
9
9
|
if (${n}.issues.length) {
|
|
10
10
|
if (${o} in input) {
|
|
11
11
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
23
23
|
newResult[${o}] = ${n}.value;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
`):t.write(`
|
|
26
|
+
`):c?t.write(`
|
|
27
27
|
if (${n}.issues.length) {
|
|
28
28
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
29
29
|
...iss,
|
|
@@ -39,39 +39,64 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
39
39
|
newResult[${o}] = ${n}.value;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=hn,s=!tn.jitless,c=s&&gn.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?xi([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function wi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!An(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Nn(e,r,nn())))}),t)}var Ti=j(`$ZodUnion`,(e,t)=>{P.init(e,t),M(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),M(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),M(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),M(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>cn(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>wi(t,i,e,a)):wi(s,i,e,a)}}),Ei=j(`$ZodIntersection`,(e,t)=>{P.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Oi(e,t,n)):Oi(e,i,a)}});function Di(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_n(e)&&_n(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Di(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Di(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Oi(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),An(e))return e;let o=Di(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var ki=j(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=rn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>yn.has(typeof e)).map(e=>typeof e==`string`?bn(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ai=j(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new en(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new $t;return n.value=i,n}});function ji(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Mi=j(`$ZodOptional`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,M(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),M(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>ji(t,e.value)):ji(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ni=j(`$ZodExactOptional`,(e,t)=>{Mi.init(e,t),M(e._zod,`values`,()=>t.innerType._zod.values),M(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Pi=j(`$ZodNullable`,(e,t)=>{P.init(e,t),M(e._zod,`optin`,()=>t.innerType._zod.optin),M(e._zod,`optout`,()=>t.innerType._zod.optout),M(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cn(e.source)}|null)$`):void 0}),M(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Fi=j(`$ZodDefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,M(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ii(e,t)):Ii(r,t)}});function Ii(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Li=j(`$ZodPrefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,M(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ri=j(`$ZodNonOptional`,(e,t)=>{P.init(e,t),M(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>zi(t,e)):zi(i,e)}});function zi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Bi=j(`$ZodCatch`,(e,t)=>{P.init(e,t),M(e._zod,`optin`,()=>t.innerType._zod.optin),M(e._zod,`optout`,()=>t.innerType._zod.optout),M(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Nn(e,n,nn()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Nn(e,n,nn()))},input:e.value}),e.issues=[]),e)}}),Vi=j(`$ZodPipe`,(e,t)=>{P.init(e,t),M(e._zod,`values`,()=>t.in._zod.values),M(e._zod,`optin`,()=>t.in._zod.optin),M(e._zod,`optout`,()=>t.out._zod.optout),M(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Hi(e,t.in,n)):Hi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Hi(e,t.out,n)):Hi(r,t.out,n)}});function Hi(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Ui=j(`$ZodReadonly`,(e,t)=>{P.init(e,t),M(e._zod,`propValues`,()=>t.innerType._zod.propValues),M(e._zod,`values`,()=>t.innerType._zod.values),M(e._zod,`optin`,()=>t.innerType?._zod?.optin),M(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Wi):Wi(r)}});function Wi(e){return e.value=Object.freeze(e.value),e}var Gi=j(`$ZodCustom`,(e,t)=>{Or.init(e,t),P.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ki(t,n,r,e));Ki(i,n,r,e)}});function Ki(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Fn(e))}}var qi,Ji=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Yi(){return new Ji}(qi=globalThis).__zod_globalRegistry??(qi.__zod_globalRegistry=Yi());var Xi=globalThis.__zod_globalRegistry;function Zi(e,t){return new e({type:`string`,...N(t)})}function Qi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}function $i(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}function ea(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}function ta(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}function na(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}function ra(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}function ia(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}function aa(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}function oa(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}function sa(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}function ca(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}function la(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}function ua(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}function da(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}function fa(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}function pa(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}function ma(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}function ha(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}function ga(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}function _a(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}function va(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}function ya(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(t)})}function ba(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N(t)})}function xa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}function Sa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}function Ca(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}function wa(e){return new e({type:`unknown`})}function Ta(e,t){return new e({type:`never`,...N(t)})}function Ea(e,t){return new kr({check:`max_length`,...N(t),maximum:e})}function Da(e,t){return new Ar({check:`min_length`,...N(t),minimum:e})}function Oa(e,t){return new jr({check:`length_equals`,...N(t),length:e})}function ka(e,t){return new Nr({check:`string_format`,format:`regex`,...N(t),pattern:e})}function Aa(e){return new Pr({check:`string_format`,format:`lowercase`,...N(e)})}function ja(e){return new Fr({check:`string_format`,format:`uppercase`,...N(e)})}function Ma(e,t){return new Ir({check:`string_format`,format:`includes`,...N(t),includes:e})}function Na(e,t){return new Lr({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}function Pa(e,t){return new Rr({check:`string_format`,format:`ends_with`,...N(t),suffix:e})}function Fa(e){return new zr({check:`overwrite`,tx:e})}function Ia(e){return Fa(t=>t.normalize(e))}function La(){return Fa(e=>e.trim())}function Ra(){return Fa(e=>e.toLowerCase())}function za(){return Fa(e=>e.toUpperCase())}function Ba(){return Fa(e=>pn(e))}function Va(e,t,n){return new e({type:`array`,element:t,...N(n)})}function Ha(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N(n)})}function Ua(e){let t=Wa(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Fn(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Fn(r))}},e(n.value,n)));return t}function Wa(e,t){let n=new Or({check:`custom`,...N(t)});return n._zod.check=e,n}function Ga(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Xi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function I(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,I(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&L(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ka(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
42
|
+
`):t.write(`
|
|
43
|
+
const ${n}_present = ${o} in input;
|
|
44
|
+
if (${n}.issues.length) {
|
|
45
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
46
|
+
...iss,
|
|
47
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
48
|
+
})));
|
|
49
|
+
}
|
|
50
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
51
|
+
payload.issues.push({
|
|
52
|
+
code: "invalid_type",
|
|
53
|
+
expected: "nonoptional",
|
|
54
|
+
input: undefined,
|
|
55
|
+
path: [${o}]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (${n}_present) {
|
|
60
|
+
if (${n}.value === undefined) {
|
|
61
|
+
newResult[${o}] = undefined;
|
|
62
|
+
} else {
|
|
63
|
+
newResult[${o}] = ${n}.value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=gn,s=!nn.jitless,c=s&&_n.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?wi([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Di(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!jn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Fn(e,r,rn())))}),t)}var Oi=j(`$ZodUnion`,(e,t)=>{P.init(e,t),M(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),M(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),M(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),M(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ln(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Di(t,r,e,i)):Di(o,r,e,i)}}),ki=j(`$ZodIntersection`,(e,t)=>{P.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ji(e,t,n)):ji(e,i,a)}});function Ai(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(vn(e)&&vn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ai(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ai(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ji(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),jn(e))return e;let o=Ai(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Mi=j(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=an(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>bn.has(typeof e)).map(e=>typeof e==`string`?xn(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ni=j(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new en;return n.value=i,n.fallback=!0,n}});function Pi(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Fi=j(`$ZodOptional`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,M(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),M(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ln(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Pi(e,r)):Pi(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ii=j(`$ZodExactOptional`,(e,t)=>{Fi.init(e,t),M(e._zod,`values`,()=>t.innerType._zod.values),M(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Li=j(`$ZodNullable`,(e,t)=>{P.init(e,t),M(e._zod,`optin`,()=>t.innerType._zod.optin),M(e._zod,`optout`,()=>t.innerType._zod.optout),M(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ln(e.source)}|null)$`):void 0}),M(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ri=j(`$ZodDefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,M(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>zi(e,t)):zi(r,t)}});function zi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Bi=j(`$ZodPrefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,M(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Vi=j(`$ZodNonOptional`,(e,t)=>{P.init(e,t),M(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Hi(t,e)):Hi(i,e)}});function Hi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Ui=j(`$ZodCatch`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,M(e._zod,`optout`,()=>t.innerType._zod.optout),M(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Fn(e,n,rn()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Fn(e,n,rn()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Wi=j(`$ZodPipe`,(e,t)=>{P.init(e,t),M(e._zod,`values`,()=>t.in._zod.values),M(e._zod,`optin`,()=>t.in._zod.optin),M(e._zod,`optout`,()=>t.out._zod.optout),M(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gi(e,t.in,n)):Gi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gi(e,t.out,n)):Gi(r,t.out,n)}});function Gi(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Ki=j(`$ZodReadonly`,(e,t)=>{P.init(e,t),M(e._zod,`propValues`,()=>t.innerType._zod.propValues),M(e._zod,`values`,()=>t.innerType._zod.values),M(e._zod,`optin`,()=>t.innerType?._zod?.optin),M(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(qi):qi(r)}});function qi(e){return e.value=Object.freeze(e.value),e}var Ji=j(`$ZodCustom`,(e,t)=>{jr.init(e,t),P.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Yi(t,n,r,e));Yi(i,n,r,e)}});function Yi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ln(e))}}var Xi,Zi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Qi(){return new Zi}(Xi=globalThis).__zod_globalRegistry??(Xi.__zod_globalRegistry=Qi());var $i=globalThis.__zod_globalRegistry;function ea(e,t){return new e({type:`string`,...N(t)})}function ta(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}function na(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}function ra(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}function ia(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}function aa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}function oa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}function sa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}function ca(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}function la(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}function ua(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}function da(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}function fa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}function pa(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}function ma(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}function ha(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}function ga(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}function _a(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}function va(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}function ya(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}function ba(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}function xa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}function Sa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(t)})}function Ca(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N(t)})}function wa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}function Ta(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}function Ea(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}function Da(e){return new e({type:`unknown`})}function Oa(e,t){return new e({type:`never`,...N(t)})}function ka(e,t){return new Mr({check:`max_length`,...N(t),maximum:e})}function Aa(e,t){return new Nr({check:`min_length`,...N(t),minimum:e})}function ja(e,t){return new Pr({check:`length_equals`,...N(t),length:e})}function Ma(e,t){return new Ir({check:`string_format`,format:`regex`,...N(t),pattern:e})}function Na(e){return new Lr({check:`string_format`,format:`lowercase`,...N(e)})}function Pa(e){return new Rr({check:`string_format`,format:`uppercase`,...N(e)})}function Fa(e,t){return new zr({check:`string_format`,format:`includes`,...N(t),includes:e})}function Ia(e,t){return new Br({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}function La(e,t){return new Vr({check:`string_format`,format:`ends_with`,...N(t),suffix:e})}function Ra(e){return new Hr({check:`overwrite`,tx:e})}function za(e){return Ra(t=>t.normalize(e))}function Ba(){return Ra(e=>e.trim())}function Va(){return Ra(e=>e.toLowerCase())}function Ha(){return Ra(e=>e.toUpperCase())}function Ua(){return Ra(e=>mn(e))}function Wa(e,t,n){return new e({type:`array`,element:t,...N(n)})}function Ga(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N(n)})}function Ka(e,t){let n=qa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ln(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ln(r))}},e(t.value,t)),t);return n}function qa(e,t){let n=new jr({check:`custom`,...N(t)});return n._zod.check=e,n}function Ja(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??$i,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function I(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,I(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&L(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ya(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
43
68
|
|
|
44
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function qa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Ya(t,`input`,e.processors),output:Ya(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function L(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return L(r.element,n);if(r.type===`set`)return L(r.valueType,n);if(r.type===`lazy`)return L(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return L(r.innerType,n);if(r.type===`intersection`)return L(r.left,n)||L(r.right,n);if(r.type===`record`||r.type===`map`)return L(r.keyType,n)||L(r.valueType,n);if(r.type===`pipe`)return L(r.in,n)||L(r.out,n);if(r.type===`object`){for(let e in r.shape)if(L(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(L(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(L(e,n))return!0;return!!(r.rest&&L(r.rest,n))}return!1}var Ja=(e,t={})=>n=>{let r=Ga({...n,processors:t});return I(e,r),Ka(r,e),qa(r,e)},Ya=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return I(e,o),Ka(o,e),qa(o,e)},Xa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Za=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Xa[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Qa=(e,t,n,r)=>{n.not={}},$a=(e,t,n,r)=>{let i=e._zod.def,a=rn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},eo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},to=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},no=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=I(a.element,t,{...r,path:[...r.path,`items`]})},ro=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=I(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=I(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},io=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>I(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ao=(e,t,n,r)=>{let i=e._zod.def,a=I(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=I(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},oo=(e,t,n,r)=>{let i=e._zod.def,a=I(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},so=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},co=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},lo=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},uo=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},fo=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;I(a,t,r);let o=t.seen.get(e);o.ref=a},po=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},mo=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ho=j(`ZodISODateTime`,(e,t)=>{ei.init(e,t),z.init(e,t)});function go(e){return ba(ho,e)}var _o=j(`ZodISODate`,(e,t)=>{ti.init(e,t),z.init(e,t)});function vo(e){return xa(_o,e)}var yo=j(`ZodISOTime`,(e,t)=>{ni.init(e,t),z.init(e,t)});function bo(e){return Sa(yo,e)}var xo=j(`ZodISODuration`,(e,t)=>{ri.init(e,t),z.init(e,t)});function So(e){return Ca(xo,e)}var Co=(e,t)=>{Ln.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Bn(e,t)},flatten:{value:t=>zn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,an,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,an,2)}},isEmpty:{get(){return e.issues.length===0}}})};j(`ZodError`,Co);var wo=j(`ZodError`,Co,{Parent:Error}),To=Vn(wo),Eo=Hn(wo),Do=Un(wo),Oo=Gn(wo),ko=qn(wo),Ao=Jn(wo),jo=Yn(wo),Mo=Xn(wo),No=Zn(wo),Po=Qn(wo),Fo=$n(wo),Io=er(wo),R=j(`ZodType`,(e,t)=>(P.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ya(e,`input`),output:Ya(e,`output`)}}),e.toJSONSchema=Ja(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(dn(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>xn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>To(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Do(e,t,n),e.parseAsync=async(t,n)=>Eo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Oo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ko(e,t,n),e.decode=(t,n)=>Ao(e,t,n),e.encodeAsync=async(t,n)=>jo(e,t,n),e.decodeAsync=async(t,n)=>Mo(e,t,n),e.safeEncode=(t,n)=>No(e,t,n),e.safeDecode=(t,n)=>Po(e,t,n),e.safeEncodeAsync=async(t,n)=>Fo(e,t,n),e.safeDecodeAsync=async(t,n)=>Io(e,t,n),e.refine=(t,n)=>e.check(Bs(t,n)),e.superRefine=t=>e.check(Vs(t)),e.overwrite=t=>e.check(Fa(t)),e.optional=()=>Ss(e),e.exactOptional=()=>ws(e),e.nullable=()=>Es(e),e.nullish=()=>Ss(Es(e)),e.nonoptional=t=>Ms(e,t),e.array=()=>us(e),e.or=t=>ms([e,t]),e.and=t=>gs(e,t),e.transform=t=>Is(e,bs(t)),e.default=t=>Os(e,t),e.prefault=t=>As(e,t),e.catch=t=>Ps(e,t),e.pipe=t=>Is(e,t),e.readonly=()=>Rs(e),e.describe=t=>{let n=e.clone();return Xi.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Xi.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Xi.get(e);let n=e.clone();return Xi.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Lo=j(`_ZodString`,(e,t)=>{Hr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ka(...t)),e.includes=(...t)=>e.check(Ma(...t)),e.startsWith=(...t)=>e.check(Na(...t)),e.endsWith=(...t)=>e.check(Pa(...t)),e.min=(...t)=>e.check(Da(...t)),e.max=(...t)=>e.check(Ea(...t)),e.length=(...t)=>e.check(Oa(...t)),e.nonempty=(...t)=>e.check(Da(1,...t)),e.lowercase=t=>e.check(Aa(t)),e.uppercase=t=>e.check(ja(t)),e.trim=()=>e.check(La()),e.normalize=(...t)=>e.check(Ia(...t)),e.toLowerCase=()=>e.check(Ra()),e.toUpperCase=()=>e.check(za()),e.slugify=()=>e.check(Ba())}),Ro=j(`ZodString`,(e,t)=>{Hr.init(e,t),Lo.init(e,t),e.email=t=>e.check(Qi(Bo,t)),e.url=t=>e.check(ia(Uo,t)),e.jwt=t=>e.check(ya(is,t)),e.emoji=t=>e.check(aa(Wo,t)),e.guid=t=>e.check($i(Vo,t)),e.uuid=t=>e.check(ea(Ho,t)),e.uuidv4=t=>e.check(ta(Ho,t)),e.uuidv6=t=>e.check(na(Ho,t)),e.uuidv7=t=>e.check(ra(Ho,t)),e.nanoid=t=>e.check(oa(Go,t)),e.guid=t=>e.check($i(Vo,t)),e.cuid=t=>e.check(sa(Ko,t)),e.cuid2=t=>e.check(ca(qo,t)),e.ulid=t=>e.check(la(Jo,t)),e.base64=t=>e.check(ga(ts,t)),e.base64url=t=>e.check(_a(ns,t)),e.xid=t=>e.check(ua(Yo,t)),e.ksuid=t=>e.check(da(Xo,t)),e.ipv4=t=>e.check(fa(Zo,t)),e.ipv6=t=>e.check(pa(Qo,t)),e.cidrv4=t=>e.check(ma($o,t)),e.cidrv6=t=>e.check(ha(es,t)),e.e164=t=>e.check(va(rs,t)),e.datetime=t=>e.check(go(t)),e.date=t=>e.check(vo(t)),e.time=t=>e.check(bo(t)),e.duration=t=>e.check(So(t))});function zo(e){return Zi(Ro,e)}var z=j(`ZodStringFormat`,(e,t)=>{F.init(e,t),Lo.init(e,t)}),Bo=j(`ZodEmail`,(e,t)=>{Gr.init(e,t),z.init(e,t)}),Vo=j(`ZodGUID`,(e,t)=>{Ur.init(e,t),z.init(e,t)}),Ho=j(`ZodUUID`,(e,t)=>{Wr.init(e,t),z.init(e,t)}),Uo=j(`ZodURL`,(e,t)=>{Kr.init(e,t),z.init(e,t)}),Wo=j(`ZodEmoji`,(e,t)=>{qr.init(e,t),z.init(e,t)}),Go=j(`ZodNanoID`,(e,t)=>{Jr.init(e,t),z.init(e,t)}),Ko=j(`ZodCUID`,(e,t)=>{Yr.init(e,t),z.init(e,t)}),qo=j(`ZodCUID2`,(e,t)=>{Xr.init(e,t),z.init(e,t)}),Jo=j(`ZodULID`,(e,t)=>{Zr.init(e,t),z.init(e,t)}),Yo=j(`ZodXID`,(e,t)=>{Qr.init(e,t),z.init(e,t)}),Xo=j(`ZodKSUID`,(e,t)=>{$r.init(e,t),z.init(e,t)}),Zo=j(`ZodIPv4`,(e,t)=>{ii.init(e,t),z.init(e,t)}),Qo=j(`ZodIPv6`,(e,t)=>{ai.init(e,t),z.init(e,t)}),$o=j(`ZodCIDRv4`,(e,t)=>{oi.init(e,t),z.init(e,t)}),es=j(`ZodCIDRv6`,(e,t)=>{si.init(e,t),z.init(e,t)}),ts=j(`ZodBase64`,(e,t)=>{li.init(e,t),z.init(e,t)}),ns=j(`ZodBase64URL`,(e,t)=>{di.init(e,t),z.init(e,t)}),rs=j(`ZodE164`,(e,t)=>{fi.init(e,t),z.init(e,t)}),is=j(`ZodJWT`,(e,t)=>{mi.init(e,t),z.init(e,t)}),as=j(`ZodUnknown`,(e,t)=>{hi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function os(){return wa(as)}var ss=j(`ZodNever`,(e,t)=>{gi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r)});function cs(e){return Ta(ss,e)}var ls=j(`ZodArray`,(e,t)=>{vi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Da(t,n)),e.nonempty=t=>e.check(Da(1,t)),e.max=(t,n)=>e.check(Ea(t,n)),e.length=(t,n)=>e.check(Oa(t,n)),e.unwrap=()=>e.element});function us(e,t){return Va(ls,e,t)}var ds=j(`ZodObject`,(e,t)=>{Ci.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),M(e,`shape`,()=>t.shape),e.keyof=()=>vs(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:os()}),e.loose=()=>e.clone({...e._zod.def,catchall:os()}),e.strict=()=>e.clone({...e._zod.def,catchall:cs()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Tn(e,t),e.safeExtend=t=>En(e,t),e.merge=t=>Dn(e,t),e.pick=t=>Cn(e,t),e.omit=t=>wn(e,t),e.partial=(...t)=>On(xs,e,t[0]),e.required=(...t)=>kn(js,e,t[0])});function fs(e,t){return new ds({type:`object`,shape:e??{},...N(t)})}var ps=j(`ZodUnion`,(e,t)=>{Ti.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.options=t.options});function ms(e,t){return new ps({type:`union`,options:e,...N(t)})}var hs=j(`ZodIntersection`,(e,t)=>{Ei.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r)});function gs(e,t){return new hs({type:`intersection`,left:e,right:t})}var _s=j(`ZodEnum`,(e,t)=>{ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new _s({...t,checks:[],...N(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new _s({...t,checks:[],...N(r),entries:i})}});function vs(e,t){return new _s({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N(t)})}var ys=j(`ZodTransform`,(e,t)=>{Ai.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new en(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Fn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Fn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function bs(e){return new ys({type:`transform`,transform:e})}var xs=j(`ZodOptional`,(e,t)=>{Mi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ss(e){return new xs({type:`optional`,innerType:e})}var Cs=j(`ZodExactOptional`,(e,t)=>{Ni.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ws(e){return new Cs({type:`optional`,innerType:e})}var Ts=j(`ZodNullable`,(e,t)=>{Pi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Es(e){return new Ts({type:`nullable`,innerType:e})}var Ds=j(`ZodDefault`,(e,t)=>{Fi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Os(e,t){return new Ds({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():vn(t)}})}var ks=j(`ZodPrefault`,(e,t)=>{Li.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function As(e,t){return new ks({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():vn(t)}})}var js=j(`ZodNonOptional`,(e,t)=>{Ri.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ms(e,t){return new js({type:`nonoptional`,innerType:e,...N(t)})}var Ns=j(`ZodCatch`,(e,t)=>{Bi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ps(e,t){return new Ns({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Fs=j(`ZodPipe`,(e,t)=>{Vi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.in=t.in,e.out=t.out});function Is(e,t){return new Fs({type:`pipe`,in:e,out:t})}var Ls=j(`ZodReadonly`,(e,t)=>{Ui.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rs(e){return new Ls({type:`readonly`,innerType:e})}var zs=j(`ZodCustom`,(e,t)=>{Gi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r)});function Bs(e,t={}){return Ha(zs,e,t)}function Vs(e){return Ua(e)}fs({chartConfig:zo().describe(`Erica chart config syntax.`)});var Hs=fs({compiled_chart:fs({path:zo().describe(`Path to the chart JSON file.`)}).describe(`Compiled chart`)});fs({title:zo().describe(`Title of the report.`),reportContent:zo().describe(`Markdown content of the report.`)});var Us=fs({compiled_report:fs({title:zo().describe(`Title of the report.`),path:zo().describe(`Path to the compiled report.`)})}),Ws={get:async(e,t)=>{let{data:n}=await Gt({path:{threadId:e,filename:t},throwOnError:!0});return n}},Gs=[`bar`,`line`,`pie`,`bignumber`,`table`,`scatter`,`funnel`],Ks=/(\w+)=(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|(true|false|-?(?:\d+\.?\d*|\.\d+)))/g;function qs(e){let t={},n=new RegExp(Ks.source,Ks.flags),r;for(;(r=n.exec(e))!==null;){let e=r[2]??r[3]??r[4]??``;r[2]===void 0?r[3]!==void 0&&(e=e.replace(/\\'/g,`'`).replace(/\\\\/g,`\\`)):e=e.replace(/\\"/g,`"`).replace(/\\\\/g,`\\`),t[r[1]]=e}return t}var Js=/\{%\s*(\w+)\s+((?:(?!\/%\})[\s\S])*)\/%\}/g;function Ys(e){let t=[],n=0,r=new RegExp(Js.source,Js.flags),i;for(;(i=r.exec(e))!==null;){let[r,a,o]=i,s=i.index;s>n&&t.push({kind:`text`,content:e.slice(n,s)});let c=a.toLowerCase();if(Gs.includes(c)){let e={type:c,attrs:qs(o),raw:r};t.push({kind:`chart`,node:e})}else t.push({kind:`text`,content:r});n=s+r.length}return n<e.length&&t.push({kind:`text`,content:e.slice(n)}),t}function Xs(e,t){let n=[];switch(e){case`bar`:case`line`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`pie`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`bignumber`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`table`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`});break;case`scatter`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`funnel`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break}return n.length>0?{valid:!1,errors:n}:{valid:!0}}function Zs(e){if(e===void 0)return;let t=e.toLowerCase();if(t===`true`||t===`1`||t===`yes`)return!0;if(t===`false`||t===`0`||t===`no`)return!1}function Qs(e){if(e===void 0)return;let t=Number(e);return isNaN(t)?void 0:t}function $s(e){if(e===void 0)return;let t=Number(e);return isNaN(t)?e:t}function ec(e){if(e!==void 0)return e.includes(`,`)?e.split(`,`).map(e=>e.trim()):e}function tc(e){if(e!==void 0)return e.split(`,`).map(e=>e.trim())}function nc(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function rc(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function ic(e){let t={};for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function ac({option:e,style:t={height:`400px`,width:`100%`},settings:n={notMerge:!0},theme:r}){let i=(0,u.useRef)(null),a=(0,u.useRef)(null);return(0,u.useEffect)(()=>{i.current&&(a.current=p.init(i.current,r));let e=()=>{a.current?.resize()};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e),a.current?.dispose()}},[r]),(0,u.useEffect)(()=>{if(a.current&&e){let t={...e,grid:{left:30,right:30,top:100,bottom:50,containLabel:!0},toolbox:{show:!0,...e.toolbox,feature:{saveAsImage:{show:!0,title:`Download`,pixelRatio:2},restore:{show:!0},...e.toolbox?.feature||{}}}};a.current.setOption(t,n)}},[e,n]),(0,f.jsx)(`div`,{ref:i,style:t})}function oc({sql:e,data:t,x:n,y:r,title:i,height:a=`400px`,color:o,xAxisName:s,yAxisName:c,horizontal:l=!1,stack:d=!1,seriesNames:p}){let[m,h]=(0,u.useState)(!1),g=(0,u.useMemo)(()=>Array.isArray(r)?r:[r],[r]),_=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),v=(0,u.useMemo)(()=>{if(!_?.rows?.length)return null;let e=_.rows.map(e=>String(e[n]??``)),t=g.map(e=>({name:p?.[e]??e,type:`bar`,data:_.rows.map(t=>t[e]??null),stack:d?`total`:void 0,label:m?{show:!0,position:l?`right`:`top`}:void 0}));return ic({title:i?{text:i}:void 0,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`}},toolbox:{feature:{myToggleLabels:{show:!0,title:m?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>h(e=>!e)}}},legend:g.length>1?{show:!0}:void 0,color:o?Array.isArray(o)?o:[o]:void 0,grid:{containLabel:!0},...l?{xAxis:{type:`value`,name:s},yAxis:{type:`category`,data:e,name:c}}:{xAxis:{type:`category`,data:e,name:s},yAxis:{type:`value`,name:c}},series:t})},[_,n,g,i,o,s,c,l,p,m,d]),y={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:y,className:`bar-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`bar-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):v?(0,f.jsx)(ac,{option:v,style:y}):(0,f.jsx)(`div`,{style:y,className:`bar-chart-no-data`,children:(0,f.jsx)(`p`,{className:`bar-chart-no-data-text`,children:`No data`})})}function sc({sql:e,data:t,x:n,y:r,title:i,height:a=`400px`,color:o,xAxisName:s,yAxisName:c,smooth:l=!1,area:d=!1,seriesNames:p,secondary_y:m,secondary_title:h,prefix:g,suffix:_}){let[v,y]=(0,u.useState)(!1),b=(0,u.useMemo)(()=>Array.isArray(r)?r:[r],[r]),x=(0,u.useMemo)(()=>m?Array.isArray(m)?m:[m]:[],[m]),S=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),C=(0,u.useMemo)(()=>{if(!S?.rows?.length)return null;let e=S.rows.map(e=>String(e[n]??``)),t=b.map(e=>({name:p?.[e]??e,type:`line`,data:S.rows.map(t=>t[e]??null),smooth:l,areaStyle:d?{}:void 0,yAxisIndex:0,label:v?{show:!0,position:`top`}:void 0})),r=x.map(e=>({name:p?.[e]??e,type:`line`,data:S.rows.map(t=>t[e]??null),smooth:l,yAxisIndex:1,label:v?{show:!0,position:`top`}:void 0})),a=[...t,...r],u=x.length>0;return ic({title:i?{text:i}:void 0,tooltip:{trigger:`axis`,valueFormatter:e=>`${g||``}${String(e??``)}${_||``}`},toolbox:{feature:{myToggleLabels:{show:!0,title:v?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>y(e=>!e)}}},legend:b.length>1||u?{show:!0}:void 0,color:o?Array.isArray(o)?o:[o]:void 0,grid:{containLabel:!0},xAxis:{type:`category`,data:e,name:s},yAxis:u?[{type:`value`,name:c},{type:`value`,name:h}]:{type:`value`,name:c},series:a})},[S,n,b,x,i,o,s,c,h,l,d,p,v,g,_]),w={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:w,className:`line-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`line-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):C?(0,f.jsx)(ac,{option:C,style:w}):(0,f.jsx)(`div`,{style:w,className:`line-chart-no-data`,children:(0,f.jsx)(`p`,{className:`line-chart-no-data-text`,children:`No data`})})}var cc={red:`#dc2626`,green:`#16a34a`,blue:`#2563eb`,yellow:`#ca8a04`,orange:`#ea580c`,purple:`#9333ea`,pink:`#db2777`,gray:`#6b7280`,black:`#111827`,white:`#ffffff`},lc=e=>{if(!e)return null;let t=e.indexOf(`|`);if(t===-1)return{text:e};let n=e.slice(0,t).trim().toLowerCase(),r=e.slice(t+1).trim();return r?{text:r,color:cc[n]??n}:{text:e}};function uc({sql:e,data:t,value:n,title:r=`Big Number`,subtitle:i,description:a,height:o=`170px`,prefix:s=``,suffix:c=``,decimals:l=0}){let d=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),p=(0,u.useMemo)(()=>d?.rows?.length?d.rows[0]?.[n]??null:null,[d,n]),m=(0,u.useMemo)(()=>{if(p==null||p===``)return`--`;let e=Number(p);return Number.isNaN(e)?String(p):`${s}${e.toLocaleString(void 0,{minimumFractionDigits:l,maximumFractionDigits:l})}${c}`},[p,s,c,l]),h=(0,u.useMemo)(()=>lc(r),[r]),g=(0,u.useMemo)(()=>lc(i),[i]),_=(0,u.useMemo)(()=>lc(a),[a]),v=(0,u.useMemo)(()=>lc(m),[m]);return e&&!t?(0,f.jsx)(`div`,{className:`big-number-warning`,children:(0,f.jsx)(`p`,{className:`big-number-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):(0,f.jsxs)(`div`,{className:`big-number-container`,children:[(0,f.jsxs)(`div`,{className:`big-number-header`,children:[(0,f.jsx)(`p`,{className:`big-number-title`,style:h?.color?{color:h.color}:void 0,children:h?.text??r}),g?(0,f.jsx)(`p`,{className:`big-number-subtitle`,style:g.color?{color:g.color}:void 0,children:g.text}):null]}),(0,f.jsxs)(`div`,{className:`big-number-value-section`,children:[(0,f.jsx)(`p`,{className:`big-number-value`,style:v?.color?{color:v.color}:void 0,children:v?.text??m}),_?(0,f.jsx)(`p`,{className:`big-number-description`,style:_.color?{color:_.color}:void 0,children:_.text}):null]})]})}function dc({sql:e,data:t,name:n,value:r,title:i,height:a=`400px`,showLabels:o=!0,showLegend:s=!1,sort:c=`descending`}){let[l,d]=(0,u.useState)(o),[p,m]=(0,u.useState)(s),h=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),g=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[n]??``),value:Number(e[r]??0)}));return ic({title:i?{text:i}:void 0,tooltip:{trigger:`item`,formatter:`{b}: {c}`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:p?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>m(e=>!e)}}},legend:p?{show:!0,top:`bottom`}:void 0,series:[{type:`funnel`,left:`10%`,top:60,bottom:20,width:`80%`,min:0,minSize:`0%`,maxSize:`100%`,sort:c,gap:4,label:{show:l,position:`inside`,formatter:`{b}: {c}`},emphasis:{label:{fontSize:14}},data:e}]})},[h,n,r,i,c,l,p]),_={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:_,className:`funnel-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`funnel-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):g?(0,f.jsx)(ac,{option:g,style:_}):(0,f.jsx)(`div`,{style:_,className:`funnel-chart-no-data`,children:(0,f.jsx)(`p`,{className:`funnel-chart-no-data-text`,children:`No data`})})}var fc=e=>e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e);function pc({sql:e,data:t,title:n,height:r=`400px`,columns:i,maxRows:a}){let o=(0,u.useMemo)(()=>{if(t){let e=t;return{rows:e,columns:e.length>0?Object.keys(e[0]):[]}}return null},[t]),s=(0,u.useMemo)(()=>{let e=o?.columns?.length?o.columns:[];return i?.length?i.filter(t=>e.includes(t)):e},[o,i]),c=(0,u.useMemo)(()=>{let e=o?.rows??[];return!a||a<=0?e:e.slice(0,a)},[o,a]),l={height:typeof r==`number`?`${r}px`:r,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:{...l,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`table-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`table-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):!s.length||!c.length?(0,f.jsx)(`div`,{style:{...l,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`table-chart-no-data`,children:(0,f.jsx)(`p`,{className:`table-chart-no-data-text`,children:`No data`})}):(0,f.jsxs)(`div`,{style:l,className:`table-chart-container`,children:[n?(0,f.jsx)(`div`,{className:`table-chart-title-wrapper`,children:(0,f.jsx)(`p`,{className:`table-chart-title`,children:n})}):null,(0,f.jsx)(`div`,{className:`table-chart-table-wrapper`,children:(0,f.jsxs)(`table`,{className:`table-chart-table`,children:[(0,f.jsx)(`thead`,{className:`table-chart-thead`,children:(0,f.jsx)(`tr`,{children:s.map(e=>(0,f.jsx)(`th`,{className:`table-chart-th`,children:e},e))})}),(0,f.jsx)(`tbody`,{children:c.map((e,t)=>(0,f.jsx)(`tr`,{className:`table-chart-tr`,children:s.map(n=>(0,f.jsx)(`td`,{className:`table-chart-td`,children:(0,f.jsx)(`div`,{className:`table-chart-cell-content`,children:fc(e[n])})},`${t}-${n}`))},String(e._erica_id??t)))})]})})]})}function mc({sql:e,data:t,name:n,value:r,title:i,height:a=`400px`,donut:o=!1,showLabels:s=!0,showLegend:c=!0}){let[l,d]=(0,u.useState)(s),[p,m]=(0,u.useState)(c),h=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),g=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[n]??``),value:Number(e[r]??0)}));return ic({title:i?{text:i}:void 0,tooltip:{trigger:`item`,formatter:`{a} <br/>{b}: {c} ({d}%)`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:p?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>m(e=>!e)}}},legend:p?{show:!0,orient:`vertical`,left:`left`}:void 0,series:[{name:i??`Data`,type:`pie`,radius:o?[`40%`,`70%`]:`70%`,data:e,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:`rgba(0, 0, 0, 0.5)`}},label:{show:l,formatter:`{b}: {c} ({d}%)`}}]})},[h,n,r,i,o,l,p]),_={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:_,className:`pie-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`pie-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):g?(0,f.jsx)(ac,{option:g,style:_}):(0,f.jsx)(`div`,{style:_,className:`pie-chart-no-data`,children:(0,f.jsx)(`p`,{className:`pie-chart-no-data-text`,children:`No data`})})}function hc({sql:e,data:t,x:n,y:r,seriesBy:i,size:a,color:o,title:s,height:c=`400px`,xAxisName:l,yAxisName:d,seriesNames:p}){let[m,h]=(0,u.useState)(!1),g=(0,u.useMemo)(()=>Array.isArray(r)?r:[r],[r]),_=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),v=(0,u.useMemo)(()=>{if(!_?.rows?.length)return null;let e=(e,t)=>{let r=[Number(e[n]??0),Number(e[t]??0)];return a&&r.push(Number(e[a]??0)),o&&r.push(String(e[o]??``)),r},t=i?_.rows.reduce((e,t)=>{let n=String(t[i]??`Unknown`);return e[n]||(e[n]=[]),e[n].push(t),e},{}):null,r=(e,t)=>({name:t,type:`scatter`,symbolSize:a?e=>Math.sqrt(e[2])*2:10,data:e,label:m?{show:!0,formatter:e=>{let t=e.value;return`${t[0]}, ${t[1]}`}}:void 0,itemStyle:o?{color:e=>{let t=e.value,n=t[t.length-1],r=[`#5470c6`,`#91cc75`,`#fac858`,`#ee6666`,`#73c0de`,`#3ba272`,`#fc8452`,`#9a60b4`,`#ea7ccc`];return r[n.split(``).reduce((e,t)=>e+t.charCodeAt(0),0)%r.length]}}:void 0}),c=t?Object.entries(t).flatMap(([t,n])=>g.map(i=>{let a=p?.[t]??t,o=p?.[i]??i,s=g.length>1?`${a} - ${o}`:a;return r(n.map(t=>e(t,i)),s)})):g.map(t=>r(_.rows.map(n=>e(n,t)),p?.[t]??t));return ic({title:s?{text:s}:void 0,tooltip:{trigger:`item`,formatter:e=>{let t=e.value,r=`${e.seriesName?`${e.seriesName}<br/>`:``}${n}: ${t[0]}<br/>${d??`Value`}: ${t[1]}`,i=2;return a&&(r+=`<br/>${a}: ${t[i++]}`),o&&(r+=`<br/>${o}: ${t[i]}`),r}},toolbox:{feature:{myToggleLabels:{show:!0,title:m?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>h(e=>!e)}}},xAxis:{type:`value`,name:l,scale:!0},yAxis:{type:`value`,name:d,scale:!0},legend:c.length>1?{show:!0}:void 0,series:c})},[_,n,g,i,a,o,s,l,d,m,p]),y={height:typeof c==`number`?`${c}px`:c,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:y,className:`scatter-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`scatter-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):v?(0,f.jsx)(ac,{option:v,style:y}):(0,f.jsx)(`div`,{style:y,className:`scatter-chart-no-data`,children:(0,f.jsx)(`p`,{className:`scatter-chart-no-data-text`,children:`No data`})})}function gc({type:e,errors:t}){return(0,f.jsxs)(`div`,{className:`erica-chart-error`,children:[(0,f.jsxs)(`p`,{className:`erica-chart-error-title`,children:[`Erica Chart syntax error — `,(0,f.jsx)(`code`,{children:e})]}),(0,f.jsx)(`ul`,{className:`erica-chart-error-list`,children:t.map(e=>(0,f.jsx)(`li`,{className:`erica-chart-error-item`,children:e.message},e.field))})]})}function _c(e){let{type:t,attrs:n}=e,r=Xs(t,n);if(!r.valid)return(0,f.jsx)(gc,{type:t,errors:r.errors});switch(t){case`bar`:return(0,f.jsx)(oc,{sql:n.sql,data:rc(n.data),x:n.x,y:ec(n.y)??n.y,title:n.title,height:$s(n.height),color:ec(n.color),xAxisName:n.xAxisName,yAxisName:n.yAxisName,horizontal:Zs(n.horizontal),stack:Zs(n.stack),seriesNames:nc(n.seriesNames)});case`line`:return(0,f.jsx)(sc,{sql:n.sql,data:rc(n.data),x:n.x,y:ec(n.y)??n.y,title:n.title,height:$s(n.height),color:ec(n.color),xAxisName:n.xAxisName||n.x_title,yAxisName:n.yAxisName||n.y_title,smooth:Zs(n.smooth),area:Zs(n.area),seriesNames:nc(n.seriesNames),secondary_y:ec(n.secondary_y),secondary_title:n.secondary_title,prefix:n.prefix,suffix:n.suffix});case`bignumber`:return(0,f.jsx)(uc,{sql:n.sql,data:rc(n.data),value:n.value,title:n.title,subtitle:n.subtitle,description:n.description,height:$s(n.height),prefix:n.prefix,suffix:n.suffix,decimals:Qs(n.decimals)});case`funnel`:return(0,f.jsx)(dc,{sql:n.sql,data:rc(n.data),name:n.name||n.label||n.stage||n.x,value:n.value||n.y,title:n.title,height:$s(n.height),showLabels:Zs(n.showLabels),showLegend:Zs(n.showLegend),sort:n.sort});case`scatter`:return(0,f.jsx)(hc,{sql:n.sql,data:rc(n.data),x:n.x,y:ec(n.y)??n.y,seriesBy:n.seriesBy,size:n.size,color:n.color,title:n.title,height:$s(n.height),xAxisName:n.xAxisName,yAxisName:n.yAxisName,seriesNames:nc(n.seriesNames)});case`pie`:return(0,f.jsx)(mc,{sql:n.sql,data:rc(n.data),name:n.name||n.label||n.x,value:n.value||n.y,title:n.title,height:$s(n.height),donut:Zs(n.donut),showLabels:Zs(n.showLabels),showLegend:Zs(n.showLegend)});case`table`:return(0,f.jsx)(pc,{sql:n.sql,data:rc(n.data),title:n.title,height:$s(n.height),columns:tc(n.columns),maxRows:Qs(n.maxRows)});default:return(0,f.jsxs)(`div`,{className:`erica-chart-unimplemented`,children:[(0,f.jsxs)(`div`,{className:`erica-chart-unimplemented-title`,children:[`Chart type "`,t,`" not implemented yet`]}),(0,f.jsx)(`pre`,{className:`erica-chart-unimplemented-pre`,children:JSON.stringify(n,null,2)})]})}}function vc({markdown:e}){return(0,f.jsx)(`div`,{className:`erica-chart-container`,children:(0,u.useMemo)(()=>Ys(e),[e]).map((e,t)=>e.kind===`text`?e.content.trim()?(0,f.jsx)(`div`,{className:`erica-chart-text`,children:e.content},t):null:(0,f.jsx)(`div`,{className:`erica-chart-wrapper`,children:_c(e.node)},t))})}function yc({chartConfig:e}){return(0,f.jsx)(`div`,{className:`chart-card-container`,children:(0,f.jsx)(vc,{markdown:e})})}function bc({path:e}){let t=(0,u.useContext)(Zt)?.threadId||``,{data:n,isLoading:r}=Lt({queryKey:[`artifact`,t,e],queryFn:async()=>await Ws.get(t,e),enabled:!!t&&!!e});return r?(0,f.jsx)(`div`,{className:`chart-loader-loading`,children:`loading chart...`}):n?(0,f.jsx)(yc,{chartConfig:n}):(0,f.jsx)(`div`,{className:`chart-loader-no-data`,children:`No chart data available`})}var xc=(0,u.createContext)(null);function Sc({children:e}){let[t,n]=(0,u.useState)(!1),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(`Artifacts`);return(0,f.jsx)(xc.Provider,{value:{isOpen:t,onOpen:()=>n(!0),onClose:()=>n(!1),content:r,setContent:i,title:a,setTitle:o},children:e})}var Cc=()=>(0,u.useContext)(xc)||{isOpen:!1,onOpen:()=>{},onClose:()=>{},content:null,setContent:()=>{},title:`Artifacts`,setTitle:()=>{}};function wc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Tc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ec=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dc={};function Oc(e,t){return((t||Dc).jsx?Ec:Tc).test(e)}var kc=/[ \t\n\f\r]/g;function Ac(e){return typeof e==`object`?e.type===`text`?jc(e.value):!1:jc(e)}function jc(e){return e.replace(kc,``)===``}var Mc=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Mc.prototype.normal={},Mc.prototype.property={},Mc.prototype.space=void 0;function Nc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Mc(n,r,t)}function Pc(e){return e.toLowerCase()}var B=class{constructor(e,t){this.attribute=t,this.property=e}};B.prototype.attribute=``,B.prototype.booleanish=!1,B.prototype.boolean=!1,B.prototype.commaOrSpaceSeparated=!1,B.prototype.commaSeparated=!1,B.prototype.defined=!1,B.prototype.mustUseProperty=!1,B.prototype.number=!1,B.prototype.overloadedBoolean=!1,B.prototype.property=``,B.prototype.spaceSeparated=!1,B.prototype.space=void 0;var Fc=s({boolean:()=>V,booleanish:()=>H,commaOrSpaceSeparated:()=>zc,commaSeparated:()=>Rc,number:()=>U,overloadedBoolean:()=>Lc,spaceSeparated:()=>W}),Ic=0,V=Bc(),H=Bc(),Lc=Bc(),U=Bc(),W=Bc(),Rc=Bc(),zc=Bc();function Bc(){return 2**++Ic}var Vc=Object.keys(Fc),Hc=class extends B{constructor(e,t,n,r){let i=-1;if(super(e,t),Uc(this,`space`,r),typeof n==`number`)for(;++i<Vc.length;){let e=Vc[i];Uc(this,Vc[i],(n&Fc[e])===Fc[e])}}};Hc.prototype.defined=!0;function Uc(e,t,n){n&&(e[t]=n)}function Wc(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Hc(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Pc(r)]=r,n[Pc(a.attribute)]=r}return new Mc(t,n,e.space)}var Gc=Wc({properties:{ariaActiveDescendant:null,ariaAtomic:H,ariaAutoComplete:null,ariaBusy:H,ariaChecked:H,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:W,ariaCurrent:null,ariaDescribedBy:W,ariaDetails:null,ariaDisabled:H,ariaDropEffect:W,ariaErrorMessage:null,ariaExpanded:H,ariaFlowTo:W,ariaGrabbed:H,ariaHasPopup:null,ariaHidden:H,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:W,ariaLevel:U,ariaLive:null,ariaModal:H,ariaMultiLine:H,ariaMultiSelectable:H,ariaOrientation:null,ariaOwns:W,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:H,ariaReadOnly:H,ariaRelevant:null,ariaRequired:H,ariaRoleDescription:W,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:H,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Kc(e,t){return t in e?e[t]:t}function qc(e,t){return Kc(e,t.toLowerCase())}var Jc=Wc({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Rc,acceptCharset:W,accessKey:W,action:null,allow:null,allowFullScreen:V,allowPaymentRequest:V,allowUserMedia:V,alt:null,as:null,async:V,autoCapitalize:null,autoComplete:W,autoFocus:V,autoPlay:V,blocking:W,capture:null,charSet:null,checked:V,cite:null,className:W,cols:U,colSpan:null,content:null,contentEditable:H,controls:V,controlsList:W,coords:U|Rc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:V,defer:V,dir:null,dirName:null,disabled:V,download:Lc,draggable:H,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:V,formTarget:null,headers:W,height:U,hidden:Lc,high:U,href:null,hrefLang:null,htmlFor:W,httpEquiv:W,id:null,imageSizes:null,imageSrcSet:null,inert:V,inputMode:null,integrity:null,is:null,isMap:V,itemId:null,itemProp:W,itemRef:W,itemScope:V,itemType:W,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:V,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:V,muted:V,name:null,nonce:null,noModule:V,noValidate:V,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:V,optimum:U,pattern:null,ping:W,placeholder:null,playsInline:V,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:V,referrerPolicy:null,rel:W,required:V,reversed:V,rows:U,rowSpan:U,sandbox:W,scope:null,scoped:V,seamless:V,selected:V,shadowRootClonable:V,shadowRootDelegatesFocus:V,shadowRootMode:null,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:H,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:V,useMap:null,value:H,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:W,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:V,declare:V,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:V,noHref:V,noShade:V,noWrap:V,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:H,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:V,disableRemotePlayback:V,prefix:null,property:null,results:U,security:null,unselectable:null},space:`html`,transform:qc}),Yc=Wc({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:zc,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:W,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:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:V,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,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:Rc,g2:Rc,glyphName:Rc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:zc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,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:U,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:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:W,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zc,rev:zc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zc,requiredFeatures:zc,requiredFonts:zc,requiredFormats:zc,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:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:zc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zc,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Kc}),Xc=Wc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Zc=Wc({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:qc}),Qc=Wc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),$c={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`},el=/[A-Z]/g,tl=/-[a-z]/g,nl=/^data[-\w.:]+$/i;function rl(e,t){let n=Pc(t),r=t,i=B;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&nl.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(tl,al);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!tl.test(e)){let n=e.replace(el,il);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Hc}return new i(r,t)}function il(e){return`-`+e.toLowerCase()}function al(e){return e.charAt(1).toUpperCase()}var ol=Nc([Gc,Jc,Xc,Zc,Qc],`html`),sl=Nc([Gc,Yc,Xc,Zc,Qc],`svg`);function cl(e){return e.join(` `).trim()}var ll=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
45
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),ul=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(ll());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),dl=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),fl=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ul()),r=dl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),pl=hl(`end`),ml=hl(`start`);function hl(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function gl(e){let t=ml(e),n=pl(e);if(t&&n)return{start:t,end:n}}function _l(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?yl(e.position):`start`in e||`end`in e?yl(e):`line`in e||`column`in e?vl(e):``}function vl(e){return bl(e&&e.line)+`:`+bl(e&&e.column)}function yl(e){return vl(e&&e.start)+`-`+vl(e&&e.end)}function bl(e){return e&&typeof e==`number`?e:1}var G=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=_l(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};G.prototype.file=``,G.prototype.name=``,G.prototype.reason=``,G.prototype.message=``,G.prototype.stack=``,G.prototype.column=void 0,G.prototype.line=void 0,G.prototype.ancestors=void 0,G.prototype.cause=void 0,G.prototype.fatal=void 0,G.prototype.place=void 0,G.prototype.ruleId=void 0,G.prototype.source=void 0;var xl=l(fl(),1),Sl={}.hasOwnProperty,Cl=new Map,wl=/[A-Z]/g,Tl=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),El=new Set([`td`,`th`]),Dl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ol(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=zl(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Rl(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?sl:ol,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=kl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function kl(e,t,n){if(t.type===`element`)return Al(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return jl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Nl(e,t,n);if(t.type===`mdxjsEsm`)return Ml(e,t);if(t.type===`root`)return Pl(e,t,n);if(t.type===`text`)return Fl(e,t)}function Al(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=sl,e.schema=i),e.ancestors.push(t);let a=Gl(e,t.tagName,!1),o=Bl(e,t),s=Hl(e,t);return Tl.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Ac(e):!0})),Il(e,o,a,t),Ll(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function jl(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Kl(e,t.position)}function Ml(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Kl(e,t.position)}function Nl(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=sl,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Gl(e,t.name,!0),o=Vl(e,t),s=Hl(e,t);return Il(e,o,a,t),Ll(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Pl(e,t,n){let r={};return Ll(r,Hl(e,t)),e.create(t,e.Fragment,r,n)}function Fl(e,t){return t.value}function Il(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ll(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Rl(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function zl(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=ml(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Bl(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Sl.call(t.properties,i)){let a=Ul(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&El.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Vl(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Kl(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Kl(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Hl(e,t){let n=[],r=-1,i=e.passKeys?new Map:Cl;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=kl(e,a,o);s!==void 0&&n.push(s)}return n}function Ul(e,t,n){let r=rl(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?wc(n):cl(n)),r.property===`style`){let t=typeof n==`object`?n:Wl(e,String(n));return e.stylePropertyNameCase===`css`&&(t=ql(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?$c[r.property]||r.property:r.attribute,n]}}function Wl(e,t){try{return(0,xl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new G("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Dl+`#cannot-parse-style-attribute`,r}}function Gl(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Oc(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Oc(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Sl.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Kl(e)}function Kl(e,t){let n=new G("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Dl+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function ql(e){let t={},n;for(n in e)Sl.call(e,n)&&(t[Jl(n)]=e[n]);return t}function Jl(e){let t=e.replace(wl,Yl);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Yl(e){return`-`+e.toLowerCase()}var Xl={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`]},Zl={};function Ql(e,t){let n=t||Zl;return $l(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function $l(e,t,n){if(tu(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return eu(e.children,t,n)}return Array.isArray(e)?eu(e,t,n):``}function eu(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=$l(e[i],t,n);return r.join(``)}function tu(e){return!!(e&&typeof e==`object`)}var nu=document.createElement(`i`);function ru(e){let t=`&`+e+`;`;nu.innerHTML=t;let n=nu.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function K(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function iu(e,t){return e.length>0?(K(e,e.length,0,t),e):t}var au={}.hasOwnProperty;function ou(e){let t={},n=-1;for(;++n<e.length;)su(t,e[n]);return t}function su(e,t){let n;for(n in t){let r=(au.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){au.call(r,a)||(r[a]=[]);let e=i[a];cu(r[a],Array.isArray(e)?e:e?[e]:[])}}}function cu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);K(e,0,0,r)}function lu(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function uu(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var q=vu(/[A-Za-z]/),J=vu(/[\dA-Za-z]/),du=vu(/[#-'*+\--9=?A-Z^-~]/);function fu(e){return e!==null&&(e<32||e===127)}var pu=vu(/\d/),mu=vu(/[\dA-Fa-f]/),hu=vu(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}var gu=vu(/\p{P}|\p{S}/u),_u=vu(/\s/);function vu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function yu(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&J(e.charCodeAt(n+1))&&J(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Q(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Z(r)?(e.enter(n),s(r)):t(r)}function s(r){return Z(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var bu={tokenize:xu};function xu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Y(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Su={tokenize:wu},Cu={tokenize:Tu};function wu(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return K(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Cu,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Cu,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Y(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;K(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Tu(e,t,n){return Q(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Eu(e){if(e===null||X(e)||_u(e))return 1;if(gu(e))return 2}function Du(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Ou={name:`attention`,resolveAll:ku,tokenize:Au};function ku(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};ju(d,-c),ju(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=iu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=iu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=iu(l,Du(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=iu(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=iu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,K(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Au(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Eu(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Eu(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function ju(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Mu={name:`autolink`,tokenize:Nu};function Nu(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return q(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||J(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||J(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||fu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):du(t)?(e.consume(t),l):n(t)}function u(e){return J(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||J(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Pu={partial:!0,tokenize:Fu};function Fu(e,t,n){return r;function r(t){return Z(t)?Q(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Y(e)?t(e):n(e)}}var Iu={continuation:{tokenize:Ru},exit:zu,name:`blockQuote`,tokenize:Lu};function Lu(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Z(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Ru(e,t,n){let r=this;return i;function i(t){return Z(t)?Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Iu,t,n)(r)}}function zu(e){e.exit(`blockQuote`)}var Bu={name:`characterEscape`,tokenize:Vu};function Vu(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return hu(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Hu={name:`characterReference`,tokenize:Uu};function Uu(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=J,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=mu,u):(e.enter(`characterReferenceValue`),a=7,o=pu,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===J&&!ru(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Wu={partial:!0,tokenize:qu},Gu={concrete:!0,name:`codeFenced`,tokenize:Ku};function Ku(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Y(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Wu,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Q(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Y(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Z(t)?Q(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Y(t)?e.check(Wu,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Z(t)?Q(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Y(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function qu(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Ju={name:`codeIndented`,tokenize:Xu},Yu={partial:!0,tokenize:Zu};function Xu(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Q(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Y(t)?e.attempt(Yu,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Zu(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Q(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Y(e)?i(e):n(e)}}var Qu={name:`codeText`,previous:ed,resolve:$u,tokenize:td};function $u(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ed(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function td(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Y(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var nd=class{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 n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&rd(this.left,n),i.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),rd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),rd(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);rd(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);rd(this.left,t.reverse())}}};function rd(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function id(e){let t={},n=-1,r,i,a,o,s,c,l,u=new nd(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,ad(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return K(e,0,1/0,u.slice(0)),!l}function ad(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var od={resolve:cd,tokenize:ld},sd={partial:!0,tokenize:ud};function cd(e){return id(e),e}function ld(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Y(t)?e.check(sd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function ud(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,a,`linePrefix`)}function a(i){if(i===null||Y(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function dd(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||fu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Y(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||X(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||fu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function fd(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Y(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Y(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Z(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function pd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Y(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function md(e,t){let n;return r;function r(i){return Y(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Z(i)?Q(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var hd={name:`definition`,tokenize:_d},gd={partial:!0,tokenize:vd};function _d(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return fd.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=uu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return X(t)?md(e,l)(t):l(t)}function l(t){return dd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(gd,d,d)(t)}function d(t){return Z(t)?Q(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Y(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function vd(e,t,n){return r;function r(t){return X(t)?md(e,i)(t):n(t)}function i(t){return pd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Z(t)?Q(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Y(e)?t(e):n(e)}}var yd={name:`hardBreakEscape`,tokenize:bd};function bd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Y(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var xd={name:`headingAtx`,resolve:Sd,tokenize:Cd};function Sd(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},K(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Cd(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||X(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Y(n)?(e.exit(`atxHeading`),t(n)):Z(n)?Q(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||X(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var wd=`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`.split(`.`),Td=[`pre`,`script`,`style`,`textarea`],Ed={concrete:!0,name:`htmlFlow`,resolveTo:kd,tokenize:Ad},Dd={partial:!0,tokenize:Md},Od={partial:!0,tokenize:jd};function kd(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(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}function Ad(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):q(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):q(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return q(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||X(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Td.includes(l)?(i=1,r.interrupt?t(s):D(s)):wd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||J(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return Z(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||q(t)?(e.consume(t),b):Z(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Z(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Z(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Y(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||X(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Z(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||Y(t)?D(t):Z(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):Y(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Dd,ue,te)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(Od,ne,ue)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||Y(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function ie(t){return t===45?(e.consume(t),ce):D(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):D(t)}function oe(t){if(t===62){let n=o.toLowerCase();return Td.includes(n)?(e.consume(t),le):D(t)}return q(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):D(t)}function se(t){return t===93?(e.consume(t),ce):D(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):D(t)}function le(t){return t===null||Y(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function jd(e,t,n){let r=this;return i;function i(t){return Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Md(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Pu,t,n)}}var Nd={name:`htmlText`,tokenize:Pd};function Pd(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):q(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):q(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Y(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Y(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):Y(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Y(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return q(t)?(e.consume(t),S):n(t)}function S(t){return t===45||J(t)?(e.consume(t),S):C(t)}function C(t){return Y(t)?(o=C,ae(t)):Z(t)?(e.consume(t),C):ie(t)}function w(t){return t===45||J(t)?(e.consume(t),w):t===47||t===62||X(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ie):t===58||t===95||q(t)?(e.consume(t),E):Y(t)?(o=T,ae(t)):Z(t)?(e.consume(t),T):ie(t)}function E(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):Y(t)?(o=ee,ae(t)):Z(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):Y(t)?(o=D,ae(t)):Z(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):Y(t)?(o=te,ae(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||X(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||X(e)?T(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return Z(t)?Q(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var Fd={name:`labelEnd`,resolveAll:zd,resolveTo:Bd,tokenize:Vd},Id={tokenize:Hd},Ld={tokenize:Ud},Rd={tokenize:Wd};function zd(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&K(e,0,e.length,n),e}function Bd(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=iu(s,e.slice(a+1,a+r+3)),s=iu(s,[[`enter`,u,t]]),s=iu(s,Du(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=iu(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=iu(s,e.slice(o+1)),s=iu(s,[[`exit`,c,t]]),K(e,a,e.length,s),e}function Vd(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(uu(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Id,u,o?u:d)(t):t===91?e.attempt(Ld,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Rd,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Hd(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return X(t)?md(e,a)(t):a(t)}function a(t){return t===41?u(t):dd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return X(t)?md(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?pd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return X(t)?md(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Ud(e,t,n){let r=this;return i;function i(t){return fd.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(uu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Wd(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Gd={name:`labelStartImage`,resolveAll:Fd.resolveAll,tokenize:Kd};function Kd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var qd={name:`labelStartLink`,resolveAll:Fd.resolveAll,tokenize:Jd};function Jd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Yd={name:`lineEnding`,tokenize:Xd};function Xd(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}var Zd={name:`thematicBreak`,tokenize:Qd};function Qd(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Y(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Z(t)?Q(e,s,`whitespace`)(t):s(t))}}var $={continuation:{tokenize:nf},exit:af,name:`list`,tokenize:tf},$d={partial:!0,tokenize:of},ef={partial:!0,tokenize:rf};function tf(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:pu(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Zd,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return pu(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Pu,r.interrupt?n:u,e.attempt($d,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Z(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function nf(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Pu,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Q(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ef,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt($,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function rf(e,t,n){let r=this;return Q(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function af(e){e.exit(this.containerState.type)}function of(e,t,n){let r=this;return Q(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var sf={name:`setextUnderline`,resolveTo:cf,tokenize:lf};function cf(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,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}function lf(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Z(t)?Q(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Y(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var uf={tokenize:df};function df(e){let t=this,n=e.attempt(Pu,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(od,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ff={resolveAll:gf()},pf=hf(`string`),mf=hf(`text`);function hf(e){return{resolveAll:gf(e===`text`?_f:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function gf(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function _f(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var vf=s({attentionMarkers:()=>Ef,contentInitial:()=>bf,disable:()=>Df,document:()=>yf,flow:()=>Sf,flowInitial:()=>xf,insideSpan:()=>Tf,string:()=>Cf,text:()=>wf}),yf={42:$,43:$,45:$,48:$,49:$,50:$,51:$,52:$,53:$,54:$,55:$,56:$,57:$,62:Iu},bf={91:hd},xf={[-2]:Ju,[-1]:Ju,32:Ju},Sf={35:xd,42:Zd,45:[sf,Zd],60:Ed,61:sf,95:Zd,96:Gu,126:Gu},Cf={38:Hu,92:Bu},wf={[-5]:Yd,[-4]:Yd,[-3]:Yd,33:Gd,38:Hu,42:Ou,60:[Mu,Nd],91:qd,92:[yd,Bu],93:Fd,95:Ou,96:Qu},Tf={null:[Ou,ff]},Ef={null:[42,95]},Df={null:[]};function Of(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=iu(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Du(a,l.events,l),l.events):[]}function f(e,t){return Af(p(e),t)}function p(e){return kf(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Y(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&K(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function kf(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Af(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
69
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Xa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Qa(t,`input`,e.processors),output:Qa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function L(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return L(r.element,n);if(r.type===`set`)return L(r.valueType,n);if(r.type===`lazy`)return L(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return L(r.innerType,n);if(r.type===`intersection`)return L(r.left,n)||L(r.right,n);if(r.type===`record`||r.type===`map`)return L(r.keyType,n)||L(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:L(r.in,n)||L(r.out,n);if(r.type===`object`){for(let e in r.shape)if(L(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(L(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(L(e,n))return!0;return!!(r.rest&&L(r.rest,n))}return!1}var Za=(e,t={})=>n=>{let r=Ja({...n,processors:t});return I(e,r),Ya(r,e),Xa(r,e)},Qa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ja({...i??{},target:a,io:t,processors:n});return I(e,o),Ya(o,e),Xa(o,e)},$a={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},eo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=$a[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},to=(e,t,n,r)=>{n.not={}},no=(e,t,n,r)=>{let i=e._zod.def,a=an(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ro=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ao=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=I(a.element,t,{...r,path:[...r.path,`items`]})},oo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=I(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=I(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},so=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>I(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},co=(e,t,n,r)=>{let i=e._zod.def,a=I(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=I(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},lo=(e,t,n,r)=>{let i=e._zod.def,a=I(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},uo=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fo=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},po=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},mo=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ho=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;I(o,t,r);let s=t.seen.get(e);s.ref=o},go=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},_o=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},vo=j(`ZodISODateTime`,(e,t)=>{ri.init(e,t),z.init(e,t)});function yo(e){return Ca(vo,e)}var bo=j(`ZodISODate`,(e,t)=>{ii.init(e,t),z.init(e,t)});function xo(e){return wa(bo,e)}var So=j(`ZodISOTime`,(e,t)=>{ai.init(e,t),z.init(e,t)});function Co(e){return Ta(So,e)}var wo=j(`ZodISODuration`,(e,t)=>{oi.init(e,t),z.init(e,t)});function To(e){return Ea(wo,e)}var Eo=j(`ZodError`,(e,t)=>{zn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Hn(e,t)},flatten:{value:t=>Vn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,on,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,on,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Do=Un(Eo),Oo=Wn(Eo),ko=Gn(Eo),Ao=qn(Eo),jo=Yn(Eo),Mo=Xn(Eo),No=Zn(Eo),Po=Qn(Eo),Fo=$n(Eo),Io=er(Eo),Lo=tr(Eo),Ro=nr(Eo),zo=new WeakMap;function Bo(e,t,n){let r=Object.getPrototypeOf(e),i=zo.get(r);if(i||(i=new Set,zo.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var R=j(`ZodType`,(e,t)=>(P.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Qa(e,`input`),output:Qa(e,`output`)}}),e.toJSONSchema=Za(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Do(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ko(e,t,n),e.parseAsync=async(t,n)=>Oo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ao(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>jo(e,t,n),e.decode=(t,n)=>Mo(e,t,n),e.encodeAsync=async(t,n)=>No(e,t,n),e.decodeAsync=async(t,n)=>Po(e,t,n),e.safeEncode=(t,n)=>Fo(e,t,n),e.safeDecode=(t,n)=>Io(e,t,n),e.safeEncodeAsync=async(t,n)=>Lo(e,t,n),e.safeDecodeAsync=async(t,n)=>Ro(e,t,n),Bo(e,`ZodType`,{check(...e){let t=this.def;return this.clone(fn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Sn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ws(e,t))},superRefine(e,t){return this.check(Gs(e,t))},overwrite(e){return this.check(Ra(e))},optional(){return Es(this)},exactOptional(){return Os(this)},nullable(){return As(this)},nullish(){return Es(As(this))},nonoptional(e){return Is(this,e)},array(){return ms(this)},or(e){return vs([this,e])},and(e){return bs(this,e)},transform(e){return Bs(this,ws(e))},default(e){return Ms(this,e)},prefault(e){return Ps(this,e)},catch(e){return Rs(this,e)},pipe(e){return Bs(this,e)},readonly(){return Hs(this)},describe(e){let t=this.clone();return $i.add(t,{description:e}),t},meta(...e){if(e.length===0)return $i.get(this);let t=this.clone();return $i.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return $i.get(e)?.description},configurable:!0}),e)),Vo=j(`_ZodString`,(e,t)=>{Gr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Bo(e,`_ZodString`,{regex(...e){return this.check(Ma(...e))},includes(...e){return this.check(Fa(...e))},startsWith(...e){return this.check(Ia(...e))},endsWith(...e){return this.check(La(...e))},min(...e){return this.check(Aa(...e))},max(...e){return this.check(ka(...e))},length(...e){return this.check(ja(...e))},nonempty(...e){return this.check(Aa(1,...e))},lowercase(e){return this.check(Na(e))},uppercase(e){return this.check(Pa(e))},trim(){return this.check(Ba())},normalize(...e){return this.check(za(...e))},toLowerCase(){return this.check(Va())},toUpperCase(){return this.check(Ha())},slugify(){return this.check(Ua())}})}),Ho=j(`ZodString`,(e,t)=>{Gr.init(e,t),Vo.init(e,t),e.email=t=>e.check(ta(Wo,t)),e.url=t=>e.check(sa(qo,t)),e.jwt=t=>e.check(Sa(cs,t)),e.emoji=t=>e.check(ca(Jo,t)),e.guid=t=>e.check(na(Go,t)),e.uuid=t=>e.check(ra(Ko,t)),e.uuidv4=t=>e.check(ia(Ko,t)),e.uuidv6=t=>e.check(aa(Ko,t)),e.uuidv7=t=>e.check(oa(Ko,t)),e.nanoid=t=>e.check(la(Yo,t)),e.guid=t=>e.check(na(Go,t)),e.cuid=t=>e.check(ua(Xo,t)),e.cuid2=t=>e.check(da(Zo,t)),e.ulid=t=>e.check(fa(Qo,t)),e.base64=t=>e.check(ya(as,t)),e.base64url=t=>e.check(ba(os,t)),e.xid=t=>e.check(pa($o,t)),e.ksuid=t=>e.check(ma(es,t)),e.ipv4=t=>e.check(ha(ts,t)),e.ipv6=t=>e.check(ga(ns,t)),e.cidrv4=t=>e.check(_a(rs,t)),e.cidrv6=t=>e.check(va(is,t)),e.e164=t=>e.check(xa(ss,t)),e.datetime=t=>e.check(yo(t)),e.date=t=>e.check(xo(t)),e.time=t=>e.check(Co(t)),e.duration=t=>e.check(To(t))});function Uo(e){return ea(Ho,e)}var z=j(`ZodStringFormat`,(e,t)=>{F.init(e,t),Vo.init(e,t)}),Wo=j(`ZodEmail`,(e,t)=>{Jr.init(e,t),z.init(e,t)}),Go=j(`ZodGUID`,(e,t)=>{Kr.init(e,t),z.init(e,t)}),Ko=j(`ZodUUID`,(e,t)=>{qr.init(e,t),z.init(e,t)}),qo=j(`ZodURL`,(e,t)=>{Yr.init(e,t),z.init(e,t)}),Jo=j(`ZodEmoji`,(e,t)=>{Xr.init(e,t),z.init(e,t)}),Yo=j(`ZodNanoID`,(e,t)=>{Zr.init(e,t),z.init(e,t)}),Xo=j(`ZodCUID`,(e,t)=>{Qr.init(e,t),z.init(e,t)}),Zo=j(`ZodCUID2`,(e,t)=>{$r.init(e,t),z.init(e,t)}),Qo=j(`ZodULID`,(e,t)=>{ei.init(e,t),z.init(e,t)}),$o=j(`ZodXID`,(e,t)=>{ti.init(e,t),z.init(e,t)}),es=j(`ZodKSUID`,(e,t)=>{ni.init(e,t),z.init(e,t)}),ts=j(`ZodIPv4`,(e,t)=>{si.init(e,t),z.init(e,t)}),ns=j(`ZodIPv6`,(e,t)=>{ci.init(e,t),z.init(e,t)}),rs=j(`ZodCIDRv4`,(e,t)=>{li.init(e,t),z.init(e,t)}),is=j(`ZodCIDRv6`,(e,t)=>{ui.init(e,t),z.init(e,t)}),as=j(`ZodBase64`,(e,t)=>{fi.init(e,t),z.init(e,t)}),os=j(`ZodBase64URL`,(e,t)=>{mi.init(e,t),z.init(e,t)}),ss=j(`ZodE164`,(e,t)=>{hi.init(e,t),z.init(e,t)}),cs=j(`ZodJWT`,(e,t)=>{_i.init(e,t),z.init(e,t)}),ls=j(`ZodUnknown`,(e,t)=>{vi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function us(){return Da(ls)}var ds=j(`ZodNever`,(e,t)=>{yi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r)});function fs(e){return Oa(ds,e)}var ps=j(`ZodArray`,(e,t)=>{xi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.element=t.element,Bo(e,`ZodArray`,{min(e,t){return this.check(Aa(e,t))},nonempty(e){return this.check(Aa(1,e))},max(e,t){return this.check(ka(e,t))},length(e,t){return this.check(ja(e,t))},unwrap(){return this.element}})});function ms(e,t){return Wa(ps,e,t)}var hs=j(`ZodObject`,(e,t)=>{Ei.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),M(e,`shape`,()=>t.shape),Bo(e,`ZodObject`,{keyof(){return Ss(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:us()})},loose(){return this.clone({...this._zod.def,catchall:us()})},strict(){return this.clone({...this._zod.def,catchall:fs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return En(this,e)},safeExtend(e){return Dn(this,e)},merge(e){return On(this,e)},pick(e){return wn(this,e)},omit(e){return Tn(this,e)},partial(...e){return kn(Ts,this,e[0])},required(...e){return An(Fs,this,e[0])}})});function gs(e,t){return new hs({type:`object`,shape:e??{},...N(t)})}var _s=j(`ZodUnion`,(e,t)=>{Oi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.options=t.options});function vs(e,t){return new _s({type:`union`,options:e,...N(t)})}var ys=j(`ZodIntersection`,(e,t)=>{ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r)});function bs(e,t){return new ys({type:`intersection`,left:e,right:t})}var xs=j(`ZodEnum`,(e,t)=>{Mi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new xs({...t,checks:[],...N(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new xs({...t,checks:[],...N(r),entries:i})}});function Ss(e,t){return new xs({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N(t)})}var Cs=j(`ZodTransform`,(e,t)=>{Ni.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ln(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ln(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ws(e){return new Cs({type:`transform`,transform:e})}var Ts=j(`ZodOptional`,(e,t)=>{Fi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Es(e){return new Ts({type:`optional`,innerType:e})}var Ds=j(`ZodExactOptional`,(e,t)=>{Ii.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Os(e){return new Ds({type:`optional`,innerType:e})}var ks=j(`ZodNullable`,(e,t)=>{Li.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function As(e){return new ks({type:`nullable`,innerType:e})}var js=j(`ZodDefault`,(e,t)=>{Ri.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ms(e,t){return new js({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():yn(t)}})}var Ns=j(`ZodPrefault`,(e,t)=>{Bi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ps(e,t){return new Ns({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():yn(t)}})}var Fs=j(`ZodNonOptional`,(e,t)=>{Vi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Is(e,t){return new Fs({type:`nonoptional`,innerType:e,...N(t)})}var Ls=j(`ZodCatch`,(e,t)=>{Ui.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Rs(e,t){return new Ls({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var zs=j(`ZodPipe`,(e,t)=>{Wi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.in=t.in,e.out=t.out});function Bs(e,t){return new zs({type:`pipe`,in:e,out:t})}var Vs=j(`ZodReadonly`,(e,t)=>{Ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hs(e){return new Vs({type:`readonly`,innerType:e})}var Us=j(`ZodCustom`,(e,t)=>{Ji.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r)});function Ws(e,t={}){return Ga(Us,e,t)}function Gs(e,t){return Ka(e,t)}gs({chartConfig:Uo().describe(`Erica chart config syntax.`)});var Ks=gs({compiled_chart:gs({path:Uo().describe(`Path to the chart JSON file.`)}).describe(`Compiled chart`)});gs({title:Uo().describe(`Title of the report.`),reportContent:Uo().describe(`Markdown content of the report.`)});var qs=gs({compiled_report:gs({title:Uo().describe(`Title of the report.`),path:Uo().describe(`Path to the compiled report.`)})}),Js={get:async(e,t)=>{let{data:n}=await Gt({path:{threadId:e,filename:t},throwOnError:!0});return n}},Ys=[`bar`,`line`,`pie`,`bignumber`,`table`,`scatter`,`funnel`],Xs=/(\w+)=(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|(true|false|-?(?:\d+\.?\d*|\.\d+)))/g;function Zs(e){let t={},n=new RegExp(Xs.source,Xs.flags),r;for(;(r=n.exec(e))!==null;){let e=r[2]??r[3]??r[4]??``;r[2]===void 0?r[3]!==void 0&&(e=e.replace(/\\'/g,`'`).replace(/\\\\/g,`\\`)):e=e.replace(/\\"/g,`"`).replace(/\\\\/g,`\\`),t[r[1]]=e}return t}var Qs=/\{%\s*(\w+)\s+((?:(?!\/%\})[\s\S])*)\/%\}/g;function $s(e){let t=[],n=0,r=new RegExp(Qs.source,Qs.flags),i;for(;(i=r.exec(e))!==null;){let[r,a,o]=i,s=i.index;s>n&&t.push({kind:`text`,content:e.slice(n,s)});let c=a.toLowerCase();if(Ys.includes(c)){let e={type:c,attrs:Zs(o),raw:r};t.push({kind:`chart`,node:e})}else t.push({kind:`text`,content:r});n=s+r.length}return n<e.length&&t.push({kind:`text`,content:e.slice(n)}),t}function ec(e,t){let n=[];switch(e){case`bar`:case`line`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`pie`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`bignumber`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`table`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`});break;case`scatter`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`funnel`:!t.sql&&!t.data&&n.push({field:`sql`,message:`sql or data is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break}return n.length>0?{valid:!1,errors:n}:{valid:!0}}function tc(e){if(e===void 0)return;let t=e.toLowerCase();if(t===`true`||t===`1`||t===`yes`)return!0;if(t===`false`||t===`0`||t===`no`)return!1}function nc(e){if(e===void 0)return;let t=Number(e);return isNaN(t)?void 0:t}function rc(e){if(e===void 0)return;let t=Number(e);return isNaN(t)?e:t}function ic(e){if(e!==void 0)return e.includes(`,`)?e.split(`,`).map(e=>e.trim()):e}function ac(e){if(e!==void 0)return e.split(`,`).map(e=>e.trim())}function oc(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function sc(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function cc(e){let t={};for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function lc({option:e,style:t={height:`400px`,width:`100%`},settings:n={notMerge:!0},theme:r}){let i=(0,u.useRef)(null),a=(0,u.useRef)(null);return(0,u.useEffect)(()=>{i.current&&(a.current=p.init(i.current,r));let e=()=>{a.current?.resize()};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e),a.current?.dispose()}},[r]),(0,u.useEffect)(()=>{if(a.current&&e){let t={...e,grid:{left:30,right:30,top:100,bottom:50,containLabel:!0},toolbox:{show:!0,...e.toolbox,feature:{saveAsImage:{show:!0,title:`Download`,pixelRatio:2},restore:{show:!0},...e.toolbox?.feature||{}}}};a.current.setOption(t,n)}},[e,n]),(0,f.jsx)(`div`,{ref:i,style:t})}function uc({sql:e,data:t,x:n,y:r,title:i,height:a=`400px`,color:o,xAxisName:s,yAxisName:c,horizontal:l=!1,stack:d=!1,seriesNames:p}){let[m,h]=(0,u.useState)(!1),g=(0,u.useMemo)(()=>Array.isArray(r)?r:[r],[r]),_=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),v=(0,u.useMemo)(()=>{if(!_?.rows?.length)return null;let e=_.rows.map(e=>String(e[n]??``)),t=g.map(e=>({name:p?.[e]??e,type:`bar`,data:_.rows.map(t=>t[e]??null),stack:d?`total`:void 0,label:m?{show:!0,position:l?`right`:`top`}:void 0}));return cc({title:i?{text:i}:void 0,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`}},toolbox:{feature:{myToggleLabels:{show:!0,title:m?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>h(e=>!e)}}},legend:g.length>1?{show:!0}:void 0,color:o?Array.isArray(o)?o:[o]:void 0,grid:{containLabel:!0},...l?{xAxis:{type:`value`,name:s},yAxis:{type:`category`,data:e,name:c}}:{xAxis:{type:`category`,data:e,name:s},yAxis:{type:`value`,name:c}},series:t})},[_,n,g,i,o,s,c,l,p,m,d]),y={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:y,className:`bar-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`bar-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):v?(0,f.jsx)(lc,{option:v,style:y}):(0,f.jsx)(`div`,{style:y,className:`bar-chart-no-data`,children:(0,f.jsx)(`p`,{className:`bar-chart-no-data-text`,children:`No data`})})}function dc({sql:e,data:t,x:n,y:r,title:i,height:a=`400px`,color:o,xAxisName:s,yAxisName:c,smooth:l=!1,area:d=!1,seriesNames:p,secondary_y:m,secondary_title:h,prefix:g,suffix:_}){let[v,y]=(0,u.useState)(!1),b=(0,u.useMemo)(()=>Array.isArray(r)?r:[r],[r]),x=(0,u.useMemo)(()=>m?Array.isArray(m)?m:[m]:[],[m]),S=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),C=(0,u.useMemo)(()=>{if(!S?.rows?.length)return null;let e=S.rows.map(e=>String(e[n]??``)),t=b.map(e=>({name:p?.[e]??e,type:`line`,data:S.rows.map(t=>t[e]??null),smooth:l,areaStyle:d?{}:void 0,yAxisIndex:0,label:v?{show:!0,position:`top`}:void 0})),r=x.map(e=>({name:p?.[e]??e,type:`line`,data:S.rows.map(t=>t[e]??null),smooth:l,yAxisIndex:1,label:v?{show:!0,position:`top`}:void 0})),a=[...t,...r],u=x.length>0;return cc({title:i?{text:i}:void 0,tooltip:{trigger:`axis`,valueFormatter:e=>`${g||``}${String(e??``)}${_||``}`},toolbox:{feature:{myToggleLabels:{show:!0,title:v?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>y(e=>!e)}}},legend:b.length>1||u?{show:!0}:void 0,color:o?Array.isArray(o)?o:[o]:void 0,grid:{containLabel:!0},xAxis:{type:`category`,data:e,name:s},yAxis:u?[{type:`value`,name:c},{type:`value`,name:h}]:{type:`value`,name:c},series:a})},[S,n,b,x,i,o,s,c,h,l,d,p,v,g,_]),w={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:w,className:`line-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`line-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):C?(0,f.jsx)(lc,{option:C,style:w}):(0,f.jsx)(`div`,{style:w,className:`line-chart-no-data`,children:(0,f.jsx)(`p`,{className:`line-chart-no-data-text`,children:`No data`})})}var fc={red:`#dc2626`,green:`#16a34a`,blue:`#2563eb`,yellow:`#ca8a04`,orange:`#ea580c`,purple:`#9333ea`,pink:`#db2777`,gray:`#6b7280`,black:`#111827`,white:`#ffffff`},pc=e=>{if(!e)return null;let t=e.indexOf(`|`);if(t===-1)return{text:e};let n=e.slice(0,t).trim().toLowerCase(),r=e.slice(t+1).trim();return r?{text:r,color:fc[n]??n}:{text:e}};function mc({sql:e,data:t,value:n,title:r=`Big Number`,subtitle:i,description:a,height:o=`170px`,prefix:s=``,suffix:c=``,decimals:l=0}){let d=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),p=(0,u.useMemo)(()=>d?.rows?.length?d.rows[0]?.[n]??null:null,[d,n]),m=(0,u.useMemo)(()=>{if(p==null||p===``)return`--`;let e=Number(p);return Number.isNaN(e)?String(p):`${s}${e.toLocaleString(void 0,{minimumFractionDigits:l,maximumFractionDigits:l})}${c}`},[p,s,c,l]),h=(0,u.useMemo)(()=>pc(r),[r]),g=(0,u.useMemo)(()=>pc(i),[i]),_=(0,u.useMemo)(()=>pc(a),[a]),v=(0,u.useMemo)(()=>pc(m),[m]);return e&&!t?(0,f.jsx)(`div`,{className:`big-number-warning`,children:(0,f.jsx)(`p`,{className:`big-number-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):(0,f.jsxs)(`div`,{className:`big-number-container`,children:[(0,f.jsxs)(`div`,{className:`big-number-header`,children:[(0,f.jsx)(`p`,{className:`big-number-title`,style:h?.color?{color:h.color}:void 0,children:h?.text??r}),g?(0,f.jsx)(`p`,{className:`big-number-subtitle`,style:g.color?{color:g.color}:void 0,children:g.text}):null]}),(0,f.jsxs)(`div`,{className:`big-number-value-section`,children:[(0,f.jsx)(`p`,{className:`big-number-value`,style:v?.color?{color:v.color}:void 0,children:v?.text??m}),_?(0,f.jsx)(`p`,{className:`big-number-description`,style:_.color?{color:_.color}:void 0,children:_.text}):null]})]})}function hc({sql:e,data:t,name:n,value:r,title:i,height:a=`400px`,showLabels:o=!0,showLegend:s=!1,sort:c=`descending`}){let[l,d]=(0,u.useState)(o),[p,m]=(0,u.useState)(s),h=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),g=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[n]??``),value:Number(e[r]??0)}));return cc({title:i?{text:i}:void 0,tooltip:{trigger:`item`,formatter:`{b}: {c}`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:p?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>m(e=>!e)}}},legend:p?{show:!0,top:`bottom`}:void 0,series:[{type:`funnel`,left:`10%`,top:60,bottom:20,width:`80%`,min:0,minSize:`0%`,maxSize:`100%`,sort:c,gap:4,label:{show:l,position:`inside`,formatter:`{b}: {c}`},emphasis:{label:{fontSize:14}},data:e}]})},[h,n,r,i,c,l,p]),_={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:_,className:`funnel-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`funnel-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):g?(0,f.jsx)(lc,{option:g,style:_}):(0,f.jsx)(`div`,{style:_,className:`funnel-chart-no-data`,children:(0,f.jsx)(`p`,{className:`funnel-chart-no-data-text`,children:`No data`})})}var gc=e=>e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e);function _c({sql:e,data:t,title:n,height:r=`400px`,columns:i,maxRows:a}){let o=(0,u.useMemo)(()=>{if(t){let e=t;return{rows:e,columns:e.length>0?Object.keys(e[0]):[]}}return null},[t]),s=(0,u.useMemo)(()=>{let e=o?.columns?.length?o.columns:[];return i?.length?i.filter(t=>e.includes(t)):e},[o,i]),c=(0,u.useMemo)(()=>{let e=o?.rows??[];return!a||a<=0?e:e.slice(0,a)},[o,a]),l={height:typeof r==`number`?`${r}px`:r,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:{...l,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`table-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`table-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):!s.length||!c.length?(0,f.jsx)(`div`,{style:{...l,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`table-chart-no-data`,children:(0,f.jsx)(`p`,{className:`table-chart-no-data-text`,children:`No data`})}):(0,f.jsxs)(`div`,{style:l,className:`table-chart-container`,children:[n?(0,f.jsx)(`div`,{className:`table-chart-title-wrapper`,children:(0,f.jsx)(`p`,{className:`table-chart-title`,children:n})}):null,(0,f.jsx)(`div`,{className:`table-chart-table-wrapper`,children:(0,f.jsxs)(`table`,{className:`table-chart-table`,children:[(0,f.jsx)(`thead`,{className:`table-chart-thead`,children:(0,f.jsx)(`tr`,{children:s.map(e=>(0,f.jsx)(`th`,{className:`table-chart-th`,children:e},e))})}),(0,f.jsx)(`tbody`,{children:c.map((e,t)=>(0,f.jsx)(`tr`,{className:`table-chart-tr`,children:s.map(n=>(0,f.jsx)(`td`,{className:`table-chart-td`,children:(0,f.jsx)(`div`,{className:`table-chart-cell-content`,children:gc(e[n])})},`${t}-${n}`))},String(e._erica_id??t)))})]})})]})}function vc({sql:e,data:t,name:n,value:r,title:i,height:a=`400px`,donut:o=!1,showLabels:s=!0,showLegend:c=!0}){let[l,d]=(0,u.useState)(s),[p,m]=(0,u.useState)(c),h=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),g=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[n]??``),value:Number(e[r]??0)}));return cc({title:i?{text:i}:void 0,tooltip:{trigger:`item`,formatter:`{a} <br/>{b}: {c} ({d}%)`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:p?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>m(e=>!e)}}},legend:p?{show:!0,orient:`vertical`,left:`left`}:void 0,series:[{name:i??`Data`,type:`pie`,radius:o?[`40%`,`70%`]:`70%`,data:e,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:`rgba(0, 0, 0, 0.5)`}},label:{show:l,formatter:`{b}: {c} ({d}%)`}}]})},[h,n,r,i,o,l,p]),_={height:typeof a==`number`?`${a}px`:a,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:_,className:`pie-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`pie-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):g?(0,f.jsx)(lc,{option:g,style:_}):(0,f.jsx)(`div`,{style:_,className:`pie-chart-no-data`,children:(0,f.jsx)(`p`,{className:`pie-chart-no-data-text`,children:`No data`})})}function yc({sql:e,data:t,x:n,y:r,seriesBy:i,size:a,color:o,title:s,height:c=`400px`,xAxisName:l,yAxisName:d,seriesNames:p}){let[m,h]=(0,u.useState)(!1),g=(0,u.useMemo)(()=>Array.isArray(r)?r:[r],[r]),_=(0,u.useMemo)(()=>t?{rows:t}:null,[t]),v=(0,u.useMemo)(()=>{if(!_?.rows?.length)return null;let e=(e,t)=>{let r=[Number(e[n]??0),Number(e[t]??0)];return a&&r.push(Number(e[a]??0)),o&&r.push(String(e[o]??``)),r},t=i?_.rows.reduce((e,t)=>{let n=String(t[i]??`Unknown`);return e[n]||(e[n]=[]),e[n].push(t),e},{}):null,r=(e,t)=>({name:t,type:`scatter`,symbolSize:a?e=>Math.sqrt(e[2])*2:10,data:e,label:m?{show:!0,formatter:e=>{let t=e.value;return`${t[0]}, ${t[1]}`}}:void 0,itemStyle:o?{color:e=>{let t=e.value,n=t[t.length-1],r=[`#5470c6`,`#91cc75`,`#fac858`,`#ee6666`,`#73c0de`,`#3ba272`,`#fc8452`,`#9a60b4`,`#ea7ccc`];return r[n.split(``).reduce((e,t)=>e+t.charCodeAt(0),0)%r.length]}}:void 0}),c=t?Object.entries(t).flatMap(([t,n])=>g.map(i=>{let a=p?.[t]??t,o=p?.[i]??i,s=g.length>1?`${a} - ${o}`:a;return r(n.map(t=>e(t,i)),s)})):g.map(t=>r(_.rows.map(n=>e(n,t)),p?.[t]??t));return cc({title:s?{text:s}:void 0,tooltip:{trigger:`item`,formatter:e=>{let t=e.value,r=`${e.seriesName?`${e.seriesName}<br/>`:``}${n}: ${t[0]}<br/>${d??`Value`}: ${t[1]}`,i=2;return a&&(r+=`<br/>${a}: ${t[i++]}`),o&&(r+=`<br/>${o}: ${t[i]}`),r}},toolbox:{feature:{myToggleLabels:{show:!0,title:m?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>h(e=>!e)}}},xAxis:{type:`value`,name:l,scale:!0},yAxis:{type:`value`,name:d,scale:!0},legend:c.length>1?{show:!0}:void 0,series:c})},[_,n,g,i,a,o,s,l,d,m,p]),y={height:typeof c==`number`?`${c}px`:c,width:`100%`};return e&&!t?(0,f.jsx)(`div`,{style:y,className:`scatter-chart-sql-warning`,children:(0,f.jsx)(`p`,{className:`scatter-chart-sql-warning-text`,children:`SQL queries are not supported yet. Please provide data directly.`})}):v?(0,f.jsx)(lc,{option:v,style:y}):(0,f.jsx)(`div`,{style:y,className:`scatter-chart-no-data`,children:(0,f.jsx)(`p`,{className:`scatter-chart-no-data-text`,children:`No data`})})}function bc({type:e,errors:t}){return(0,f.jsxs)(`div`,{className:`erica-chart-error`,children:[(0,f.jsxs)(`p`,{className:`erica-chart-error-title`,children:[`Erica Chart syntax error — `,(0,f.jsx)(`code`,{children:e})]}),(0,f.jsx)(`ul`,{className:`erica-chart-error-list`,children:t.map(e=>(0,f.jsx)(`li`,{className:`erica-chart-error-item`,children:e.message},e.field))})]})}function xc(e){let{type:t,attrs:n}=e,r=ec(t,n);if(!r.valid)return(0,f.jsx)(bc,{type:t,errors:r.errors});switch(t){case`bar`:return(0,f.jsx)(uc,{sql:n.sql,data:sc(n.data),x:n.x,y:ic(n.y)??n.y,title:n.title,height:rc(n.height),color:ic(n.color),xAxisName:n.xAxisName,yAxisName:n.yAxisName,horizontal:tc(n.horizontal),stack:tc(n.stack),seriesNames:oc(n.seriesNames)});case`line`:return(0,f.jsx)(dc,{sql:n.sql,data:sc(n.data),x:n.x,y:ic(n.y)??n.y,title:n.title,height:rc(n.height),color:ic(n.color),xAxisName:n.xAxisName||n.x_title,yAxisName:n.yAxisName||n.y_title,smooth:tc(n.smooth),area:tc(n.area),seriesNames:oc(n.seriesNames),secondary_y:ic(n.secondary_y),secondary_title:n.secondary_title,prefix:n.prefix,suffix:n.suffix});case`bignumber`:return(0,f.jsx)(mc,{sql:n.sql,data:sc(n.data),value:n.value,title:n.title,subtitle:n.subtitle,description:n.description,height:rc(n.height),prefix:n.prefix,suffix:n.suffix,decimals:nc(n.decimals)});case`funnel`:return(0,f.jsx)(hc,{sql:n.sql,data:sc(n.data),name:n.name||n.label||n.stage||n.x,value:n.value||n.y,title:n.title,height:rc(n.height),showLabels:tc(n.showLabels),showLegend:tc(n.showLegend),sort:n.sort});case`scatter`:return(0,f.jsx)(yc,{sql:n.sql,data:sc(n.data),x:n.x,y:ic(n.y)??n.y,seriesBy:n.seriesBy,size:n.size,color:n.color,title:n.title,height:rc(n.height),xAxisName:n.xAxisName,yAxisName:n.yAxisName,seriesNames:oc(n.seriesNames)});case`pie`:return(0,f.jsx)(vc,{sql:n.sql,data:sc(n.data),name:n.name||n.label||n.x,value:n.value||n.y,title:n.title,height:rc(n.height),donut:tc(n.donut),showLabels:tc(n.showLabels),showLegend:tc(n.showLegend)});case`table`:return(0,f.jsx)(_c,{sql:n.sql,data:sc(n.data),title:n.title,height:rc(n.height),columns:ac(n.columns),maxRows:nc(n.maxRows)});default:return(0,f.jsxs)(`div`,{className:`erica-chart-unimplemented`,children:[(0,f.jsxs)(`div`,{className:`erica-chart-unimplemented-title`,children:[`Chart type "`,t,`" not implemented yet`]}),(0,f.jsx)(`pre`,{className:`erica-chart-unimplemented-pre`,children:JSON.stringify(n,null,2)})]})}}function Sc({markdown:e}){return(0,f.jsx)(`div`,{className:`erica-chart-container`,children:(0,u.useMemo)(()=>$s(e),[e]).map((e,t)=>e.kind===`text`?e.content.trim()?(0,f.jsx)(`div`,{className:`erica-chart-text`,children:e.content},t):null:(0,f.jsx)(`div`,{className:`erica-chart-wrapper`,children:xc(e.node)},t))})}function Cc({chartConfig:e}){return(0,f.jsx)(`div`,{className:`chart-card-container`,children:(0,f.jsx)(Sc,{markdown:e})})}function wc({path:e}){let t=(0,u.useContext)(Zt)?.threadId||``,{data:n,isLoading:r}=Lt({queryKey:[`artifact`,t,e],queryFn:async()=>await Js.get(t,e),enabled:!!t&&!!e});return r?(0,f.jsx)(`div`,{className:`chart-loader-loading`,children:`loading chart...`}):n?(0,f.jsx)(Cc,{chartConfig:n}):(0,f.jsx)(`div`,{className:`chart-loader-no-data`,children:`No chart data available`})}var Tc=(0,u.createContext)(null);function Ec({children:e}){let[t,n]=(0,u.useState)(!1),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(`Artifacts`);return(0,f.jsx)(Tc.Provider,{value:{isOpen:t,onOpen:()=>n(!0),onClose:()=>n(!1),content:r,setContent:i,title:a,setTitle:o},children:e})}var Dc=()=>(0,u.useContext)(Tc)||{isOpen:!1,onOpen:()=>{},onClose:()=>{},content:null,setContent:()=>{},title:`Artifacts`,setTitle:()=>{}};function Oc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var kc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ac=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jc={};function Mc(e,t){return((t||jc).jsx?Ac:kc).test(e)}var Nc=/[ \t\n\f\r]/g;function Pc(e){return typeof e==`object`?e.type===`text`?Fc(e.value):!1:Fc(e)}function Fc(e){return e.replace(Nc,``)===``}var Ic=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Ic.prototype.normal={},Ic.prototype.property={},Ic.prototype.space=void 0;function Lc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Ic(n,r,t)}function Rc(e){return e.toLowerCase()}var B=class{constructor(e,t){this.attribute=t,this.property=e}};B.prototype.attribute=``,B.prototype.booleanish=!1,B.prototype.boolean=!1,B.prototype.commaOrSpaceSeparated=!1,B.prototype.commaSeparated=!1,B.prototype.defined=!1,B.prototype.mustUseProperty=!1,B.prototype.number=!1,B.prototype.overloadedBoolean=!1,B.prototype.property=``,B.prototype.spaceSeparated=!1,B.prototype.space=void 0;var zc=s({boolean:()=>V,booleanish:()=>H,commaOrSpaceSeparated:()=>Uc,commaSeparated:()=>Hc,number:()=>U,overloadedBoolean:()=>Vc,spaceSeparated:()=>W}),Bc=0,V=Wc(),H=Wc(),Vc=Wc(),U=Wc(),W=Wc(),Hc=Wc(),Uc=Wc();function Wc(){return 2**++Bc}var Gc=Object.keys(zc),Kc=class extends B{constructor(e,t,n,r){let i=-1;if(super(e,t),qc(this,`space`,r),typeof n==`number`)for(;++i<Gc.length;){let e=Gc[i];qc(this,Gc[i],(n&zc[e])===zc[e])}}};Kc.prototype.defined=!0;function qc(e,t,n){n&&(e[t]=n)}function Jc(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Kc(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Rc(r)]=r,n[Rc(a.attribute)]=r}return new Ic(t,n,e.space)}var Yc=Jc({properties:{ariaActiveDescendant:null,ariaAtomic:H,ariaAutoComplete:null,ariaBusy:H,ariaChecked:H,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:W,ariaCurrent:null,ariaDescribedBy:W,ariaDetails:null,ariaDisabled:H,ariaDropEffect:W,ariaErrorMessage:null,ariaExpanded:H,ariaFlowTo:W,ariaGrabbed:H,ariaHasPopup:null,ariaHidden:H,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:W,ariaLevel:U,ariaLive:null,ariaModal:H,ariaMultiLine:H,ariaMultiSelectable:H,ariaOrientation:null,ariaOwns:W,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:H,ariaReadOnly:H,ariaRelevant:null,ariaRequired:H,ariaRoleDescription:W,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:H,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Xc(e,t){return t in e?e[t]:t}function Zc(e,t){return Xc(e,t.toLowerCase())}var Qc=Jc({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Hc,acceptCharset:W,accessKey:W,action:null,allow:null,allowFullScreen:V,allowPaymentRequest:V,allowUserMedia:V,alpha:V,alt:null,as:null,async:V,autoCapitalize:null,autoComplete:W,autoFocus:V,autoPlay:V,blocking:W,capture:null,charSet:null,checked:V,cite:null,className:W,closedBy:null,colorSpace:null,cols:U,colSpan:U,command:null,commandFor:null,content:null,contentEditable:H,controls:V,controlsList:W,coords:U|Hc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:V,defer:V,dir:null,dirName:null,disabled:V,download:Vc,draggable:H,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:V,formTarget:null,headers:W,height:U,hidden:Vc,high:U,href:null,hrefLang:null,htmlFor:W,httpEquiv:W,id:null,imageSizes:null,imageSrcSet:null,inert:V,inputMode:null,integrity:null,is:null,isMap:V,itemId:null,itemProp:W,itemRef:W,itemScope:V,itemType:W,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:V,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:V,muted:V,name:null,nonce:null,noModule:V,noValidate:V,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:V,optimum:U,pattern:null,ping:W,placeholder:null,playsInline:V,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:V,referrerPolicy:null,rel:W,required:V,reversed:V,rows:U,rowSpan:U,sandbox:W,scope:null,scoped:V,seamless:V,selected:V,shadowRootClonable:V,shadowRootCustomElementRegistry:V,shadowRootDelegatesFocus:V,shadowRootMode:null,shadowRootSerializable:V,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:H,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:V,useMap:null,value:H,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:W,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:V,declare:V,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:V,noHref:V,noShade:V,noWrap:V,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:H,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:V,disablePictureInPicture:V,disableRemotePlayback:V,exportParts:Hc,part:W,prefix:null,property:null,results:U,security:null,unselectable:null},space:`html`,transform:Zc}),$c=Jc({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`,maskType:`mask-type`,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:Uc,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:W,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:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:V,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,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:Hc,g2:Hc,glyphName:Hc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:Uc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:U,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:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:W,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Uc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Uc,rev:Uc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Uc,requiredFeatures:Uc,requiredFonts:Uc,requiredFormats:Uc,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:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:Uc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Uc,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Uc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Xc}),el=Jc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),tl=Jc({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Zc}),nl=Jc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),rl={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`},il=/[A-Z]/g,al=/-[a-z]/g,ol=/^data[-\w.:]+$/i;function sl(e,t){let n=Rc(t),r=t,i=B;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ol.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(al,ll);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!al.test(e)){let n=e.replace(il,cl);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Kc}return new i(r,t)}function cl(e){return`-`+e.toLowerCase()}function ll(e){return e.charAt(1).toUpperCase()}var ul=Lc([Yc,Qc,el,tl,nl],`html`),dl=Lc([Yc,$c,el,tl,nl],`svg`);function fl(e){return e.join(` `).trim()}var pl=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
70
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),ml=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(pl());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),hl=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gl=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ml()),r=hl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_l=yl(`end`),vl=yl(`start`);function yl(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bl(e){let t=vl(e),n=_l(e);if(t&&n)return{start:t,end:n}}function xl(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Cl(e.position):`start`in e||`end`in e?Cl(e):`line`in e||`column`in e?Sl(e):``}function Sl(e){return wl(e&&e.line)+`:`+wl(e&&e.column)}function Cl(e){return Sl(e&&e.start)+`-`+Sl(e&&e.end)}function wl(e){return e&&typeof e==`number`?e:1}var G=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xl(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};G.prototype.file=``,G.prototype.name=``,G.prototype.reason=``,G.prototype.message=``,G.prototype.stack=``,G.prototype.column=void 0,G.prototype.line=void 0,G.prototype.ancestors=void 0,G.prototype.cause=void 0,G.prototype.fatal=void 0,G.prototype.place=void 0,G.prototype.ruleId=void 0,G.prototype.source=void 0;var Tl=l(gl(),1),El={}.hasOwnProperty,Dl=new Map,Ol=/[A-Z]/g,kl=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Al=new Set([`td`,`th`]);function jl(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Hl(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Vl(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dl:ul,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Ml(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Ml(e,t,n){if(t.type===`element`)return Nl(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Pl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Il(e,t,n);if(t.type===`mdxjsEsm`)return Fl(e,t);if(t.type===`root`)return Ll(e,t,n);if(t.type===`text`)return Rl(e,t)}function Nl(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dl,e.schema=i),e.ancestors.push(t);let a=Jl(e,t.tagName,!1),o=Ul(e,t),s=Gl(e,t);return kl.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Pc(e):!0})),zl(e,o,a,t),Bl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Pl(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Yl(e,t.position)}function Fl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Yl(e,t.position)}function Il(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dl,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Jl(e,t.name,!0),o=Wl(e,t),s=Gl(e,t);return zl(e,o,a,t),Bl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ll(e,t,n){let r={};return Bl(r,Gl(e,t)),e.create(t,e.Fragment,r,n)}function Rl(e,t){return t.value}function zl(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Bl(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Vl(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Hl(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vl(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Ul(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&El.call(t.properties,i)){let a=Kl(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Al.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Wl(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Yl(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Yl(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Gl(e,t){let n=[],r=-1,i=e.passKeys?new Map:Dl;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Ml(e,a,o);s!==void 0&&n.push(s)}return n}function Kl(e,t,n){let r=sl(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Oc(n):fl(n)),r.property===`style`){let t=typeof n==`object`?n:ql(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Xl(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?rl[r.property]||r.property:r.attribute,n]}}function ql(e,t){try{return(0,Tl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new G("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function Jl(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Mc(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Mc(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return El.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Yl(e)}function Yl(e,t){let n=new G("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function Xl(e){let t={},n;for(n in e)El.call(e,n)&&(t[Zl(n)]=e[n]);return t}function Zl(e){let t=e.replace(Ol,Ql);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Ql(e){return`-`+e.toLowerCase()}var $l={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`]},eu={};function tu(e,t){let n=t||eu;return nu(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function nu(e,t,n){if(iu(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ru(e.children,t,n)}return Array.isArray(e)?ru(e,t,n):``}function ru(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=nu(e[i],t,n);return r.join(``)}function iu(e){return!!(e&&typeof e==`object`)}var au=document.createElement(`i`);function ou(e){let t=`&`+e+`;`;au.innerHTML=t;let n=au.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function K(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function su(e,t){return e.length>0?(K(e,e.length,0,t),e):t}var cu={}.hasOwnProperty;function lu(e){let t={},n=-1;for(;++n<e.length;)uu(t,e[n]);return t}function uu(e,t){let n;for(n in t){let r=(cu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){cu.call(r,a)||(r[a]=[]);let e=i[a];du(r[a],Array.isArray(e)?e:e?[e]:[])}}}function du(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);K(e,0,0,r)}function fu(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function pu(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var q=xu(/[A-Za-z]/),J=xu(/[\dA-Za-z]/),mu=xu(/[#-'*+\--9=?A-Z^-~]/);function hu(e){return e!==null&&(e<32||e===127)}var gu=xu(/\d/),_u=xu(/[\dA-Fa-f]/),vu=xu(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}var yu=xu(/\p{P}|\p{S}/u),bu=xu(/\s/);function xu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Su(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&J(e.charCodeAt(n+1))&&J(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Q(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Z(r)?(e.enter(n),s(r)):t(r)}function s(r){return Z(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Cu={tokenize:wu};function wu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Y(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Tu={tokenize:Du},Eu={tokenize:Ou};function Du(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return K(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Eu,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Eu,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Y(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;K(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ou(e,t,n){return Q(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function ku(e){if(e===null||X(e)||bu(e))return 1;if(yu(e))return 2}function Au(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var ju={name:`attention`,resolveAll:Mu,tokenize:Nu};function Mu(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Pu(d,-c),Pu(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=su(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=su(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=su(l,Au(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=su(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=su(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,K(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Nu(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ku(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=ku(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Pu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Fu={name:`autolink`,tokenize:Iu};function Iu(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return q(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||J(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||J(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||hu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):mu(t)?(e.consume(t),l):n(t)}function u(e){return J(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||J(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Lu={partial:!0,tokenize:Ru};function Ru(e,t,n){return r;function r(t){return Z(t)?Q(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Y(e)?t(e):n(e)}}var zu={continuation:{tokenize:Vu},exit:Hu,name:`blockQuote`,tokenize:Bu};function Bu(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Z(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Vu(e,t,n){let r=this;return i;function i(t){return Z(t)?Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(zu,t,n)(r)}}function Hu(e){e.exit(`blockQuote`)}var Uu={name:`characterEscape`,tokenize:Wu};function Wu(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return vu(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Gu={name:`characterReference`,tokenize:Ku};function Ku(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=J,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=_u,u):(e.enter(`characterReferenceValue`),a=7,o=gu,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===J&&!ou(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var qu={partial:!0,tokenize:Xu},Ju={concrete:!0,name:`codeFenced`,tokenize:Yu};function Yu(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Y(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(qu,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Q(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Y(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Z(t)?Q(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Y(t)?e.check(qu,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Z(t)?Q(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Y(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Xu(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Zu={name:`codeIndented`,tokenize:$u},Qu={partial:!0,tokenize:ed};function $u(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Q(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Y(t)?e.attempt(Qu,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function ed(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Q(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Y(e)?i(e):n(e)}}var td={name:`codeText`,previous:rd,resolve:nd,tokenize:id};function nd(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function rd(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function id(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Y(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var ad=class{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 n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&od(this.left,n),i.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),od(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),od(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);od(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);od(this.left,t.reverse())}}};function od(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function sd(e){let t={},n=-1,r,i,a,o,s,c,l,u=new ad(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,cd(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return K(e,0,1/0,u.slice(0)),!l}function cd(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var ld={resolve:dd,tokenize:fd},ud={partial:!0,tokenize:pd};function dd(e){return sd(e),e}function fd(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Y(t)?e.check(ud,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function pd(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,a,`linePrefix`)}function a(i){if(i===null||Y(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function md(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||hu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Y(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||X(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||hu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function hd(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Y(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Y(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Z(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function gd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Y(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function _d(e,t){let n;return r;function r(i){return Y(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Z(i)?Q(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var vd={name:`definition`,tokenize:bd},yd={partial:!0,tokenize:xd};function bd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return hd.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=pu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return X(t)?_d(e,l)(t):l(t)}function l(t){return md(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(yd,d,d)(t)}function d(t){return Z(t)?Q(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Y(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function xd(e,t,n){return r;function r(t){return X(t)?_d(e,i)(t):n(t)}function i(t){return gd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Z(t)?Q(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Y(e)?t(e):n(e)}}var Sd={name:`hardBreakEscape`,tokenize:Cd};function Cd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Y(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var wd={name:`headingAtx`,resolve:Td,tokenize:Ed};function Td(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},K(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Ed(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||X(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Y(n)?(e.exit(`atxHeading`),t(n)):Z(n)?Q(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||X(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Dd=`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`.split(`.`),Od=[`pre`,`script`,`style`,`textarea`],kd={concrete:!0,name:`htmlFlow`,resolveTo:Md,tokenize:Nd},Ad={partial:!0,tokenize:Fd},jd={partial:!0,tokenize:Pd};function Md(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(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}function Nd(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):q(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):q(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return q(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||X(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Od.includes(l)?(i=1,r.interrupt?t(s):D(s)):Dd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||J(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return Z(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||q(t)?(e.consume(t),b):Z(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Z(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Z(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Y(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||X(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Z(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||Y(t)?D(t):Z(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):Y(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Ad,ue,te)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(jd,ne,ue)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||Y(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function ie(t){return t===45?(e.consume(t),ce):D(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):D(t)}function oe(t){if(t===62){let n=o.toLowerCase();return Od.includes(n)?(e.consume(t),le):D(t)}return q(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):D(t)}function se(t){return t===93?(e.consume(t),ce):D(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):D(t)}function le(t){return t===null||Y(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function Pd(e,t,n){let r=this;return i;function i(t){return Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Fd(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Lu,t,n)}}var Id={name:`htmlText`,tokenize:Ld};function Ld(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):q(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):q(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Y(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Y(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):Y(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Y(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return q(t)?(e.consume(t),S):n(t)}function S(t){return t===45||J(t)?(e.consume(t),S):C(t)}function C(t){return Y(t)?(o=C,ae(t)):Z(t)?(e.consume(t),C):ie(t)}function w(t){return t===45||J(t)?(e.consume(t),w):t===47||t===62||X(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ie):t===58||t===95||q(t)?(e.consume(t),E):Y(t)?(o=T,ae(t)):Z(t)?(e.consume(t),T):ie(t)}function E(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):Y(t)?(o=ee,ae(t)):Z(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):Y(t)?(o=D,ae(t)):Z(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):Y(t)?(o=te,ae(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||X(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||X(e)?T(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return Z(t)?Q(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var Rd={name:`labelEnd`,resolveAll:Hd,resolveTo:Ud,tokenize:Wd},zd={tokenize:Gd},Bd={tokenize:Kd},Vd={tokenize:qd};function Hd(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&K(e,0,e.length,n),e}function Ud(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=su(s,e.slice(a+1,a+r+3)),s=su(s,[[`enter`,u,t]]),s=su(s,Au(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=su(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=su(s,e.slice(o+1)),s=su(s,[[`exit`,c,t]]),K(e,a,e.length,s),e}function Wd(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(pu(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(zd,u,o?u:d)(t):t===91?e.attempt(Bd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Vd,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Gd(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return X(t)?_d(e,a)(t):a(t)}function a(t){return t===41?u(t):md(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return X(t)?_d(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?gd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return X(t)?_d(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Kd(e,t,n){let r=this;return i;function i(t){return hd.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(pu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function qd(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Jd={name:`labelStartImage`,resolveAll:Rd.resolveAll,tokenize:Yd};function Yd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Xd={name:`labelStartLink`,resolveAll:Rd.resolveAll,tokenize:Zd};function Zd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Qd={name:`lineEnding`,tokenize:$d};function $d(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}var ef={name:`thematicBreak`,tokenize:tf};function tf(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Y(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Z(t)?Q(e,s,`whitespace`)(t):s(t))}}var $={continuation:{tokenize:of},exit:cf,name:`list`,tokenize:af},nf={partial:!0,tokenize:lf},rf={partial:!0,tokenize:sf};function af(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:gu(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ef,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return gu(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Lu,r.interrupt?n:u,e.attempt(nf,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Z(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function of(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Lu,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Q(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(rf,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt($,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function sf(e,t,n){let r=this;return Q(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function cf(e){e.exit(this.containerState.type)}function lf(e,t,n){let r=this;return Q(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var uf={name:`setextUnderline`,resolveTo:df,tokenize:ff};function df(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,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}function ff(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Z(t)?Q(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Y(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var pf={tokenize:mf};function mf(e){let t=this,n=e.attempt(Lu,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ld,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var hf={resolveAll:yf()},gf=vf(`string`),_f=vf(`text`);function vf(e){return{resolveAll:yf(e===`text`?bf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function yf(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function bf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var xf=s({attentionMarkers:()=>kf,contentInitial:()=>Cf,disable:()=>Af,document:()=>Sf,flow:()=>Tf,flowInitial:()=>wf,insideSpan:()=>Of,string:()=>Ef,text:()=>Df}),Sf={42:$,43:$,45:$,48:$,49:$,50:$,51:$,52:$,53:$,54:$,55:$,56:$,57:$,62:zu},Cf={91:vd},wf={[-2]:Zu,[-1]:Zu,32:Zu},Tf={35:wd,42:ef,45:[uf,ef],60:kd,61:uf,95:ef,96:Ju,126:Ju},Ef={38:Gu,92:Uu},Df={[-5]:Qd,[-4]:Qd,[-3]:Qd,33:Jd,38:Gu,42:ju,60:[Fu,Id],91:Xd,92:[Sd,Uu],93:Rd,95:ju,96:td},Of={null:[ju,hf]},kf={null:[42,95]},Af={null:[]};function jf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=su(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Au(a,l.events,l),l.events):[]}function f(e,t){return Nf(p(e),t)}function p(e){return Mf(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Y(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&K(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Mf(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Nf(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
46
71
|
`;break;case-3:o=`\r
|
|
47
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function jf(e){let t={constructs:ou([vf,...(e||{}).extensions||[]]),content:n(bu),defined:[],document:n(Su),flow:n(uf),lazy:{},string:n(pf),text:n(mf)};return t;function n(e){return n;function n(n){return Of(t,e,n)}}}function Mf(e){for(;!id(e););return e}var Nf=/[\0\t\n\r]/g;function Pf(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Nf.lastIndex=u,c=Nf.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Ff=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function If(e){return e.replace(Ff,Lf)}function Lf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return lu(n.slice(t?2:1),t?16:10)}return ru(n)||e}var Rf={}.hasOwnProperty;function zf(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Bf(n)(Mf(jf(n).document().write(Pf()(e,t,!0))))}function Bf(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(k),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(Se),blockQuote:a(ve),characterEscape:T,characterReference:T,codeFenced:a(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ye,o),codeText:a(be,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(xe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(O),hardBreakEscape:a(Ce),hardBreakTrailing:a(Ce),htmlFlow:a(we,o),htmlFlowData:T,htmlText:a(we,o),htmlTextData:T,image:a(Te),label:o,link:a(k),listItem:a(De),listItemValue:f,listOrdered:a(Ee,d),listUnordered:a(Ee),paragraph:a(Oe),reference:de,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Se),strong:a(ke),thematicBreak:a(je)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:_e,autolinkProtocol:ge,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:me,characterReference:he,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(re),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(te),htmlFlowData:E,htmlText:c(ne),htmlTextData:E,image:c(ae),label:se,labelText:oe,lineEnding:ee,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:fe,resourceDestinationString:ce,resourceTitleString:le,resource:ue,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Hf(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Rf.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Wf).call(a,void 0,e[0])}for(r.position={start:Vf(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Vf(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Vf(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Wf).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+_l({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Vf(e.end)}function u(){return Ql(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=uu(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ae(),n.position={start:Vf(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Vf(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Vf(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){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}function ae(){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}function oe(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=If(t),n.identifier=uu(t).toLowerCase()}function se(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function le(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ue(){this.data.inReference=void 0}function de(){this.data.referenceType=`collapsed`}function fe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=uu(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function pe(e){this.data.characterReferenceType=e.type}function me(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=lu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ru(t);let i=this.stack[this.stack.length-1];i.value+=r}function he(e){let t=this.stack.pop();t.position.end=Vf(e.end)}function ge(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function _e(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ve(){return{type:`blockquote`,children:[]}}function ye(){return{type:`code`,lang:null,meta:null,value:``}}function be(){return{type:`inlineCode`,value:``}}function xe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function O(){return{type:`emphasis`,children:[]}}function Se(){return{type:`heading`,depth:0,children:[]}}function Ce(){return{type:`break`}}function we(){return{type:`html`,value:``}}function Te(){return{type:`image`,title:null,url:``,alt:null}}function k(){return{type:`link`,title:null,url:``,children:[]}}function Ee(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function De(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Oe(){return{type:`paragraph`,children:[]}}function ke(){return{type:`strong`,children:[]}}function Ae(){return{type:`text`,value:``}}function je(){return{type:`thematicBreak`}}}function Vf(e){return{line:e.line,column:e.column,offset:e.offset}}function Hf(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Hf(e,r):Uf(e,r)}}function Uf(e,t){let n;for(n in t)if(Rf.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Wf(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+_l({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_l({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+_l({start:t.start,end:t.end})+`) is still open`)}function Gf(e){let t=this;t.parser=n;function n(n){return zf(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Kf(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function qf(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
48
|
-
`}]}function
|
|
49
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function
|
|
72
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Pf(e){let t={constructs:lu([xf,...(e||{}).extensions||[]]),content:n(Cu),defined:[],document:n(Tu),flow:n(pf),lazy:{},string:n(gf),text:n(_f)};return t;function n(e){return n;function n(n){return jf(t,e,n)}}}function Ff(e){for(;!sd(e););return e}var If=/[\0\t\n\r]/g;function Lf(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(If.lastIndex=u,c=If.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Rf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zf(e){return e.replace(Rf,Bf)}function Bf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return fu(n.slice(t?2:1),t?16:10)}return ou(n)||e}var Vf={}.hasOwnProperty;function Hf(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Uf(n)(Ff(Pf(n).document().write(Lf()(e,t,!0))))}function Uf(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(k),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(Se),blockQuote:a(ve),characterEscape:T,characterReference:T,codeFenced:a(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ye,o),codeText:a(be,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(xe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(O),hardBreakEscape:a(Ce),hardBreakTrailing:a(Ce),htmlFlow:a(we,o),htmlFlowData:T,htmlText:a(we,o),htmlTextData:T,image:a(Te),label:o,link:a(k),listItem:a(De),listItemValue:f,listOrdered:a(Ee,d),listUnordered:a(Ee),paragraph:a(Oe),reference:de,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Se),strong:a(ke),thematicBreak:a(je)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:_e,autolinkProtocol:ge,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:me,characterReference:he,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(re),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(te),htmlFlowData:E,htmlText:c(ne),htmlTextData:E,image:c(ae),label:se,labelText:oe,lineEnding:ee,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:fe,resourceDestinationString:ce,resourceTitleString:le,resource:ue,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Gf(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Vf.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||qf).call(a,void 0,e[0])}for(r.position={start:Wf(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Wf(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Wf(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||qf).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+xl({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Wf(e.end)}function u(){return tu(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=pu(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ae(),n.position={start:Wf(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Wf(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Wf(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){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}function ae(){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}function oe(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=zf(t),n.identifier=pu(t).toLowerCase()}function se(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function le(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ue(){this.data.inReference=void 0}function de(){this.data.referenceType=`collapsed`}function fe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=pu(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function pe(e){this.data.characterReferenceType=e.type}function me(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=fu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=ou(t);let i=this.stack[this.stack.length-1];i.value+=r}function he(e){let t=this.stack.pop();t.position.end=Wf(e.end)}function ge(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function _e(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ve(){return{type:`blockquote`,children:[]}}function ye(){return{type:`code`,lang:null,meta:null,value:``}}function be(){return{type:`inlineCode`,value:``}}function xe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function O(){return{type:`emphasis`,children:[]}}function Se(){return{type:`heading`,depth:0,children:[]}}function Ce(){return{type:`break`}}function we(){return{type:`html`,value:``}}function Te(){return{type:`image`,title:null,url:``,alt:null}}function k(){return{type:`link`,title:null,url:``,children:[]}}function Ee(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function De(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Oe(){return{type:`paragraph`,children:[]}}function ke(){return{type:`strong`,children:[]}}function Ae(){return{type:`text`,value:``}}function je(){return{type:`thematicBreak`}}}function Wf(e){return{line:e.line,column:e.column,offset:e.offset}}function Gf(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Gf(e,r):Kf(e,r)}}function Kf(e,t){let n;for(n in t)if(Vf.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function qf(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+xl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xl({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+xl({start:t.start,end:t.end})+`) is still open`)}function Jf(e){let t=this;t.parser=n;function n(n){return Hf(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Yf(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Xf(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
73
|
+
`}]}function Zf(e,t){let n=t.value?t.value+`
|
|
74
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Qf(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $f(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ep(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Su(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={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(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function tp(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function np(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function rp(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function ip(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rp(e,t);let i={src:Su(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function ap(e,t){let n={src:Su(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function op(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function sp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rp(e,t);let i={href:Su(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function cp(e,t){let n={href:Su(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function lp(e,t,n){let r=e.all(t),i=n?up(n):dp(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
50
75
|
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
51
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function
|
|
76
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function up(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=dp(n[r])}return t}function dp(e){return e.spread??e.children.length>1}function fp(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function pp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function hp(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gp(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=vl(t.children[1]),o=_l(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function _p(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function vp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var yp=9,bp=32;function xp(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Sp(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Sp(t.slice(i),i>0,!1)),a.join(``)}function Sp(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===yp||t===bp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===yp||t===bp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Cp(e,t){let n={type:`text`,value:xp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wp(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Tp={blockquote:Yf,break:Xf,code:Zf,delete:Qf,emphasis:$f,footnoteReference:ep,heading:tp,html:np,imageReference:ip,image:ap,inlineCode:op,linkReference:sp,link:cp,listItem:lp,list:fp,paragraph:pp,root:mp,strong:hp,table:gp,tableCell:vp,tableRow:_p,text:Cp,thematicBreak:wp,toml:Ep,yaml:Ep,definition:Ep,footnoteDefinition:Ep};function Ep(){}var Dp=typeof self==`object`?self:globalThis,Op=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Dp[e](t)},kp=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(Op(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(Op(a,o),i)};return r},Ap=e=>kp(new Map,e)(0),jp=``,{toString:Mp}={},{keys:Np}=Object,Pp=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Mp.call(e).slice(8,-1);switch(n){case`Array`:return[1,jp];case`Object`:return[2,jp];case`Date`:return[3,jp];case`RegExp`:return[4,jp];case`Map`:return[5,jp];case`Set`:return[6,jp];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Fp=([e,t])=>e===0&&(t===`function`||t===`symbol`),Ip=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Pp(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Np(r))(e||!Fp(Pp(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Fp(Pp(n))||Fp(Pp(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Fp(Pp(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Lp=(e,{json:t,lossy:n}={})=>{let r=[];return Ip(!(t||n),!!t,new Map,r)(e),r},Rp=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Ap(Lp(e,t)):structuredClone(e):(e,t)=>Ap(Lp(e,t));function zp(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Bp(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Vp(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||zp,r=e.options.footnoteBackLabel||Bp,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Su(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Rp(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
52
77
|
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
53
|
-
`}]}}var
|
|
78
|
+
`}]}}var Hp=(function(e){if(e==null)return qp;if(typeof e==`function`)return Kp(e);if(typeof e==`object`)return Array.isArray(e)?Up(e):Wp(e);if(typeof e==`string`)return Gp(e);throw Error(`Expected function, string, or object as test`)});function Up(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Hp(e[n]);return Kp(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Wp(e){let t=e;return Kp(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Gp(e){return Kp(t);function t(t){return t&&t.type===e}}function Kp(e){return t;function t(t,n,r){return!!(Jp(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function qp(){return!0}function Jp(e){return typeof e==`object`&&!!e&&`type`in e}function Yp(e){return e}var Xp=[];function Zp(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Hp(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Yp(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Xp,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Qp(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Qp(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Xp:[e]}function $p(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Zp(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var em={}.hasOwnProperty,tm={};function nm(e,t){let n=t||tm,r=new Map,i=new Map,a={all:s,applyData:im,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Tp,...n.handlers},one:o,options:n,patch:rm,wrap:om};return $p(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(em.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=Rp(n);return r.children=a.all(e),r}return Rp(e)}return(a.options.unknownHandler||am)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=sm(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=sm(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function rm(e,t){e.position&&(t.position=bl(e))}function im(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,Rp(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function am(e,t){let n=t.data||{},r=`value`in t&&!(em.call(n,`hProperties`)||em.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function om(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
54
79
|
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
55
80
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
56
|
-
`}),n}function
|
|
57
|
-
`},i)),a}function am(e,t){return e&&`run`in e?async function(n,r){let i=im(n,{file:r,...t});await e.run(i,r)}:function(n,r){return im(n,{file:r,...e||t})}}function om(e){if(e)throw e}var sm=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function cm(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function lm(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?um(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function um(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var dm={basename:fm,dirname:pm,extname:mm,join:hm,sep:`/`};function fm(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);vm(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function pm(e){if(vm(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function mm(e){vm(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function hm(...e){let t=-1,n;for(;++t<e.length;)vm(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:gm(n)}function gm(e){vm(e);let t=e.codePointAt(0)===47,n=_m(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function _m(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function vm(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var ym={cwd:bm};function bm(){return`/`}function xm(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Sm(e){if(typeof e==`string`)e=new URL(e);else if(!xm(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(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Cm(e)}function Cm(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,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var wm=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Tm=class{constructor(e){let t;t=e?xm(e)?{path:e}:typeof e==`string`||km(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:ym.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<wm.length;){let e=wm[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)wm.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?dm.basename(this.path):void 0}set basename(e){Dm(e,`basename`),Em(e,`basename`),this.path=dm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?dm.dirname(this.path):void 0}set dirname(e){Om(this.basename,`dirname`),this.path=dm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?dm.extname(this.path):void 0}set extname(e){if(Em(e,`extname`),Om(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=dm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){xm(e)&&(e=Sm(e)),Dm(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?dm.basename(this.path,this.extname):void 0}set stem(e){Dm(e,`stem`),Em(e,`stem`),this.path=dm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new G(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Em(e,t){if(e&&e.includes(dm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+dm.sep+"`")}function Dm(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Om(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function km(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Am=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),jm=l(sm(),1),Mm={}.hasOwnProperty,Nm=new class e extends Am{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=lm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,jm.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Im(`data`,this.frozen),this.namespace[e]=t,this):Mm.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Im(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=zm(e),n=this.parser||this.Parser;return Pm(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Pm(`process`,this.parser||this.Parser),Fm(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=zm(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Vm(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Pm(`processSync`,this.parser||this.Parser),Fm(`processSync`,this.compiler||this.Compiler),this.process(e,r),Rm(`processSync`,`process`,t),n;function r(e,r){t=!0,om(e),n=r}}run(e,t,n){Lm(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=zm(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Rm(`runSync`,`run`,n),r;function i(e,t){om(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=zm(t),r=this.compiler||this.Compiler;return Fm(`stringify`,r),Lm(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Im(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}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");o(e.plugins),e.settings&&(r.settings=(0,jm.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];cm(o)&&cm(r)&&(r=(0,jm.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Pm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Fm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Im(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 Lm(e){if(!cm(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Rm(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function zm(e){return Bm(e)?e:new Tm(e)}function Bm(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Vm(e){return typeof e==`string`||Hm(e)}function Hm(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Um=[],Wm={allowDangerousHtml:!0},Gm=/^(https?|ircs?|mailto|xmpp)$/i,Km=[{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:`className`,id:`remove-classname`},{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 qm(e){let t=Jm(e),n=Ym(e);return Xm(t.runSync(t.parse(n),n),e)}function Jm(e){let t=e.rehypePlugins||Um,n=e.remarkPlugins||Um,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Wm}:Wm;return Nm().use(Gf).use(n).use(am,r).use(t)}function Ym(e){let t=e.children||``,n=new Tm;return typeof t==`string`?n.value=t:``+t,n}function Xm(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Zm;for(let e of Km)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Yp(e,l),Ol(e,{Fragment:f.Fragment,components:i,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Xl)if(Object.hasOwn(Xl,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Xl[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Zm(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Gm.test(e.slice(0,t))?e:``}function Qm(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function $m(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function eh(e,t,n){let r=Rp((n||{}).ignore||[]),i=th(t),a=-1;for(;++a<i.length;)qp(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function th(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([nh(e[0]),rh(e[1])])}return t}function nh(e){return typeof e==`string`?new RegExp($m(e),`g`):e}function rh(e){return typeof e==`function`?e:function(){return e}}var ih=`phrasing`,ah=[`autolink`,`link`,`image`,`label`];function oh(){return{transforms:[mh],enter:{literalAutolink:ch,literalAutolinkEmail:lh,literalAutolinkHttp:lh,literalAutolinkWww:lh},exit:{literalAutolink:ph,literalAutolinkEmail:fh,literalAutolinkHttp:uh,literalAutolinkWww:dh}}}function sh(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:ih,notInConstruct:ah},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:ih,notInConstruct:ah},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:ih,notInConstruct:ah}]}}function ch(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function lh(e){this.config.enter.autolinkProtocol.call(this,e)}function uh(e){this.config.exit.autolinkProtocol.call(this,e)}function dh(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function fh(e){this.config.exit.autolinkEmail.call(this,e)}function ph(e){this.exit(e)}function mh(e){eh(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,hh],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,gh]],{ignore:[`link`,`linkReference`]})}function hh(e,t,n,r,i){let a=``;if(!yh(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!_h(n)))return!1;let o=vh(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function gh(e,t,n,r){return!yh(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function _h(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function vh(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Qm(e,`(`),a=Qm(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function yh(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||_u(n)||gu(n))&&(!t||n!==47)}kh.peek=Oh;function bh(){this.buffer()}function xh(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Sh(){this.buffer()}function Ch(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function wh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=uu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Th(e){this.exit(e)}function Eh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=uu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Dh(e){this.exit(e)}function Oh(){return`[`}function kh(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Ah(){return{enter:{gfmFootnoteCallString:bh,gfmFootnoteCall:xh,gfmFootnoteDefinitionLabelString:Sh,gfmFootnoteDefinition:Ch},exit:{gfmFootnoteCallString:wh,gfmFootnoteCall:Th,gfmFootnoteDefinitionLabelString:Eh,gfmFootnoteDefinition:Dh}}}function jh(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:kh},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
58
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?
|
|
59
|
-
`)}function
|
|
60
|
-
`&&
|
|
61
|
-
`}function
|
|
81
|
+
`}),n}function sm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function cm(e,t){let n=nm(e,t),r=n.one(e,void 0),i=Vp(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
82
|
+
`},i)),a}function lm(e,t){return e&&`run`in e?async function(n,r){let i=cm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return cm(n,{file:r,...e||t})}}function um(e){if(e)throw e}var dm=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function fm(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function pm(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?mm(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function mm(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var hm={basename:gm,dirname:_m,extname:vm,join:ym,sep:`/`};function gm(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Sm(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function _m(e){if(Sm(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function vm(e){Sm(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function ym(...e){let t=-1,n;for(;++t<e.length;)Sm(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:bm(n)}function bm(e){Sm(e);let t=e.codePointAt(0)===47,n=xm(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function xm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Sm(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Cm={cwd:wm};function wm(){return`/`}function Tm(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Em(e){if(typeof e==`string`)e=new URL(e);else if(!Tm(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(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Dm(e)}function Dm(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,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Om=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],km=class{constructor(e){let t;t=e?Tm(e)?{path:e}:typeof e==`string`||Nm(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Cm.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Om.length;){let e=Om[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Om.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?hm.basename(this.path):void 0}set basename(e){jm(e,`basename`),Am(e,`basename`),this.path=hm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?hm.dirname(this.path):void 0}set dirname(e){Mm(this.basename,`dirname`),this.path=hm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?hm.extname(this.path):void 0}set extname(e){if(Am(e,`extname`),Mm(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=hm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Tm(e)&&(e=Em(e)),jm(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?hm.basename(this.path,this.extname):void 0}set stem(e){jm(e,`stem`),Am(e,`stem`),this.path=hm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new G(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Am(e,t){if(e&&e.includes(hm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+hm.sep+"`")}function jm(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Mm(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Nm(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Pm=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Fm=l(dm(),1),Im={}.hasOwnProperty,Lm=new class e extends Pm{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=pm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Fm.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Bm(`data`,this.frozen),this.namespace[e]=t,this):Im.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Bm(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Um(e),n=this.parser||this.Parser;return Rm(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Rm(`process`,this.parser||this.Parser),zm(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Um(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Gm(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Rm(`processSync`,this.parser||this.Parser),zm(`processSync`,this.compiler||this.Compiler),this.process(e,r),Hm(`processSync`,`process`,t),n;function r(e,r){t=!0,um(e),n=r}}run(e,t,n){Vm(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Um(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Hm(`runSync`,`run`,n),r;function i(e,t){um(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Um(t),r=this.compiler||this.Compiler;return zm(`stringify`,r),Vm(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Bm(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}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");o(e.plugins),e.settings&&(r.settings=(0,Fm.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];fm(o)&&fm(r)&&(r=(0,Fm.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Rm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function zm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Bm(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 Vm(e){if(!fm(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Hm(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Um(e){return Wm(e)?e:new km(e)}function Wm(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Gm(e){return typeof e==`string`||Km(e)}function Km(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var qm=[],Jm={allowDangerousHtml:!0},Ym=/^(https?|ircs?|mailto|xmpp)$/i,Xm=[{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:`className`,id:`remove-classname`},{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 Zm(e){let t=Qm(e),n=$m(e);return eh(t.runSync(t.parse(n),n),e)}function Qm(e){let t=e.rehypePlugins||qm,n=e.remarkPlugins||qm,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Jm}:Jm;return Lm().use(Jf).use(n).use(lm,r).use(t)}function $m(e){let t=e.children||``,n=new km;return typeof t==`string`?n.value=t:``+t,n}function eh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||th;for(let e of Xm)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return $p(e,l),jl(e,{Fragment:f.Fragment,components:i,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in $l)if(Object.hasOwn($l,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=$l[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function th(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Ym.test(e.slice(0,t))?e:``}function nh(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function rh(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function ih(e,t,n){let r=Hp((n||{}).ignore||[]),i=ah(t),a=-1;for(;++a<i.length;)Zp(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function ah(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([oh(e[0]),sh(e[1])])}return t}function oh(e){return typeof e==`string`?new RegExp(rh(e),`g`):e}function sh(e){return typeof e==`function`?e:function(){return e}}var ch=`phrasing`,lh=[`autolink`,`link`,`image`,`label`];function uh(){return{transforms:[vh],enter:{literalAutolink:fh,literalAutolinkEmail:ph,literalAutolinkHttp:ph,literalAutolinkWww:ph},exit:{literalAutolink:_h,literalAutolinkEmail:gh,literalAutolinkHttp:mh,literalAutolinkWww:hh}}}function dh(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:ch,notInConstruct:lh},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:ch,notInConstruct:lh},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:ch,notInConstruct:lh}]}}function fh(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function ph(e){this.config.enter.autolinkProtocol.call(this,e)}function mh(e){this.config.exit.autolinkProtocol.call(this,e)}function hh(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function gh(e){this.config.exit.autolinkEmail.call(this,e)}function _h(e){this.exit(e)}function vh(e){ih(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,yh],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bh]],{ignore:[`link`,`linkReference`]})}function yh(e,t,n,r,i){let a=``;if(!Ch(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!xh(n)))return!1;let o=Sh(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function bh(e,t,n,r){return!Ch(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function xh(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Sh(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=nh(e,`(`),a=nh(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Ch(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||bu(n)||yu(n))&&(!t||n!==47)}Nh.peek=Mh;function wh(){this.buffer()}function Th(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Eh(){this.buffer()}function Dh(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Oh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kh(e){this.exit(e)}function Ah(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jh(e){this.exit(e)}function Mh(){return`[`}function Nh(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Ph(){return{enter:{gfmFootnoteCallString:wh,gfmFootnoteCall:Th,gfmFootnoteDefinitionLabelString:Eh,gfmFootnoteDefinition:Dh},exit:{gfmFootnoteCallString:Oh,gfmFootnoteCall:kh,gfmFootnoteDefinitionLabelString:Ah,gfmFootnoteDefinition:jh}}}function Fh(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Nh},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
83
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Lh:Ih))),s(),o}}function Ih(e,t,n){return t===0?e:Lh(e,t,n)}function Lh(e,t,n){return(n?``:` `)+e}var Rh=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Uh.peek=Wh;function zh(){return{canContainEols:[`delete`],enter:{strikethrough:Vh},exit:{strikethrough:Hh}}}function Bh(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Rh}],handlers:{delete:Uh}}}function Vh(e){this.enter({type:`delete`,children:[]},e)}function Hh(e){this.exit(e)}function Uh(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Wh(){return`~`}function Gh(e){return e.length}function Kh(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Gh,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=qh(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Jh(r[d]);else{let e=Jh(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
84
|
+
`)}function qh(e){return e==null?``:String(e)}function Jh(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Yh(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),Xh);return i(),o}function Xh(e,t,n){return`>`+(n?``:` `)+e}function Zh(e,t){return Qh(e,t.inConstruct,!0)&&!Qh(e,t.notInConstruct,!1)}function Qh(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function $h(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
85
|
+
`&&Zh(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
86
|
+
`}function eg(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function tg(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function ng(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function rg(e,t,n,r){let i=ng(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(tg(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,ig);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(eg(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
62
87
|
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
63
88
|
`),a&&(u+=s.move(a+`
|
|
64
|
-
`)),u+=s.move(c),l(),u}function
|
|
65
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function
|
|
89
|
+
`)),u+=s.move(c),l(),u}function ig(e,t,n){return(n?``:` `)+e}function ag(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function og(e,t,n,r){let i=ag(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
90
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function sg(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function cg(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function lg(e,t,n){let r=ku(e),i=ku(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ug.peek=dg;function ug(e,t,n,r){let i=sg(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=lg(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=cg(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=lg(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+cg(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function dg(e,t,n){return n.options.emphasis||`*`}function fg(e,t){let n=!1;return $p(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&tu(e)&&(t.options.setext||n))}function pg(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(fg(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
66
91
|
`,after:`
|
|
67
92
|
`});return r(),t(),o+`
|
|
68
93
|
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
69
94
|
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
70
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=
|
|
95
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=cg(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}mg.peek=hg;function mg(e){return e.value||``}function hg(){return`<`}gg.peek=_g;function gg(e,t,n,r){let i=ag(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function _g(){return`!`}vg.peek=yg;function vg(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function yg(){return`!`}bg.peek=xg;function bg(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function xg(){return"`"}function Sg(e,t){let n=tu(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Cg.peek=wg;function Cg(e,t,n,r){let i=ag(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Sg(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function wg(e,t,n){return Sg(e,n)?`<`:`[`}Tg.peek=Eg;function Tg(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Eg(){return`[`}function Dg(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Og(e){let t=Dg(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function kg(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ag(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function jg(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?kg(n):Dg(n),s=e.ordered?o===`.`?`)`:`.`:Og(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Ag(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Mg(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Ng(e,t,n,r){let i=Mg(n),a=n.bulletCurrent||Dg(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Pg(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Fg=Hp([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Ig(e,t,n,r){return(e.children.some(function(e){return Fg(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Lg(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Rg.peek=zg;function Rg(e,t,n,r){let i=Lg(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=lg(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=cg(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=lg(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+cg(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function zg(e,t,n){return n.options.strong||`*`}function Bg(e,t,n,r){return n.safe(e.value,r)}function Vg(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Hg(e,t,n){let r=(Ag(n)+(n.options.ruleSpaces?` `:``)).repeat(Vg(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Ug={blockquote:Yh,break:$h,code:rg,definition:og,emphasis:ug,hardBreak:$h,heading:pg,html:mg,image:gg,imageReference:vg,inlineCode:bg,link:Cg,linkReference:Tg,list:jg,listItem:Ng,paragraph:Pg,root:Ig,strong:Rg,text:Bg,thematicBreak:Hg};function Wg(){return{enter:{table:Gg,tableData:Yg,tableHeader:Yg,tableRow:qg},exit:{codeText:Xg,table:Kg,tableData:Jg,tableHeader:Jg,tableRow:Jg}}}function Gg(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Kg(e){this.exit(e),this.data.inTable=void 0}function qg(e){this.enter({type:`tableRow`,children:[]},e)}function Jg(e){this.exit(e)}function Yg(e){this.enter({type:`tableCell`,children:[]},e)}function Xg(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Zg));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Zg(e,t){return t===`|`?t:e}function Qg(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
71
96
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
72
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Hh(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=zg.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Yg(){return{exit:{taskListCheckValueChecked:Zg,taskListCheckValueUnchecked:Zg,paragraph:Qg}}}function Xg(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:$g}}}function Zg(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Qg(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function $g(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=zg.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function e_(){return[oh(),Ah(),Fh(),Bg(),Yg()]}function t_(e){return{extensions:[sh(),jh(e),Ih(),Jg(e),Xg()]}}var n_={tokenize:g_,partial:!0},r_={tokenize:__,partial:!0},i_={tokenize:v_,partial:!0},a_={tokenize:y_,partial:!0},o_={tokenize:b_,partial:!0},s_={name:`wwwAutolink`,tokenize:m_,previous:x_},c_={name:`protocolAutolink`,tokenize:h_,previous:S_},l_={name:`emailAutolink`,tokenize:p_,previous:C_},u_={};function d_(){return{text:u_}}for(var f_=48;f_<123;)u_[f_]=l_,f_++,f_===58?f_=65:f_===91&&(f_=97);u_[43]=l_,u_[45]=l_,u_[46]=l_,u_[95]=l_,u_[72]=[l_,c_],u_[104]=[l_,c_],u_[87]=[l_,s_],u_[119]=[l_,s_];function p_(e,t,n){let r=this,i,a;return o;function o(t){return!w_(t)||!C_.call(r,r.previous)||T_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return w_(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(o_,u,l)(t):t===45||t===95||J(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&q(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function m_(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!x_.call(r,r.previous)||T_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(n_,e.attempt(r_,e.attempt(i_,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function h_(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&S_.call(r,r.previous)&&!T_(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(q(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||fu(t)||X(t)||_u(t)||gu(t)?n(t):e.attempt(r_,e.attempt(i_,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function g_(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function __(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(a_,c,s)(t):t===null||X(t)||_u(t)||t!==45&&gu(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function v_(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):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?e.check(a_,t,a)(o):o===null||X(o)||_u(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function y_(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||X(o)||_u(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||X(e)||_u(e)?t(e):r(e)}function a(e){return q(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):q(t)?(e.consume(t),o):n(t)}}function b_(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return J(e)?n(e):t(e)}}function x_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function S_(e){return!q(e)}function C_(e){return!(e===47||w_(e))}function w_(e){return e===43||e===45||e===46||e===95||J(e)}function T_(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var E_={tokenize:P_,partial:!0};function D_(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:j_,continuation:{tokenize:M_},exit:N_}},text:{91:{name:`gfmFootnoteCall`,tokenize:A_},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:O_,resolveTo:k_}}}}function O_(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=uu(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function k_(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function A_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||X(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(uu(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return X(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function j_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||X(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=uu(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return X(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Q(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function M_(e,t,n){return e.check(Pu,t,e.attempt(E_,t,n))}function N_(e){e.exit(`gfmFootnoteDefinition`)}function P_(e,t,n){let r=this;return Q(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function F_(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&K(o,o.length,0,Du(s,e.slice(r+1,n),t)),K(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),K(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Eu(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Eu(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var I_=class{constructor(){this.map=[]}add(e,t,n){L_(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function L_(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function R_(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function z_(){return{flow:{null:{name:`table`,tokenize:B_,resolveAll:V_}}}}function B_(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Y(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Z(t)?Q(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||X(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Z(t)?Q(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Z(t)?Q(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Y(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Z(t)?Q(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Y(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Y(n)?(e.exit(`tableRow`),t(n)):Z(n)?Q(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||X(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function V_(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new I_;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(U_(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=H_(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=H_(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=H_(f,t,o,i,n,d)):(o[0]=o[1],d=H_(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&U_(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=R_(t.events,n))}return e}function H_(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},W_(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=W_(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=W_(t.events,n[2]),a=W_(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},W_(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function U_(e,t,n,r,i){let a=[],o=W_(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function W_(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var G_={name:`tasklistCheck`,tokenize:q_};function K_(){return{text:{91:G_}}}function q_(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return X(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Y(r)?t(r):Z(r)?e.check({tokenize:J_},t,n)(r):n(r)}}function J_(e,t,n){return Q(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Y_(e){return ou([d_(),D_(),F_(e),z_(),K_()])}var X_={};function Z_(e){let t=this,n=e||X_,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Y_(n)),a.push(e_()),o.push(t_(n))}var Q_=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),$_={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function ev(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function tv(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function nv(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function rv(e){return nv(e)||ev(e)}var iv=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function av(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?rv:u===`decimal`?ev:tv;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&Q_.includes(y)&&(_=y,v=ru(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?ru(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):rv(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(ov(e))h(7,S),C=`�`;else if(e in $_)h(6,S),C=$_[e];else{let t=``;sv(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,iv[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function ov(e){return e>=55296&&e<=57343||e>1114111}function sv(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var cv=/["&'<>`]/g,lv=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,uv=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,dv=/[|\\{}()[\]^$+*?.]/g,fv=new WeakMap;function pv(e,t){if(e=e.replace(t.subset?mv(t.subset):cv,r),t.subset||t.escapeOnly)return e;return e.replace(lv,n).replace(uv,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function mv(e){let t=fv.get(e);return t||(t=hv(e),fv.set(e,t)),t}function hv(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(dv,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function gv(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function _v(e,t){return pv(e,Object.assign({format:gv},t))}var vv={}.hasOwnProperty,yv={},bv=/^[^\t\n\r "#'.<=>`}]+$/,xv=/^[^\t\n\r "'<=>`}]+$/;function Sv(){return{canContainEols:[`textDirective`],enter:{directiveContainer:wv,directiveContainerAttributes:jv,directiveContainerLabel:kv,directiveLeaf:Tv,directiveLeafAttributes:jv,directiveText:Ev,directiveTextAttributes:jv},exit:{directiveContainer:Lv,directiveContainerAttributeClassValue:Nv,directiveContainerAttributeIdValue:Mv,directiveContainerAttributeName:Fv,directiveContainerAttributeValue:Pv,directiveContainerAttributes:Iv,directiveContainerLabel:Av,directiveContainerName:Ov,directiveLeaf:Lv,directiveLeafAttributeClassValue:Nv,directiveLeafAttributeIdValue:Mv,directiveLeafAttributeName:Fv,directiveLeafAttributeValue:Pv,directiveLeafAttributes:Iv,directiveLeafName:Ov,directiveText:Lv,directiveTextAttributeClassValue:Nv,directiveTextAttributeIdValue:Mv,directiveTextAttributeName:Fv,directiveTextAttributeValue:Pv,directiveTextAttributes:Iv,directiveTextName:Ov}}}function Cv(e){let t=e||yv;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=Rv,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
|
|
73
|
-
`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=
|
|
97
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Kh(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Ug.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function $g(){return{exit:{taskListCheckValueChecked:t_,taskListCheckValueUnchecked:t_,paragraph:n_}}}function e_(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:r_}}}function t_(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function n_(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function r_(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Ug.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function i_(){return[uh(),Ph(),zh(),Wg(),$g()]}function a_(e){return{extensions:[dh(),Fh(e),Bh(),Qg(e),e_()]}}var o_={tokenize:b_,partial:!0},s_={tokenize:x_,partial:!0},c_={tokenize:S_,partial:!0},l_={tokenize:C_,partial:!0},u_={tokenize:w_,partial:!0},d_={name:`wwwAutolink`,tokenize:v_,previous:T_},f_={name:`protocolAutolink`,tokenize:y_,previous:E_},p_={name:`emailAutolink`,tokenize:__,previous:D_},m_={};function h_(){return{text:m_}}for(var g_=48;g_<123;)m_[g_]=p_,g_++,g_===58?g_=65:g_===91&&(g_=97);m_[43]=p_,m_[45]=p_,m_[46]=p_,m_[95]=p_,m_[72]=[p_,f_],m_[104]=[p_,f_],m_[87]=[p_,d_],m_[119]=[p_,d_];function __(e,t,n){let r=this,i,a;return o;function o(t){return!O_(t)||!D_.call(r,r.previous)||k_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return O_(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(u_,u,l)(t):t===45||t===95||J(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&q(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function v_(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!T_.call(r,r.previous)||k_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(o_,e.attempt(s_,e.attempt(c_,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function y_(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&E_.call(r,r.previous)&&!k_(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(q(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||hu(t)||X(t)||bu(t)||yu(t)?n(t):e.attempt(s_,e.attempt(c_,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function b_(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function x_(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(l_,c,s)(t):t===null||X(t)||bu(t)||t!==45&&yu(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function S_(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):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?e.check(l_,t,a)(o):o===null||X(o)||bu(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function C_(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||X(o)||bu(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||X(e)||bu(e)?t(e):r(e)}function a(e){return q(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):q(t)?(e.consume(t),o):n(t)}}function w_(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return J(e)?n(e):t(e)}}function T_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function E_(e){return!q(e)}function D_(e){return!(e===47||O_(e))}function O_(e){return e===43||e===45||e===46||e===95||J(e)}function k_(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var A_={tokenize:R_,partial:!0};function j_(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:F_,continuation:{tokenize:I_},exit:L_}},text:{91:{name:`gfmFootnoteCall`,tokenize:P_},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:M_,resolveTo:N_}}}}function M_(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=pu(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function N_(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function P_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||X(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(pu(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return X(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function F_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||X(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=pu(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return X(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Q(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function I_(e,t,n){return e.check(Lu,t,e.attempt(A_,t,n))}function L_(e){e.exit(`gfmFootnoteDefinition`)}function R_(e,t,n){let r=this;return Q(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function z_(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&K(o,o.length,0,Au(s,e.slice(r+1,n),t)),K(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),K(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=ku(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=ku(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var B_=class{constructor(){this.map=[]}add(e,t,n){V_(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function V_(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function H_(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function U_(){return{flow:{null:{name:`table`,tokenize:W_,resolveAll:G_}}}}function W_(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Y(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Z(t)?Q(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||X(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Z(t)?Q(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Z(t)?Q(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Y(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Z(t)?Q(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Y(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Y(n)?(e.exit(`tableRow`),t(n)):Z(n)?Q(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||X(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function G_(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new B_;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(q_(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=K_(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=K_(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=K_(f,t,o,i,n,d)):(o[0]=o[1],d=K_(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&q_(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=H_(t.events,n))}return e}function K_(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},J_(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=J_(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=J_(t.events,n[2]),a=J_(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},J_(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function q_(e,t,n,r,i){let a=[],o=J_(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function J_(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Y_={name:`tasklistCheck`,tokenize:Z_};function X_(){return{text:{91:Y_}}}function Z_(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return X(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Y(r)?t(r):Z(r)?e.check({tokenize:Q_},t,n)(r):n(r)}}function Q_(e,t,n){return Q(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function $_(e){return lu([h_(),j_(),z_(e),U_(),X_()])}var ev={};function tv(e){let t=this,n=e||ev,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push($_(n)),a.push(i_()),o.push(a_(n))}var nv=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),rv={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function iv(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function av(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function ov(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function sv(e){return ov(e)||iv(e)}var cv=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function lv(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?sv:u===`decimal`?iv:av;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&nv.includes(y)&&(_=y,v=ou(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?ou(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):sv(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(uv(e))h(7,S),C=`�`;else if(e in rv)h(6,S),C=rv[e];else{let t=``;dv(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,cv[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function uv(e){return e>=55296&&e<=57343||e>1114111}function dv(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var fv=/["&'<>`]/g,pv=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,mv=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,hv=/[|\\{}()[\]^$+*?.]/g,gv=new WeakMap;function _v(e,t){if(e=e.replace(t.subset?vv(t.subset):fv,r),t.subset||t.escapeOnly)return e;return e.replace(pv,n).replace(mv,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function vv(e){let t=gv.get(e);return t||(t=yv(e),gv.set(e,t)),t}function yv(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(hv,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function bv(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function xv(e,t){return _v(e,Object.assign({format:bv},t))}var Sv={}.hasOwnProperty,Cv={},wv=/^[^\t\n\r "#'.<=>`}]+$/,Tv=/^[^\t\n\r "'<=>`}]+$/;function Ev(){return{canContainEols:[`textDirective`],enter:{directiveContainer:Ov,directiveContainerAttributes:Fv,directiveContainerLabel:Nv,directiveLeaf:kv,directiveLeafAttributes:Fv,directiveText:Av,directiveTextAttributes:Fv},exit:{directiveContainer:Vv,directiveContainerAttributeClassValue:Lv,directiveContainerAttributeIdValue:Iv,directiveContainerAttributeName:zv,directiveContainerAttributeValue:Rv,directiveContainerAttributes:Bv,directiveContainerLabel:Pv,directiveContainerName:Mv,directiveLeaf:Vv,directiveLeafAttributeClassValue:Lv,directiveLeafAttributeIdValue:Iv,directiveLeafAttributeName:zv,directiveLeafAttributeValue:Rv,directiveLeafAttributes:Bv,directiveLeafName:Mv,directiveText:Vv,directiveTextAttributeClassValue:Lv,directiveTextAttributeIdValue:Iv,directiveTextAttributeName:zv,directiveTextAttributeValue:Rv,directiveTextAttributes:Bv,directiveTextName:Mv}}}function Dv(e){let t=e||Cv;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=Hv,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
|
|
98
|
+
`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=Wv(e),s=n.enter(e.type),c=a.move(o+(e.name||``)),l;if(e.type===`containerDirective`){let t=(e.children||[])[0];l=Uv(t)?t:void 0}else l=e;if(l&&l.children&&l.children.length>0){let t=n.enter(`label`),r=`${e.type}Label`,i=n.enter(r);c+=a.move(`[`),c+=a.move(n.containerPhrasing(l,{...a.current(),before:c,after:`]`})),c+=a.move(`]`),i(),t()}if(c+=a.move(r(e,n)),e.type===`containerDirective`){let t=(e.children||[])[0],r=e;Uv(t)&&(r=Object.assign({},e,{children:e.children.slice(1)})),r&&r.children&&r.children.length>0&&(c+=a.move(`
|
|
74
99
|
`),c+=a.move(n.containerFlow(r,a.current()))),c+=a.move(`
|
|
75
|
-
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(
|
|
76
|
-
`,`\r`];return e+`=`+s+_v(n,{subset:c})+s}}function wv(e){Dv.call(this,`containerDirective`,e)}function Tv(e){Dv.call(this,`leafDirective`,e)}function Ev(e){Dv.call(this,`textDirective`,e)}function Dv(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function Ov(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function kv(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function Av(e){this.exit(e)}function jv(){this.data.directiveAttributes=[],this.buffer()}function Mv(e){this.data.directiveAttributes.push([`id`,av(this.sliceSerialize(e),{attribute:!0})])}function Nv(e){this.data.directiveAttributes.push([`class`,av(this.sliceSerialize(e),{attribute:!0})])}function Pv(e){let t=this.data.directiveAttributes;t[t.length-1][1]=av(this.sliceSerialize(e),{attribute:!0})}function Fv(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Iv(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function Lv(e){this.exit(e)}function Rv(){return`:`}function zv(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function Bv(e){let t=0;return e.type===`containerDirective`?(qp(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function Vv(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&Z(t)?Q(e,v,`whitespace`)(t):!m&&X(t)?md(e,v)(t):t===null||Y(t)||_u(t)||gu(t)&&t!==45&&t!==95?ne(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||X(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||X(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||Y(t)||_u(t)||gu(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Z(t)?Q(e,C,`whitespace`)(t):!m&&X(t)?md(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&Y(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&Z(t)?Q(e,w,`whitespace`)(t):!m&&X(t)?md(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||X(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function E(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),te):(e.enter(d),ee(t))}function ee(t){return t===g?(e.exit(d),E(t)):t===null?n(t):Y(t)?m?n(t):md(e,ee)(t):(e.enter(p),e.consume(t),D)}function D(t){return t===g||t===null||Y(t)?(e.exit(p),ee(t)):(e.consume(t),D)}function te(e){return e===125||X(e)?v(e):ne(e)}function ne(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function Hv(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):Y(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function Uv(e,t,n,r){let i=this;return a;function a(t){return t===null||Y(t)||gu(t)||_u(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Y(a)||_u(a)||gu(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var Wv={tokenize:Jv,concrete:!0},Gv={tokenize:Yv,partial:!0},Kv={tokenize:Xv,partial:!0},qv={tokenize:Zv,partial:!0};function Jv(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),Uv.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(Gv,d,d)(t):d(t)}function d(t){return t===123?e.attempt(Kv,f,f)(t):f(t)}function f(t){return Q(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):Y(i)?r.interrupt?t(i):e.attempt(qv,m,C)(i):n(i)}function m(t){return t===null?C(t):Y(t)?e.check(qv,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?Q(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):Y(t)?e.check(qv,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return Y(t)?e.check(qv,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),Q(e,c,`whitespace`)(t))}function c(r){return r===null||Y(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function Yv(e,t,n){return Hv(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function Xv(e,t,n){return Vv(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function Zv(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Qv={tokenize:ty},$v={tokenize:ny,partial:!0},ey={tokenize:ry,partial:!0};function ty(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),Uv.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt($v,s,s)(t):s(t)}function s(t){return t===123?e.attempt(ey,c,c)(t):c(t)}function c(t){return Q(e,l,`whitespace`)(t)}function l(r){return r===null||Y(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function ny(e,t,n){return Hv(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function ry(e,t,n){return Vv(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var iy={tokenize:cy,previous:sy},ay={tokenize:ly,partial:!0},oy={tokenize:uy,partial:!0};function sy(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function cy(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),Uv.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(ay,o,o)(t):o(t)}function o(t){return t===123?e.attempt(oy,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function ly(e,t,n){return Hv(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function uy(e,t,n){return Vv(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function dy(){return{text:{58:iy},flow:{58:[Wv,Qv]}}}function fy(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(dy()),n.push(Sv()),r.push(Cv())}function py({markdown:e}){return(0,f.jsx)(`div`,{className:`report-artifact`,children:(0,f.jsx)(qm,{remarkPlugins:[fy,()=>e=>{let t=e=>{let n=[`grid`,`column`].includes(e.name);[`containerDirective`,`leafDirective`,`textDirective`].includes(e.type)&&n&&(e.data=e.data||{},e.data.hName=e.name,e.data.hProperties=e.attributes||{}),e.children&&e.children.forEach(t)};t(e)},Z_],components:{h1:({children:e})=>(0,f.jsx)(`h1`,{children:e}),h2:({children:e})=>(0,f.jsx)(`h2`,{children:e}),h3:({children:e})=>(0,f.jsx)(`h3`,{children:e}),p:({children:e})=>(0,f.jsx)(`p`,{children:e}),ul:({children:e})=>(0,f.jsx)(`ul`,{children:e}),ol:({children:e})=>(0,f.jsx)(`ol`,{children:e}),li:({children:e})=>(0,f.jsx)(`li`,{children:e}),a:({children:e,href:t})=>(0,f.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:e}),blockquote:({children:e})=>(0,f.jsx)(`blockquote`,{children:e}),hr:()=>(0,f.jsx)(`hr`,{}),table:({children:e})=>(0,f.jsx)(`div`,{className:`report-artifact-table-wrapper`,children:(0,f.jsx)(`table`,{children:e})}),thead:({children:e})=>(0,f.jsx)(`thead`,{children:e}),th:({children:e})=>(0,f.jsx)(`th`,{children:e}),td:({children:e})=>(0,f.jsx)(`td`,{children:e}),code:e=>{let{children:t,className:n,...r}=e;return/language-(\w+)/.exec(n||``)?.[1]===`ericachart`?(0,f.jsx)(vc,{markdown:t}):(0,f.jsx)(`code`,{...r,className:n,children:t})},grid:({children:e,columns:t})=>(0,f.jsx)(`div`,{className:`report-grid report-grid--cols-${t?Number(t):2}`,children:e})},children:e})})}function my({title:e,reportContent:t}){let n=Cc(),r=()=>{n.setTitle(e),n.setContent((0,f.jsx)(py,{markdown:t})),n.onOpen()};return(0,f.jsx)(`div`,{onClick:r,className:`report-item-card`,children:(0,f.jsxs)(`div`,{className:`report-item-content`,children:[(0,f.jsx)(`div`,{className:`report-item-icon-wrapper`,children:(0,f.jsx)(`svg`,{className:`report-item-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})})}),(0,f.jsxs)(`div`,{className:`report-item-text-wrapper`,children:[(0,f.jsx)(`span`,{className:`report-item-title`,children:e}),(0,f.jsx)(`span`,{className:`report-item-subtitle`,children:`Business Report`})]}),(0,f.jsx)(`button`,{onClick:r,className:`report-item-button`,children:`Show Report`})]})})}function hy({path:e,title:t}){let n=e.split(`/`),r=n[5],i=n[6],{data:a,isLoading:o}=Lt({queryKey:[`artifact`,r,e],queryFn:()=>Ws.get(r,i),enabled:!!r&&!!e});return o?(0,f.jsx)(`div`,{className:`report-loader-loading`,children:`loading report...`}):a?(0,f.jsx)(my,{title:t,reportContent:a}):(0,f.jsx)(`div`,{className:`report-loader-no-data`,children:`No report data available`})}function gy({message:e,datasetUuid:t,upsertKey:n,rows:r,previewRows:i,hiddenCount:a,onApprove:o,onReject:s}){let[c,l]=(0,u.useState)(!1),[d,p]=(0,u.useState)(``),m=()=>{c?s(d||void 0):l(!0)},h=i.length>0?Object.keys(i[0]):[];return(0,f.jsxs)(`div`,{className:`dataset-approval-card`,children:[(0,f.jsxs)(`div`,{className:`dataset-approval-header`,children:[(0,f.jsx)(`h3`,{className:`dataset-approval-title`,children:e}),t&&(0,f.jsxs)(`p`,{className:`dataset-approval-meta`,children:[`Dataset: `,(0,f.jsx)(`code`,{className:`dataset-approval-code`,children:t})]}),n&&n.length>0&&(0,f.jsxs)(`p`,{className:`dataset-approval-meta`,children:[`Upsert Key: `,(0,f.jsx)(`code`,{className:`dataset-approval-code`,children:n.join(`, `)})]})]}),i.length>0&&(0,f.jsxs)(`div`,{className:`dataset-approval-table-wrapper`,children:[(0,f.jsxs)(`table`,{className:`dataset-approval-table`,children:[(0,f.jsx)(`thead`,{className:`dataset-approval-thead`,children:(0,f.jsx)(`tr`,{children:h.map(e=>(0,f.jsx)(`th`,{className:`dataset-approval-th`,children:e},e))})}),(0,f.jsx)(`tbody`,{children:i.map((e,t)=>(0,f.jsx)(`tr`,{className:`dataset-approval-tr`,children:h.map(t=>(0,f.jsx)(`td`,{className:`dataset-approval-td`,children:String(e[t]??``)},t))},t))})]}),a>0&&(0,f.jsxs)(`p`,{className:`dataset-approval-hidden-count`,children:[`... and `,a,` more row`,a===1?``:`s`]})]}),(0,f.jsxs)(`div`,{className:`dataset-approval-total`,children:[`Total rows: `,r.length]}),c&&(0,f.jsxs)(`div`,{className:`dataset-approval-reject-section`,children:[(0,f.jsx)(`label`,{className:`dataset-approval-reject-label`,children:`Rejection reason (optional):`}),(0,f.jsx)(`input`,{type:`text`,value:d,onChange:e=>p(e.target.value),className:`dataset-approval-reject-input`,placeholder:`Enter reason...`})]}),(0,f.jsxs)(`div`,{className:`dataset-approval-buttons`,children:[(0,f.jsx)(`button`,{onClick:o,className:`dataset-approval-btn dataset-approval-btn-approve`,children:`Approve`}),(0,f.jsx)(`button`,{onClick:m,className:`dataset-approval-btn dataset-approval-btn-reject`,children:c?`Confirm Reject`:`Reject`}),c&&(0,f.jsx)(`button`,{onClick:()=>{l(!1),p(``)},className:`dataset-approval-btn-cancel`,children:`Cancel`})]})]})}function _y({name:e}){let t=(0,u.useContext)(Zt);return(0,u.useEffect)(()=>{t&&t.setStep(e)},[e,t]),null}function vy(){return(0,d.useRenderTool)({name:`showChart`,parameters:Hs,render:({parameters:e})=>e.compiled_chart?.path?(0,f.jsx)(bc,{path:e.compiled_chart.path}):(0,f.jsx)(`div`,{children:`No chart path provided`})},[]),(0,d.useRenderTool)({name:`showReport`,parameters:Us,render:({parameters:e})=>e.compiled_report?.path?(0,f.jsx)(hy,{path:e.compiled_report.path,title:e.compiled_report.title}):(0,f.jsx)(`div`,{children:`No report path provided`})},[]),(0,d.useDefaultRenderTool)({render:({name:e})=>(0,f.jsx)(_y,{name:e})},[]),(0,d.useInterrupt)({render:({event:e,resolve:t})=>{let n={};try{n=typeof e.value==`string`?JSON.parse(e.value):e.value}catch{}if(n?.type===`write_to_dataset`){let{message:e,action:r}=n,i=r?.rows??[],a=i.slice(0,3),o=i.length-a.length;return(0,f.jsx)(gy,{message:e??`Approve this action?`,datasetUuid:r?.dataset_uuid,upsertKey:r?.upsert_key,rows:i,previewRows:a,hiddenCount:o,onApprove:()=>t({approved:!0}),onReject:e=>t({approved:!1,...e?{reason:e}:{}})})}return(0,f.jsx)(`div`,{className:`tools-interrupt-fallback`,children:(0,f.jsx)(`p`,{children:typeof e.value==`string`?e.value:JSON.stringify(e.value)})})}}),null}var yy=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/[_-]/g,` `).toLowerCase().trim().replace(/\s+/g,` `);function by(){let e=(0,u.useContext)(Zt),t=`digesting`;return e?.step&&(t=e.step===`ls`?`listing files`:yy(e.step)),(0,f.jsxs)(`div`,{className:`chat-message-spinner-container`,children:[(0,f.jsx)(`div`,{className:`chat-message-spinner-icon`}),(0,f.jsxs)(`div`,{className:`chat-message-spinner-text`,children:[t,(0,f.jsxs)(`span`,{className:`chat-message-spinner-dots`,children:[(0,f.jsx)(`span`,{className:`chat-message-spinner-dot chat-message-spinner-dot--1`,children:`.`}),(0,f.jsx)(`span`,{className:`chat-message-spinner-dot chat-message-spinner-dot--2`,children:`.`}),(0,f.jsx)(`span`,{className:`chat-message-spinner-dot chat-message-spinner-dot--3`,children:`.`})]})]})]})}function xy({message:e}){return(0,f.jsxs)(`div`,{className:`loading-message-container`,children:[(0,f.jsx)(`div`,{className:`loading-message-spinner`}),(0,f.jsxs)(`div`,{className:`loading-message-text`,children:[e,(0,f.jsxs)(`span`,{className:`loading-message-dots`,children:[(0,f.jsx)(`span`,{className:`loading-message-dot loading-message-dot--1`,children:`.`}),(0,f.jsx)(`span`,{className:`loading-message-dot loading-message-dot--2`,children:`.`}),(0,f.jsx)(`span`,{className:`loading-message-dot loading-message-dot--3`,children:`.`})]})]})]})}var Sy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Cy=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),wy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ty=e=>{let t=wy(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ey={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Dy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Oy=(0,u.createContext)({}),ky=()=>(0,u.useContext)(Oy),Ay=(0,u.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=ky()??{},h=r??f?Number(n??d)*24/Number(t??l):n??d;return(0,u.createElement)(`svg`,{ref:c,...Ey,width:t??l??Ey.width,height:t??l??Ey.height,stroke:e??p,strokeWidth:h,className:Sy(`lucide`,m,i),...!a&&!Dy(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,u.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),jy=(e,t)=>{let n=(0,u.forwardRef)(({className:n,...r},i)=>(0,u.createElement)(Ay,{ref:i,iconNode:t,className:Sy(`lucide-${Cy(Ty(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ty(e),n},My=jy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ny=jy(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Py=jy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Fy(e){if(!e)return``;let t=e.split(`:`);return(t.length>1?t.slice(1).join(` `):e).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Iy(e){if(!e)return``;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:i<7?`${i}d ago`:new Date(e).toLocaleDateString()}function Ly({onNewChat:e,onThreadSelect:t}){let[n,r]=(0,u.useState)(!1),i=(0,u.useRef)(null),a=(0,d.useCopilotChatConfiguration)(),{data:o=[],isLoading:s}=Jt();(0,u.useEffect)(()=>{function e(e){i.current&&!i.current.contains(e.target)&&r(!1)}if(n)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[n]);function c(e){r(!1),t?.(e)}return(0,f.jsxs)(`div`,{className:`erica-header`,children:[(0,f.jsxs)(`h2`,{className:`erica-header-title`,children:[`SPP AI `,(0,f.jsx)(`span`,{className:`erica-header-version`,children:`v1.1.3`})]}),(0,f.jsxs)(`div`,{className:`erica-header-controls`,ref:i,children:[(0,f.jsx)(`button`,{onClick:e,className:`erica-new-chat-button`,title:`Start new chat`,children:(0,f.jsx)(Ny,{className:`erica-icon-sm`})}),(0,f.jsxs)(`button`,{onClick:()=>r(!n),className:`erica-threads-toggle`,title:`Recent threads`,children:[(0,f.jsxs)(`span`,{className:`erica-threads-toggle-text`,children:[`Riwayat `,o.length>0&&`(${o.length})`]}),(0,f.jsx)(My,{className:`erica-threads-toggle-icon ${n?`erica-threads-toggle-icon--open`:``}`})]}),a?.setModalOpen&&(0,f.jsx)(`button`,{onClick:()=>a.setModalOpen(!1),className:`erica-close-button`,title:`Close sidebar`,children:(0,f.jsx)(Py,{className:`erica-icon-sm`})}),n&&(0,f.jsx)(`div`,{className:`erica-threads-dropdown`,children:(0,f.jsxs)(`div`,{className:`erica-threads-dropdown-content`,children:[(0,f.jsx)(`div`,{className:`erica-threads-dropdown-header`,children:`Riwayat Terakhir`}),s&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`Loading threads...`}),!s&&o.length===0&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`No conversations yet`}),!s&&o.map(e=>{let t=Fy(e.agent),n=Iy(e.last_run_at??e.created_at);return(0,f.jsx)(`button`,{onClick:()=>c(e.uid),className:`erica-thread-item`,children:(0,f.jsxs)(`div`,{className:`erica-thread-item-content`,children:[(0,f.jsx)(`span`,{className:`erica-thread-title`,children:typeof e.thread_metadata?.title==`string`?e.thread_metadata.title:e.last_message??`New conversation`}),(0,f.jsxs)(`div`,{className:`erica-thread-meta`,children:[t&&(0,f.jsx)(`span`,{className:`erica-thread-agent`,children:t}),n&&(0,f.jsx)(`span`,{className:`erica-thread-time`,children:n})]})]})},e.uid)})]})})]})]})}var Ry=(0,u.createContext)(void 0);function zy({accountUid:e,children:t}){return(0,f.jsx)(Ry.Provider,{value:{accountUid:e},children:t})}function By(){let e=(0,u.useContext)(Ry);if(!e)throw Error(`useAccount must be used within AccountProvider`);return e}var Vy={upload:async(e,t,n)=>{let{data:r}=await Bt({body:{file:e,prefix:t,ocr:n},throwOnError:!0});return r.data},download:async(e,t)=>{let n=e.split(`/`),r=n[n.length-1],i=n.slice(-3,-1).join(`/`),{data:a}=await Vt({path:{filename:r},query:i?{prefix:i}:{},parseAs:`blob`,throwOnError:!0}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}};function Hy({attachment:e}){let{accountUid:t}=By(),[n,r]=(0,u.useState)(!1);async function i(){r(!0);try{await Vy.download(t,e.file_path,e.original_name)}finally{r(!1)}}return(0,f.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},title:e.original_name,className:`attachment-item`,children:[n?(0,f.jsx)(`div`,{className:`attachment-item-spinner`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`svg`,{className:`attachment-item-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13`})}),(0,f.jsx)(`svg`,{className:`attachment-item-icon-download`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})})]}),(0,f.jsx)(`span`,{className:`attachment-item-text`,children:e.original_name})]})}function Uy({children:e}){let t=String(e).trim(),n=[];try{n=JSON.parse(t)}catch{return null}return n.length===0?null:(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1.5 py-1`,children:n.map((e,t)=>(0,f.jsx)(Hy,{attachment:e},t))})}function Wy({message:e=`Hai! Saya SPP AI, siap membantu Anda!`,isOpen:t=!1,initialDelay:n=1e4}){let[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{let e=setTimeout(()=>{i(!0)},n);return()=>clearTimeout(e)},[n]),!r||t||a?null:(0,f.jsx)(`div`,{className:`chat-toggle-greeting-wrapper`,children:(0,f.jsxs)(`div`,{className:`chat-toggle-greeting-bubble`,children:[e,(0,f.jsx)(`button`,{onClick:()=>{i(!1),o(!0)},className:`chat-toggle-greeting-close`,"aria-label":`Dismiss greeting`,children:(0,f.jsx)(Py,{})})]})})}function Gy(e){eh(e,[/\r?\n|\r/g,Ky])}function Ky(){return{type:`break`}}function qy(){return function(e){Gy(e)}}var Jy=()=>e=>{let t=e=>{[`containerDirective`,`leafDirective`,`textDirective`].includes(e.type)&&e.name===`tool_call_content`&&(e.data=e.data||{},e.data.hName=e.name,e.data.hProperties=e.attributes||{},e.children=[]),e.children&&e.children.forEach(t)};t(e)},Yy=()=>e=>{let t=e=>{e.type===`textDirective`&&e.name===`resource`&&(e.data=e.data||{},e.data.hName=`resource`,e.data.hProperties=e.attributes||{}),e.children&&e.children.forEach(t)};t(e)};function Xy({runtimeUrl:e,widgetToken:t}){let[n,r]=(0,u.useState)(void 0),[i,a]=(0,u.useState)(!0),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(0),[p,m]=(0,u.useState)(!0),[h,g]=(0,u.useState)(!1),_=(0,u.useMemo)(()=>{let t=new URL(e),n=t.pathname.split(`/`).filter(Boolean);return n.length>2&&n.pop(),t.pathname=`/`+n.join(`/`),t.toString()},[e]);(0,u.useMemo)(()=>{he(_,t)},[_,t]);let{data:v,isLoading:y}=Yt(i,c),{isLoading:b,isSuccess:x}=Xt(n||``,o);(0,u.useEffect)(()=>{x&&p&&h&&g(!0)},[x,p,h]),(0,u.useEffect)(()=>{v&&(r(v),a(!1),s(!0),m(!0))},[v]),(0,u.useEffect)(()=>()=>{n&&p&&Kt.deleteSandbox(n).catch(()=>{})},[n,p]);let S=(0,u.useCallback)(()=>{r(void 0),a(!0),s(!1),l(e=>e+1),m(!0),g(!0)},[]),C=(0,u.useCallback)(e=>{r(e),a(!1),s(!1),m(!1),g(!0)},[]);function w({threadId:e,isLoadingThreadId:t,isLoadingSandbox:n,isSandboxReady:r,isNewThread:i,handleNewChat:a,handleThreadSelect:o}){let s=`Halo! Saya asisten AI SPP, ada yg bisa saya bantu?`;t?s=(0,f.jsx)(xy,{message:`Initializing conversation`}):i&&n?s=(0,f.jsx)(xy,{message:`Preparing workspace`}):i&&!r&&(s=(0,f.jsx)(xy,{message:`Setting up environment`}));let c=(0,u.useCallback)(()=>(0,f.jsx)(Ly,{onNewChat:a,onThreadSelect:o}),[a,o]);return(0,f.jsxs)(`div`,{className:`erica-chat-container`,children:[(0,f.jsx)(vy,{}),(0,f.jsx)(Wy,{message:`Hai! Saya SPP AI, siap membantu Anda!`,isOpen:h,initialDelay:1e4}),(0,f.jsx)(d.CopilotSidebar,{welcomeScreen:!0,header:c,labels:{chatInputPlaceholder:`Ketik pertanyaan Anda di sini...`,welcomeMessageText:s,chatDisclaimerText:`AI dapat membuat kesalahan. Harap verifikasi informasi penting.`},threadId:e,messageView:{cursor:by,userMessage:{messageRenderer:({content:e,className:t})=>(0,f.jsx)(`div`,{className:[`cpk:prose cpk:dark:prose-invert cpk:bg-smi cpk:relative cpk:max-w-[80%] cpk:rounded-[18px] cpk:px-4 cpk:py-1.5 cpk:data-[multiline]:py-3 cpk:inline-block`,t].filter(Boolean).join(` `),children:(0,f.jsx)(qm,{remarkPlugins:[qy,Z_,fy,Yy],components:{pre:({children:e})=>(0,f.jsx)(f.Fragment,{children:e}),code({children:e,className:t}){return/language-(\w+)/.exec(t||``)?.[1]===`attachments`?(0,f.jsx)(Uy,{children:e}):(0,f.jsx)(`code`,{className:t,style:{fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:`0.85em`},children:e})},resource:({children:e})=>(0,f.jsxs)(`span`,{className:`erica-resource-tag`,children:[`@`,e]})},children:e})})},assistantMessage:{className:`prose lg:prose-xl`,toolbarVisible:!1,markdownRenderer:({content:e})=>!e||e.trim()===``?(0,f.jsx)(f.Fragment,{}):(0,f.jsx)(qm,{remarkPlugins:[qy,Z_,fy,Jy],components:{tool_call_content:({children:e,...t})=>(0,f.jsx)(`div`,{className:`tool-call-content`,...t,children:e})},children:e})}},defaultOpen:h})]})}return(0,f.jsx)(d.CopilotChatConfigurationProvider,{children:(0,f.jsx)(Qt,{threadId:n,children:(0,f.jsx)(d.CopilotKit,{runtimeUrl:e,headers:{Authorization:`Bearer ${t}`},properties:{agent:`account:agent_demo_smi`},threadId:n,enableInspector:!1,children:(0,f.jsx)(w,{threadId:n,isLoadingThreadId:y,isLoadingSandbox:b,isSandboxReady:x,isNewThread:p,handleNewChat:S,handleThreadSelect:C})})})})}var Zy=new bt({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});function Qy({accountUid:e,children:t}){return(0,f.jsx)(Ct,{client:Zy,children:(0,f.jsx)(zy,{accountUid:e,children:(0,f.jsx)(Sc,{children:t})})})}function $y(){let{isOpen:e,onClose:t,content:n,title:r}=Cc(),[i,a]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{e?setTimeout(()=>a(!0),10):a(!1)},[e]),e?(0,f.jsxs)(`div`,{className:`erica-artifact-container`,children:[(0,f.jsx)(`div`,{className:`erica-artifact-backdrop ${i?`erica-artifact-backdrop--visible`:``}`,onClick:t}),(0,f.jsxs)(`div`,{className:`erica-artifact-drawer ${i?`erica-artifact-drawer--open`:``}`,children:[(0,f.jsxs)(`div`,{className:`erica-artifact-header`,children:[(0,f.jsx)(`h2`,{className:`erica-artifact-title`,children:r}),(0,f.jsx)(`button`,{onClick:t,className:`erica-artifact-close-button`,"aria-label":`Close drawer`,children:(0,f.jsx)(Py,{className:`erica-icon-md`})})]}),(0,f.jsx)(`div`,{className:`erica-artifact-body`,children:n})]})]}):null}exports.ArtifactProvider=Sc,exports.EricaChat=Xy,exports.EricaDrawer=$y,exports.EricaProvider=Qy;
|
|
100
|
+
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(Sv.call(r,l)&&r[l]!==void 0&&r[l]!==null){let u=String(r[l]);if(l===`id`)c=t.preferShortcut!==!1&&wv.test(u)?`#`+u:i(`id`,u,e,n);else if(l===`class`){let r=u.split(/[\t\n\r ]+/g),a=[],c=[],l=-1;for(;++l<r.length;)(t.preferShortcut!==!1&&wv.test(r[l])?c:a).push(r[l]);o=a.length>0?i(`class`,a.join(` `),e,n):``,s=c.length>0?`.`+c.join(`.`):``}else a.push(i(l,u,e,n))}return o&&a.unshift(o),s&&a.unshift(s),c&&a.unshift(c),a.length>0?`{`+a.join(` `)+`}`:``}function i(e,n,r,i){if(t.collapseEmptyAttributes!==!1&&!n)return e;if(t.preferUnquoted&&Tv.test(n))return e+`=`+n;let a=t.quote||i.options.quote||`"`,o=a===`"`?`'`:`"`,s=t.quoteSmart&&nh(n,a)>nh(n,o)?o:a,c=r.type===`textDirective`?[s]:[s,`
|
|
101
|
+
`,`\r`];return e+`=`+s+xv(n,{subset:c})+s}}function Ov(e){jv.call(this,`containerDirective`,e)}function kv(e){jv.call(this,`leafDirective`,e)}function Av(e){jv.call(this,`textDirective`,e)}function jv(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function Mv(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function Nv(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function Pv(e){this.exit(e)}function Fv(){this.data.directiveAttributes=[],this.buffer()}function Iv(e){this.data.directiveAttributes.push([`id`,lv(this.sliceSerialize(e),{attribute:!0})])}function Lv(e){this.data.directiveAttributes.push([`class`,lv(this.sliceSerialize(e),{attribute:!0})])}function Rv(e){let t=this.data.directiveAttributes;t[t.length-1][1]=lv(this.sliceSerialize(e),{attribute:!0})}function zv(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Bv(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function Vv(e){this.exit(e)}function Hv(){return`:`}function Uv(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function Wv(e){let t=0;return e.type===`containerDirective`?(Zp(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function Gv(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&Z(t)?Q(e,v,`whitespace`)(t):!m&&X(t)?_d(e,v)(t):t===null||Y(t)||bu(t)||yu(t)&&t!==45&&t!==95?ne(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||X(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||X(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||Y(t)||bu(t)||yu(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Z(t)?Q(e,C,`whitespace`)(t):!m&&X(t)?_d(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&Y(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&Z(t)?Q(e,w,`whitespace`)(t):!m&&X(t)?_d(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||X(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function E(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),te):(e.enter(d),ee(t))}function ee(t){return t===g?(e.exit(d),E(t)):t===null?n(t):Y(t)?m?n(t):_d(e,ee)(t):(e.enter(p),e.consume(t),D)}function D(t){return t===g||t===null||Y(t)?(e.exit(p),ee(t)):(e.consume(t),D)}function te(e){return e===125||X(e)?v(e):ne(e)}function ne(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function Kv(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):Y(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function qv(e,t,n,r){let i=this;return a;function a(t){return t===null||Y(t)||yu(t)||bu(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Y(a)||bu(a)||yu(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var Jv={tokenize:Qv,concrete:!0},Yv={tokenize:$v,partial:!0},Xv={tokenize:ey,partial:!0},Zv={tokenize:ty,partial:!0};function Qv(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),qv.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(Yv,d,d)(t):d(t)}function d(t){return t===123?e.attempt(Xv,f,f)(t):f(t)}function f(t){return Q(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):Y(i)?r.interrupt?t(i):e.attempt(Zv,m,C)(i):n(i)}function m(t){return t===null?C(t):Y(t)?e.check(Zv,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?Q(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):Y(t)?e.check(Zv,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return Y(t)?e.check(Zv,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),Q(e,c,`whitespace`)(t))}function c(r){return r===null||Y(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function $v(e,t,n){return Kv(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function ey(e,t,n){return Gv(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function ty(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ny={tokenize:ay},ry={tokenize:oy,partial:!0},iy={tokenize:sy,partial:!0};function ay(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),qv.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(ry,s,s)(t):s(t)}function s(t){return t===123?e.attempt(iy,c,c)(t):c(t)}function c(t){return Q(e,l,`whitespace`)(t)}function l(r){return r===null||Y(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function oy(e,t,n){return Kv(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function sy(e,t,n){return Gv(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var cy={tokenize:fy,previous:dy},ly={tokenize:py,partial:!0},uy={tokenize:my,partial:!0};function dy(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function fy(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),qv.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(ly,o,o)(t):o(t)}function o(t){return t===123?e.attempt(uy,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function py(e,t,n){return Kv(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function my(e,t,n){return Gv(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function hy(){return{text:{58:cy},flow:{58:[Jv,ny]}}}function gy(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(hy()),n.push(Ev()),r.push(Dv())}function _y({markdown:e}){return(0,f.jsx)(`div`,{className:`report-artifact`,children:(0,f.jsx)(Zm,{remarkPlugins:[gy,()=>e=>{let t=e=>{let n=[`grid`,`column`].includes(e.name);[`containerDirective`,`leafDirective`,`textDirective`].includes(e.type)&&n&&(e.data=e.data||{},e.data.hName=e.name,e.data.hProperties=e.attributes||{}),e.children&&e.children.forEach(t)};t(e)},tv],components:{h1:({children:e})=>(0,f.jsx)(`h1`,{children:e}),h2:({children:e})=>(0,f.jsx)(`h2`,{children:e}),h3:({children:e})=>(0,f.jsx)(`h3`,{children:e}),p:({children:e})=>(0,f.jsx)(`p`,{children:e}),ul:({children:e})=>(0,f.jsx)(`ul`,{children:e}),ol:({children:e})=>(0,f.jsx)(`ol`,{children:e}),li:({children:e})=>(0,f.jsx)(`li`,{children:e}),a:({children:e,href:t})=>(0,f.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:e}),blockquote:({children:e})=>(0,f.jsx)(`blockquote`,{children:e}),hr:()=>(0,f.jsx)(`hr`,{}),table:({children:e})=>(0,f.jsx)(`div`,{className:`report-artifact-table-wrapper`,children:(0,f.jsx)(`table`,{children:e})}),thead:({children:e})=>(0,f.jsx)(`thead`,{children:e}),th:({children:e})=>(0,f.jsx)(`th`,{children:e}),td:({children:e})=>(0,f.jsx)(`td`,{children:e}),code:e=>{let{children:t,className:n,...r}=e;return/language-(\w+)/.exec(n||``)?.[1]===`ericachart`?(0,f.jsx)(Sc,{markdown:t}):(0,f.jsx)(`code`,{...r,className:n,children:t})},grid:({children:e,columns:t})=>(0,f.jsx)(`div`,{className:`report-grid report-grid--cols-${t?Number(t):2}`,children:e})},children:e})})}function vy({title:e,reportContent:t}){let n=Dc(),r=()=>{n.setTitle(e),n.setContent((0,f.jsx)(_y,{markdown:t})),n.onOpen()};return(0,f.jsx)(`div`,{onClick:r,className:`report-item-card`,children:(0,f.jsxs)(`div`,{className:`report-item-content`,children:[(0,f.jsx)(`div`,{className:`report-item-icon-wrapper`,children:(0,f.jsx)(`svg`,{className:`report-item-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})})}),(0,f.jsxs)(`div`,{className:`report-item-text-wrapper`,children:[(0,f.jsx)(`span`,{className:`report-item-title`,children:e}),(0,f.jsx)(`span`,{className:`report-item-subtitle`,children:`Business Report`})]}),(0,f.jsx)(`button`,{onClick:r,className:`report-item-button`,children:`Show Report`})]})})}function yy({path:e,title:t}){let n=e.split(`/`),r=n[5],i=n[6],{data:a,isLoading:o}=Lt({queryKey:[`artifact`,r,e],queryFn:()=>Js.get(r,i),enabled:!!r&&!!e});return o?(0,f.jsx)(`div`,{className:`report-loader-loading`,children:`loading report...`}):a?(0,f.jsx)(vy,{title:t,reportContent:a}):(0,f.jsx)(`div`,{className:`report-loader-no-data`,children:`No report data available`})}function by({message:e,datasetUuid:t,upsertKey:n,rows:r,previewRows:i,hiddenCount:a,onApprove:o,onReject:s}){let[c,l]=(0,u.useState)(!1),[d,p]=(0,u.useState)(``),m=()=>{c?s(d||void 0):l(!0)},h=i.length>0?Object.keys(i[0]):[];return(0,f.jsxs)(`div`,{className:`dataset-approval-card`,children:[(0,f.jsxs)(`div`,{className:`dataset-approval-header`,children:[(0,f.jsx)(`h3`,{className:`dataset-approval-title`,children:e}),t&&(0,f.jsxs)(`p`,{className:`dataset-approval-meta`,children:[`Dataset: `,(0,f.jsx)(`code`,{className:`dataset-approval-code`,children:t})]}),n&&n.length>0&&(0,f.jsxs)(`p`,{className:`dataset-approval-meta`,children:[`Upsert Key: `,(0,f.jsx)(`code`,{className:`dataset-approval-code`,children:n.join(`, `)})]})]}),i.length>0&&(0,f.jsxs)(`div`,{className:`dataset-approval-table-wrapper`,children:[(0,f.jsxs)(`table`,{className:`dataset-approval-table`,children:[(0,f.jsx)(`thead`,{className:`dataset-approval-thead`,children:(0,f.jsx)(`tr`,{children:h.map(e=>(0,f.jsx)(`th`,{className:`dataset-approval-th`,children:e},e))})}),(0,f.jsx)(`tbody`,{children:i.map((e,t)=>(0,f.jsx)(`tr`,{className:`dataset-approval-tr`,children:h.map(t=>(0,f.jsx)(`td`,{className:`dataset-approval-td`,children:String(e[t]??``)},t))},t))})]}),a>0&&(0,f.jsxs)(`p`,{className:`dataset-approval-hidden-count`,children:[`... and `,a,` more row`,a===1?``:`s`]})]}),(0,f.jsxs)(`div`,{className:`dataset-approval-total`,children:[`Total rows: `,r.length]}),c&&(0,f.jsxs)(`div`,{className:`dataset-approval-reject-section`,children:[(0,f.jsx)(`label`,{className:`dataset-approval-reject-label`,children:`Rejection reason (optional):`}),(0,f.jsx)(`input`,{type:`text`,value:d,onChange:e=>p(e.target.value),className:`dataset-approval-reject-input`,placeholder:`Enter reason...`})]}),(0,f.jsxs)(`div`,{className:`dataset-approval-buttons`,children:[(0,f.jsx)(`button`,{onClick:o,className:`dataset-approval-btn dataset-approval-btn-approve`,children:`Approve`}),(0,f.jsx)(`button`,{onClick:m,className:`dataset-approval-btn dataset-approval-btn-reject`,children:c?`Confirm Reject`:`Reject`}),c&&(0,f.jsx)(`button`,{onClick:()=>{l(!1),p(``)},className:`dataset-approval-btn-cancel`,children:`Cancel`})]})]})}function xy({name:e}){let t=(0,u.useContext)(Zt);return(0,u.useEffect)(()=>{t&&t.setStep(e)},[e,t]),null}function Sy(){return(0,d.useRenderTool)({name:`showChart`,parameters:Ks,render:({parameters:e})=>e.compiled_chart?.path?(0,f.jsx)(wc,{path:e.compiled_chart.path}):(0,f.jsx)(`div`,{children:`No chart path provided`})},[]),(0,d.useRenderTool)({name:`showReport`,parameters:qs,render:({parameters:e})=>e.compiled_report?.path?(0,f.jsx)(yy,{path:e.compiled_report.path,title:e.compiled_report.title}):(0,f.jsx)(`div`,{children:`No report path provided`})},[]),(0,d.useDefaultRenderTool)({render:({name:e})=>(0,f.jsx)(xy,{name:e})},[]),(0,d.useInterrupt)({render:({event:e,resolve:t})=>{let n={};try{n=typeof e.value==`string`?JSON.parse(e.value):e.value}catch{}if(n?.type===`write_to_dataset`){let{message:e,action:r}=n,i=r?.rows??[],a=i.slice(0,3),o=i.length-a.length;return(0,f.jsx)(by,{message:e??`Approve this action?`,datasetUuid:r?.dataset_uuid,upsertKey:r?.upsert_key,rows:i,previewRows:a,hiddenCount:o,onApprove:()=>t({approved:!0}),onReject:e=>t({approved:!1,...e?{reason:e}:{}})})}return(0,f.jsx)(`div`,{className:`tools-interrupt-fallback`,children:(0,f.jsx)(`p`,{children:typeof e.value==`string`?e.value:JSON.stringify(e.value)})})}}),null}var Cy=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/[_-]/g,` `).toLowerCase().trim().replace(/\s+/g,` `);function wy(){let e=(0,u.useContext)(Zt),t=`digesting`;return e?.step&&(t=e.step===`ls`?`listing files`:Cy(e.step)),(0,f.jsxs)(`div`,{className:`chat-message-spinner-container`,children:[(0,f.jsx)(`div`,{className:`chat-message-spinner-icon`}),(0,f.jsxs)(`div`,{className:`chat-message-spinner-text`,children:[t,(0,f.jsxs)(`span`,{className:`chat-message-spinner-dots`,children:[(0,f.jsx)(`span`,{className:`chat-message-spinner-dot chat-message-spinner-dot--1`,children:`.`}),(0,f.jsx)(`span`,{className:`chat-message-spinner-dot chat-message-spinner-dot--2`,children:`.`}),(0,f.jsx)(`span`,{className:`chat-message-spinner-dot chat-message-spinner-dot--3`,children:`.`})]})]})]})}function Ty({message:e}){return(0,f.jsxs)(`div`,{className:`loading-message-container`,children:[(0,f.jsx)(`div`,{className:`loading-message-spinner`}),(0,f.jsxs)(`div`,{className:`loading-message-text`,children:[e,(0,f.jsxs)(`span`,{className:`loading-message-dots`,children:[(0,f.jsx)(`span`,{className:`loading-message-dot loading-message-dot--1`,children:`.`}),(0,f.jsx)(`span`,{className:`loading-message-dot loading-message-dot--2`,children:`.`}),(0,f.jsx)(`span`,{className:`loading-message-dot loading-message-dot--3`,children:`.`})]})]})]})}var Ey=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Dy=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Oy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ky=e=>{let t=Oy(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ay={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},jy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},My=(0,u.createContext)({}),Ny=()=>(0,u.useContext)(My),Py=(0,u.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=Ny()??{},h=r??f?Number(n??d)*24/Number(t??l):n??d;return(0,u.createElement)(`svg`,{ref:c,...Ay,width:t??l??Ay.width,height:t??l??Ay.height,stroke:e??p,strokeWidth:h,className:Ey(`lucide`,m,i),...!a&&!jy(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,u.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Fy=(e,t)=>{let n=(0,u.forwardRef)(({className:n,...r},i)=>(0,u.createElement)(Py,{ref:i,iconNode:t,className:Ey(`lucide-${Dy(ky(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ky(e),n},Iy=Fy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ly=Fy(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Ry=Fy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function zy(e){if(!e)return``;let t=e.split(`:`);return(t.length>1?t.slice(1).join(` `):e).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function By(e){if(!e)return``;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:i<7?`${i}d ago`:new Date(e).toLocaleDateString()}function Vy({onNewChat:e,onThreadSelect:t}){let[n,r]=(0,u.useState)(!1),i=(0,u.useRef)(null),a=(0,d.useCopilotChatConfiguration)(),{data:o=[],isLoading:s}=Jt();(0,u.useEffect)(()=>{function e(e){i.current&&!i.current.contains(e.target)&&r(!1)}if(n)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[n]);function c(e){r(!1),t?.(e)}return(0,f.jsxs)(`div`,{className:`erica-header`,children:[(0,f.jsxs)(`h2`,{className:`erica-header-title`,children:[`SPP AI `,(0,f.jsx)(`span`,{className:`erica-header-version`,children:`v1.1.6`})]}),(0,f.jsxs)(`div`,{className:`erica-header-controls`,ref:i,children:[(0,f.jsx)(`button`,{onClick:e,className:`erica-new-chat-button`,title:`Start new chat`,children:(0,f.jsx)(Ly,{className:`erica-icon-sm`})}),(0,f.jsxs)(`button`,{onClick:()=>r(!n),className:`erica-threads-toggle`,title:`Recent threads`,children:[(0,f.jsxs)(`span`,{className:`erica-threads-toggle-text`,children:[`Riwayat `,o.length>0&&`(${o.length})`]}),(0,f.jsx)(Iy,{className:`erica-threads-toggle-icon ${n?`erica-threads-toggle-icon--open`:``}`})]}),a?.setModalOpen&&(0,f.jsx)(`button`,{onClick:()=>a.setModalOpen(!1),className:`erica-close-button`,title:`Close sidebar`,children:(0,f.jsx)(Ry,{className:`erica-icon-sm`})}),n&&(0,f.jsx)(`div`,{className:`erica-threads-dropdown`,children:(0,f.jsxs)(`div`,{className:`erica-threads-dropdown-content`,children:[(0,f.jsx)(`div`,{className:`erica-threads-dropdown-header`,children:`Riwayat Terakhir`}),s&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`Loading threads...`}),!s&&o.length===0&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`No conversations yet`}),!s&&o.map(e=>{let t=zy(e.agent),n=By(e.last_run_at??e.created_at);return(0,f.jsx)(`button`,{onClick:()=>c(e.uid),className:`erica-thread-item`,children:(0,f.jsxs)(`div`,{className:`erica-thread-item-content`,children:[(0,f.jsx)(`span`,{className:`erica-thread-title`,children:typeof e.thread_metadata?.title==`string`?e.thread_metadata.title:e.last_message??`New conversation`}),(0,f.jsxs)(`div`,{className:`erica-thread-meta`,children:[t&&(0,f.jsx)(`span`,{className:`erica-thread-agent`,children:t}),n&&(0,f.jsx)(`span`,{className:`erica-thread-time`,children:n})]})]})},e.uid)})]})})]})]})}var Hy=(0,u.createContext)(void 0);function Uy({accountUid:e,children:t}){return(0,f.jsx)(Hy.Provider,{value:{accountUid:e},children:t})}function Wy(){let e=(0,u.useContext)(Hy);if(!e)throw Error(`useAccount must be used within AccountProvider`);return e}var Gy={upload:async(e,t,n)=>{let{data:r}=await Bt({body:{file:e,prefix:t,ocr:n},throwOnError:!0});return r.data},download:async(e,t)=>{let n=e.split(`/`),r=n[n.length-1],i=n.slice(-3,-1).join(`/`),{data:a}=await Vt({path:{filename:r},query:i?{prefix:i}:{},parseAs:`blob`,throwOnError:!0}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}};function Ky({attachment:e}){let{accountUid:t}=Wy(),[n,r]=(0,u.useState)(!1);async function i(){r(!0);try{await Gy.download(t,e.file_path,e.original_name)}finally{r(!1)}}return(0,f.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},title:e.original_name,className:`attachment-item`,children:[n?(0,f.jsx)(`div`,{className:`attachment-item-spinner`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`svg`,{className:`attachment-item-icon`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13`})}),(0,f.jsx)(`svg`,{className:`attachment-item-icon-download`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,f.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})})]}),(0,f.jsx)(`span`,{className:`attachment-item-text`,children:e.original_name})]})}function qy({children:e}){let t=String(e).trim(),n=[];try{n=JSON.parse(t)}catch{return null}return n.length===0?null:(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1.5 py-1`,children:n.map((e,t)=>(0,f.jsx)(Ky,{attachment:e},t))})}function Jy({message:e=`Hai! Saya SPP AI, siap membantu Anda!`,isOpen:t=!1,initialDelay:n=1e4}){let[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{let e=setTimeout(()=>{i(!0)},n);return()=>clearTimeout(e)},[n]),!r||t||a?null:(0,f.jsx)(`div`,{className:`chat-toggle-greeting-wrapper`,children:(0,f.jsxs)(`div`,{className:`chat-toggle-greeting-bubble`,children:[e,(0,f.jsx)(`button`,{onClick:()=>{i(!1),o(!0)},className:`chat-toggle-greeting-close`,"aria-label":`Dismiss greeting`,children:(0,f.jsx)(Ry,{})})]})})}function Yy(e){ih(e,[/\r?\n|\r/g,Xy])}function Xy(){return{type:`break`}}function Zy(){return function(e){Yy(e)}}var Qy=()=>e=>{let t=e=>{[`containerDirective`,`leafDirective`,`textDirective`].includes(e.type)&&e.name===`tool_call_content`&&(e.data=e.data||{},e.data.hName=e.name,e.data.hProperties=e.attributes||{},e.children=[]),e.children&&e.children.forEach(t)};t(e)},$y=()=>e=>{let t=e=>{e.type===`textDirective`&&e.name===`resource`&&(e.data=e.data||{},e.data.hName=`resource`,e.data.hProperties=e.attributes||{}),e.children&&e.children.forEach(t)};t(e)};function eb({runtimeUrl:e,widgetToken:t}){let[n,r]=(0,u.useState)(void 0),[i,a]=(0,u.useState)(!0),[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(0),[p,m]=(0,u.useState)(!0),[h,g]=(0,u.useState)(!1),_=(0,u.useMemo)(()=>{let t=new URL(e),n=t.pathname.split(`/`).filter(Boolean);return n.length>2&&n.pop(),t.pathname=`/`+n.join(`/`),t.toString()},[e]);(0,u.useMemo)(()=>{he(_,t)},[_,t]);let{data:v,isLoading:y}=Yt(i,c),{isLoading:b,isSuccess:x}=Xt(n||``,o);(0,u.useEffect)(()=>{x&&p&&h&&g(!0)},[x,p,h]),(0,u.useEffect)(()=>{v&&(r(v),a(!1),s(!0),m(!0))},[v]),(0,u.useEffect)(()=>()=>{n&&p&&Kt.deleteSandbox(n).catch(()=>{})},[n,p]);let S=(0,u.useCallback)(()=>{r(void 0),a(!0),s(!1),l(e=>e+1),m(!0),g(!0)},[]),C=(0,u.useCallback)(e=>{r(e),a(!1),s(!1),m(!1),g(!0)},[]);function w({threadId:e,isLoadingThreadId:t,isLoadingSandbox:n,isSandboxReady:r,isNewThread:i,handleNewChat:a,handleThreadSelect:o}){let s=`Halo! Saya asisten AI SPP, ada yg bisa saya bantu?`;t?s=(0,f.jsx)(Ty,{message:`Initializing conversation`}):i&&n?s=(0,f.jsx)(Ty,{message:`Preparing workspace`}):i&&!r&&(s=(0,f.jsx)(Ty,{message:`Setting up environment`}));let c=(0,u.useCallback)(()=>(0,f.jsx)(Vy,{onNewChat:a,onThreadSelect:o}),[a,o]);return(0,f.jsxs)(`div`,{className:`erica-chat-container`,children:[(0,f.jsx)(Sy,{}),(0,f.jsx)(Jy,{message:`Hai! Saya SPP AI, siap membantu Anda!`,isOpen:h,initialDelay:1e4}),(0,f.jsx)(d.CopilotSidebar,{welcomeScreen:!0,header:c,labels:{chatInputPlaceholder:`Ketik pertanyaan Anda di sini...`,welcomeMessageText:s,chatDisclaimerText:`AI dapat membuat kesalahan. Harap verifikasi informasi penting.`},threadId:e,messageView:{cursor:wy,userMessage:{messageRenderer:({content:e,className:t})=>(0,f.jsx)(`div`,{className:[`cpk:prose cpk:dark:prose-invert cpk:bg-smi cpk:relative cpk:max-w-[80%] cpk:rounded-[18px] cpk:px-4 cpk:py-1.5 cpk:data-[multiline]:py-3 cpk:inline-block`,t].filter(Boolean).join(` `),children:(0,f.jsx)(Zm,{remarkPlugins:[Zy,tv,gy,$y],components:{pre:({children:e})=>(0,f.jsx)(f.Fragment,{children:e}),code({children:e,className:t}){return/language-(\w+)/.exec(t||``)?.[1]===`attachments`?(0,f.jsx)(qy,{children:e}):(0,f.jsx)(`code`,{className:t,style:{fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:`0.85em`},children:e})},resource:({children:e})=>(0,f.jsxs)(`span`,{className:`erica-resource-tag`,children:[`@`,e]})},children:e})})},assistantMessage:{className:`prose lg:prose-xl`,toolbarVisible:!1,markdownRenderer:({content:e})=>!e||e.trim()===``?(0,f.jsx)(f.Fragment,{}):(0,f.jsx)(Zm,{remarkPlugins:[Zy,tv,gy,Qy],components:{tool_call_content:({children:e,...t})=>(0,f.jsx)(`div`,{className:`tool-call-content`,...t,children:e})},children:e})}},defaultOpen:h})]})}return(0,f.jsx)(d.CopilotChatConfigurationProvider,{children:(0,f.jsx)(Qt,{threadId:n,children:(0,f.jsx)(d.CopilotKit,{runtimeUrl:e,headers:{Authorization:`Bearer ${t}`},properties:{agent:`account:agent_demo_smi`},threadId:n,enableInspector:!1,children:(0,f.jsx)(w,{threadId:n,isLoadingThreadId:y,isLoadingSandbox:b,isSandboxReady:x,isNewThread:p,handleNewChat:S,handleThreadSelect:C})})})})}var tb=new bt({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});function nb({accountUid:e,children:t}){return(0,f.jsx)(Ct,{client:tb,children:(0,f.jsx)(Uy,{accountUid:e,children:(0,f.jsx)(Ec,{children:t})})})}function rb(){let{isOpen:e,onClose:t,content:n,title:r}=Dc(),[i,a]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{e?setTimeout(()=>a(!0),10):a(!1)},[e]),e?(0,f.jsxs)(`div`,{className:`erica-artifact-container`,children:[(0,f.jsx)(`div`,{className:`erica-artifact-backdrop ${i?`erica-artifact-backdrop--visible`:``}`,onClick:t}),(0,f.jsxs)(`div`,{className:`erica-artifact-drawer ${i?`erica-artifact-drawer--open`:``}`,children:[(0,f.jsxs)(`div`,{className:`erica-artifact-header`,children:[(0,f.jsx)(`h2`,{className:`erica-artifact-title`,children:r}),(0,f.jsx)(`button`,{onClick:t,className:`erica-artifact-close-button`,"aria-label":`Close drawer`,children:(0,f.jsx)(Ry,{className:`erica-icon-md`})})]}),(0,f.jsx)(`div`,{className:`erica-artifact-body`,children:n})]})]}):null}exports.ArtifactProvider=Ec,exports.EricaChat=eb,exports.EricaDrawer=rb,exports.EricaProvider=nb;
|
|
77
102
|
//# sourceMappingURL=index.cjs.map
|