@rekayasa/erica-bubble 1.2.3 → 1.2.5

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 CHANGED
@@ -3,9 +3,9 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
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 y=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},b=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},x=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},S=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(b(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=y(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):C({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},C=({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)}`},w=({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=x(r),s=Object.entries(i).map(([t,i])=>C({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},T=/\{[^{}]+\}/g,E=({path:e,url:t})=>{let n=t,r=t.match(T);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,S({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,w({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${C({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},ee=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=E({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function D(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 te=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},ne=({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=S({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=w({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=C({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join(`&`)},re=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`}},ie=(e,t)=>t?!!(e.headers.has(t)||e.query?.[t]||e.headers.get(`Cookie`)?.includes(`${t}=`)):!1,ae=async({security:e,...t})=>{for(let n of e){if(ie(t,n.name))continue;let e=await te(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}}},oe=e=>ee({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer==`function`?e.querySerializer:ne(e.querySerializer),url:e.url}),se=(e,t)=>{let n={...e,...t};return n.baseUrl?.endsWith(`/`)&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=le(e.headers,t.headers),n},ce=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},le=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?ce(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},ue=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}},de=()=>({error:new ue,request:new ue,response:new ue}),fe=ne({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),pe={"Content-Type":`application/json`},me=(e={})=>({..._,headers:pe,parseAs:`auto`,querySerializer:fe,...e}),he=((e={})=>{let t=se(me(),e),n=()=>({...t}),r=e=>(t=se(t,e),n()),i=de(),a=async e=>{let n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:le(t.headers,e.headers),serializedBody:void 0};n.security&&await ae({...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:oe(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:D(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`?re(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 v({...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:D(n),url:r})};return{buildUrl:e=>oe({...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`)}})(me({baseUrl:`http://localhost:9000/api/widget`}));function ge(e,t){he.setConfig({baseUrl:e,headers:t?{Authorization:`Bearer ${t}`}:void 0})}var _e=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(){}},ve=new class extends _e{#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`}},ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},be=new class{#e=ye;#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 xe(e){setTimeout(e,0)}var Se=typeof window>`u`||`Deno`in globalThis;function O(){}function Ce(e,t){return typeof e==`function`?e(t):e}function we(e){return typeof e==`number`&&e>=0&&e!==1/0}function Te(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ee(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function De(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ke(o,t.options))return!1}else if(!je(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 Oe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ae(t.options.mutationKey)!==Ae(a))return!1}else if(!je(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ke(e,t){return(t?.queryKeyHashFn||Ae)(e)}function Ae(e){return JSON.stringify(e,(e,t)=>Ie(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function je(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>je(e[n],t[n])):!1}var Me=Object.prototype.hasOwnProperty;function Ne(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Fe(e)&&Fe(t);if(!r&&!(Ie(e)&&Ie(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:Me.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ne(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Pe(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 Fe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ie(e){if(!Le(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Le(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Le(e){return Object.prototype.toString.call(e)===`[object Object]`}function Re(e){return new Promise(t=>{be.setTimeout(t,e)})}function ze(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 Ne(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 Ne(e,t)}return t}function Be(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Ve(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var He=Symbol();function Ue(e,t){return process.env.NODE_ENV!==`production`&&e.queryFn===He&&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===He?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function We(e,t){return typeof e==`function`?e(...t):!!e}function Ge(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 Ke=(()=>{let e=()=>Se;return{isServer(){return e()},setIsServer(t){e=t}}})();function qe(){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 Je=xe;function Ye(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Je,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=Ye(),Xe=new class extends _e{#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 Ze(e){return Math.min(1e3*2**e,3e4)}function Qe(e){return(e??`online`)===`online`?Xe.isOnline():!0}var $e=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function et(e){let t=!1,n=0,r,i=qe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new $e(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ve.isFocused()&&(e.networkMode===`always`||Xe.isOnline())&&e.canRun(),u=()=>Qe(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??(Ke.isServer()?0:3),o=e.retryDelay??Ze,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),Re(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 tt=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),we(this.gcTime)&&(this.#e=be.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ke.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(be.clearTimeout(this.#e),this.#e=void 0)}},nt=class extends tt{#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=at(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=at(this.options);e.data!==void 0&&(this.setState(it(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=ze(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===He||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ee(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:!Te(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=Ue(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=et({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof $e&&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 $e){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,...rt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...it(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 rt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function it(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function at(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 ot=class extends _e{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=qe(),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),ct(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lt(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&&!Pe(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ut(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)||Ee(this.options.staleTime,this.#t)!==Ee(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 ft(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=Ee(this.options.staleTime,this.#t);if(Ke.isServer()||this.#r.isStale||!we(e))return;let t=Te(this.#r.dataUpdatedAt,e)+1;this.#d=be.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,!(Ke.isServer()||k(this.options.enabled,this.#t)===!1||!we(this.#p)||this.#p===0)&&(this.#f=be.setInterval(()=>{(this.options.refetchIntervalInBackground||ve.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(be.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(be.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&&ct(e,t),o=i&&ut(e,n,t,r);(a||o)&&(l={...l,...rt(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=ze(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=ze(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:dt(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=qe())},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),!Pe(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 st(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function ct(e,t){return st(e,t)||e.state.data!==void 0&&lt(e,t,t.refetchOnMount)}function lt(e,t,n){if(k(t.enabled,e)!==!1&&Ee(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&dt(e,t)}return!1}function ut(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&dt(e,n)}function dt(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(Ee(t.staleTime,e))}function ft(e,t){return!Pe(e.getCurrentResult(),t)}function pt(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=>{Ge(e,()=>t.signal,()=>n=!0)},u=Ue(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?Ve:Be;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?ht:mt,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:mt(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 mt(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 ht(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var gt=class extends tt{#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||_t(),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=et({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 _t(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var vt=class extends _e{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 gt({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=yt(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=yt(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=yt(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=yt(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=>Oe(t,e))}findAll(e={}){return this.getAll().filter(t=>Oe(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 yt(e){return e.options.scope?.id}var bt=class extends _e{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ke(r,t),a=this.get(i);return a||(a=new nt({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=>De(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>De(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()})})}},xt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new bt,this.#t=e.mutationCache||new vt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ve.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Xe.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(Ee(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=Ce(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(Ee(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=pt(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e.behavior=pt(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Xe.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(Ae(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{je(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ae(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{je(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||=ke(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===He&&(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()}},St=u.createContext(void 0),Ct=e=>{let t=u.useContext(St);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},wt=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,f.jsx)(St.Provider,{value:e,children:t})),Tt=u.createContext(!1),Et=()=>u.useContext(Tt);Tt.Provider;function Dt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ot=u.createContext(Dt()),kt=()=>u.useContext(Ot),At=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?We(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},jt=e=>{u.useEffect(()=>{e.clearReset()},[e])},Mt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||We(n,[e.error,r])),Nt=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))}},Pt=(e,t)=>e.isLoading&&e.isFetching&&!t,Ft=(e,t)=>e?.suspense&&t.isPending,It=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Lt(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=Et(),i=kt(),a=Ct(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`,Nt(o),At(o,i,s),jt(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]),Ft(o,d))throw It(o,l,i);if(Mt({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&&!Ke.isServer()&&Pt(d,r)&&(c?It(o,l,i):s?.promise)?.catch(O).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}function Rt(e,t){return Lt(e,ot,t)}var zt=e=>(e?.client??he).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads`,...e}),Bt=e=>(e.client??he).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/{threadUid}`,...e}),Vt=e=>(e.client??he).post({...g,security:[{scheme:`bearer`,type:`http`}],url:`/attachments/upload`,...e,headers:{"Content-Type":null,...e.headers}}),Ht=e=>(e.client??he).get({security:[{scheme:`bearer`,type:`http`}],url:`/attachments/{filename}`,...e}),Ut=e=>(e?.client??he).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/unique-thread-id`,...e}),Wt=e=>(e.client??he).post({security:[{scheme:`bearer`,type:`http`}],url:`/chat/sandbox`,...e,headers:{"Content-Type":`application/json`,...e.headers}}),Gt=e=>(e.client??he).delete({security:[{scheme:`bearer`,type:`http`}],url:`/chat/sandbox/{threadId}`,...e}),Kt=e=>(e.client??he).get({security:[{scheme:`bearer`,type:`http`}],url:`/artifacts/{threadId}/{filename}`,...e}),qt={list:async(e=15)=>{let{data:t}=await zt({query:{page:1,page_size:e},throwOnError:!0});return t.data??[]},get:async e=>{let{data:t}=await Bt({path:{threadUid:e},throwOnError:!0});return t.data},getUniqueThreadId:async()=>{let{data:e}=await Ut({throwOnError:!0});return e.data.thread_id},createSandbox:async e=>{let{data:t}=await Wt({body:{thread_id:e},throwOnError:!0});return t.data},deleteSandbox:async e=>{let{data:t}=await Gt({path:{threadId:e},throwOnError:!1});return t}},Jt={all:()=>[`widget-threads`],detail:e=>[`widget-threads`,e],uniqueId:e=>[`widget-threads`,`unique-id`,e],sandbox:e=>[`widget-threads`,`sandbox`,e]},Yt=(e=15)=>Rt({queryKey:Jt.all(),queryFn:()=>qt.list(e),staleTime:15e3,refetchOnWindowFocus:!0}),Xt=(e=!0,t)=>Rt({queryKey:Jt.uniqueId(t),queryFn:()=>qt.getUniqueThreadId(),enabled:e,staleTime:0,gcTime:0}),Zt=(e,t=!0)=>Rt({queryKey:Jt.sandbox(e),queryFn:()=>qt.createSandbox(e),enabled:!!e&&t,staleTime:0,gcTime:0,retry:3,retryDelay:1e3}),Qt=`account:procurement_assistant`,$t={upload:async(e,t,n)=>{let{data:r}=await Vt({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 Ht({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)}},en=(0,u.createContext)(null);function tn(e){if(!e)return e;let t=e.indexOf(`attachments/threads/`);return t===-1?e:`/${e.substring(t)}`}function nn({threadId:e,agentIdentifier:t=Qt,children:n}){let{agent:r}=(0,d.useAgent)(),{copilotkit:i}=(0,d.useCopilotKit)(),[a,o]=(0,u.useState)(void 0),[s,c]=(0,u.useState)([]),[l,p]=(0,u.useState)(``);(0,u.useEffect)(()=>{r.isRunning||o(void 0)},[r.isRunning]);async function m(t){if(!e)return;let n=`${t.name}-${Date.now()}-${Math.random().toString(36).slice(2)}`;c(e=>[...e,{id:n,name:t.name,mimeType:t.type||`application/octet-stream`,status:`uploading`}]);try{let r=await $t.upload(t,`threads/${e}`,!0);c(e=>e.map(e=>e.id===n?{...e,status:`done`,response:r}:e))}catch(e){let t=e instanceof Error?e.message:`Upload failed`;c(e=>e.map(e=>e.id===n?{...e,status:`error`,errorMessage:t}:e))}}function h(t){if(!e)return;let n=new Set(s.map(e=>e.name));t.filter(e=>!n.has(e.name)).forEach(m)}function g(e){c(t=>t.filter(t=>t.id!==e))}async function _(e){let n=e.trim(),a=s.filter(e=>e.status===`done`&&e.response).map(e=>{let t=e.response,n=t.ocr_result;return{file_path:tn(t.file_path),original_name:t.original_name??e.name,ocr_result:n?.markdown_files?.map(e=>({page_number:e.page_number,full_markdown:tn(e.full_markdown),simple_markdown:tn(e.simple_markdown),annotated_markdown:tn(e.annotated_markdown)}))}});if(!n&&a.length===0)return;let o=[{type:`text`,text:e}];a.length>0&&o.push({type:`text`,text:`\n\`\`\`attachments\n${JSON.stringify(a,null,2)}\n\`\`\``}),r.addMessage({id:crypto.randomUUID(),role:`user`,content:o}),p(``),c([]),await i.runAgent({agent:r,forwardedProps:{agent:t}})}return(0,f.jsx)(en.Provider,{value:{step:a,setStep:o,threadId:e,attachedFiles:s,addFiles:h,removeFile:g,inputValue:l,setInputValue:p,handleSubmit:_},children:n})}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 rn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},an=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},on={};function sn(e){return e&&Object.assign(on,e),on}function cn(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 ln(e,t){return typeof t==`bigint`?t.toString():t}function un(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function dn(e){return e==null}function fn(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var pn=Symbol(`evaluating`);function M(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pn)return r===void 0&&(r=pn,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function mn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function hn(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function gn(e){return JSON.stringify(e)}function _n(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var vn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function yn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var bn=un(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function xn(e){if(yn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(yn(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Sn(e){return xn(e)?{...e}:Array.isArray(e)?[...e]:e}var Cn=new Set([`string`,`number`,`symbol`]);function wn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Tn(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 En(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Dn(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 Tn(e,hn(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 mn(this,`shape`,e),e},checks:[]}))}function On(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 Tn(e,hn(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 mn(this,`shape`,r),r},checks:[]}))}function kn(e,t){if(!xn(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 Tn(e,hn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return mn(this,`shape`,n),n}}))}function An(e,t){if(!xn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Tn(e,hn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return mn(this,`shape`,n),n}}))}function jn(e,t){return Tn(e,hn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return mn(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Mn(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 Tn(t,hn(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 mn(this,`shape`,i),i},checks:[]}))}function Nn(e,t,n){return Tn(t,hn(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 mn(this,`shape`,i),i}}))}function Pn(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 Fn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function In(e){return typeof e==`string`?e:e?.message}function Ln(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=In(e.inst?._zod.def?.error?.(e))??In(t?.error?.(e))??In(n.customError?.(e))??In(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Rn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function zn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Bn=(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,ln,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Vn=j(`$ZodError`,Bn),Hn=j(`$ZodError`,Bn,{Parent:Error});function Un(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 Wn(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 Gn=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 rn;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Ln(e,a,sn())));throw vn(t,i?.callee),t}return o.value},Kn=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=>Ln(e,a,sn())));throw vn(t,i?.callee),t}return o.value},qn=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 rn;return a.issues.length?{success:!1,error:new(e??Vn)(a.issues.map(e=>Ln(e,i,sn())))}:{success:!0,data:a.value}},Jn=qn(Hn),Yn=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=>Ln(e,i,sn())))}:{success:!0,data:a.value}},Xn=Yn(Hn),Zn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Gn(e)(t,n,i)},Qn=e=>(t,n,r)=>Gn(e)(t,n,r),$n=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Kn(e)(t,n,i)},er=e=>async(t,n,r)=>Kn(e)(t,n,r),tr=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return qn(e)(t,n,i)},nr=e=>(t,n,r)=>qn(e)(t,n,r),rr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Yn(e)(t,n,i)},ir=e=>async(t,n,r)=>Yn(e)(t,n,r),ar=/^[cC][^\s-]{8,}$/,or=/^[0-9a-z]+$/,sr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,cr=/^[0-9a-vA-V]{20}$/,lr=/^[A-Za-z0-9]{27}$/,ur=/^[a-zA-Z0-9_-]{21}$/,dr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fr=/^([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})$/,pr=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)$/,mr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hr=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function gr(){return new RegExp(hr,`u`)}var _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])$/,vr=/^(([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}|:))$/,yr=/^((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])$/,br=/^(([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])$/,xr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sr=/^[A-Za-z0-9_-]*$/,Cr=/^\+[1-9]\d{6,14}$/,wr=`(?:(?:\\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])))`,Tr=RegExp(`^${wr}$`);function Er(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 Dr(e){return RegExp(`^${Er(e)}$`)}function Or(e){let t=Er({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(`^${wr}T(?:${r})$`)}var kr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ar=/^[^A-Z]*$/,jr=/^[^a-z]*$/,Mr=j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Nr=j(`$ZodCheckMaxLength`,(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!dn(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=Rn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pr=j(`$ZodCheckMinLength`,(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!dn(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=Rn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Fr=j(`$ZodCheckLengthEquals`,(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!dn(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=Rn(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})}}),Ir=j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Mr.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=()=>{})}),Lr=j(`$ZodCheckRegex`,(e,t)=>{Ir.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})}}),Rr=j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ar,Ir.init(e,t)}),zr=j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=jr,Ir.init(e,t)}),Br=j(`$ZodCheckIncludes`,(e,t)=>{Mr.init(e,t);let n=wn(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})}}),Vr=j(`$ZodCheckStartsWith`,(e,t)=>{Mr.init(e,t);let n=RegExp(`^${wn(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})}}),Hr=j(`$ZodCheckEndsWith`,(e,t)=>{Mr.init(e,t);let n=RegExp(`.*${wn(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})}}),Ur=j(`$ZodCheckOverwrite`,(e,t)=>{Mr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Wr=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 y=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},b=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},x=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},S=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(b(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=y(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):C({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},C=({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)}`},w=({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=x(r),s=Object.entries(i).map(([t,i])=>C({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},T=/\{[^{}]+\}/g,E=({path:e,url:t})=>{let n=t,r=t.match(T);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,S({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,w({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${C({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},D=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=E({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function O(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 ee=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=S({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=w({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=C({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 ee(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=>D({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={})=>({..._,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:O(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 v({...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:O(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 k(){}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 A(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 j=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(k).catch(k):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=>A(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),j.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 A(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&&lt(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||A(this.options.enabled,this.#t)!==A(t.enabled,this.#t)||Te(this.options.staleTime,this.#t)!==Te(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||A(this.options.enabled,this.#t)!==A(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(k)),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()||A(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&&lt(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:A(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){j.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ot(e,t){return A(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(A(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||A(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ut(e,n)}function ut(e,t){return A(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),j.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(){j.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){j.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return j.batch(()=>Promise.all(e.map(e=>e.continue().catch(k))))}};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(){j.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){j.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){j.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){j.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 j.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;j.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return j.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=j.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(k).catch(k)}invalidateQueries(e,t={}){return j.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=j.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(k)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(k)}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(k).catch(k)}fetchInfiniteQuery(e){return e.behavior=ft(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(k).catch(k)}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(j.batchCalls(e)):k;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(k).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({...g,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=`account:procurement_assistant`,Qt={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)}},$t=(0,u.createContext)(null);function en(e){if(!e)return e;let t=e.indexOf(`attachments/threads/`);return t===-1?e:`/${e.substring(t)}`}function tn({threadId:e,agentIdentifier:t=Zt,children:n}){let{agent:r}=(0,d.useAgent)(),{copilotkit:i}=(0,d.useCopilotKit)(),[a,o]=(0,u.useState)(void 0),[s,c]=(0,u.useState)([]),[l,p]=(0,u.useState)(``);(0,u.useEffect)(()=>{r.isRunning||o(void 0)},[r.isRunning]);async function m(t){if(!e)return;let n=`${t.name}-${Date.now()}-${Math.random().toString(36).slice(2)}`;c(e=>[...e,{id:n,name:t.name,mimeType:t.type||`application/octet-stream`,status:`uploading`}]);try{let r=await Qt.upload(t,`threads/${e}`,!0);c(e=>e.map(e=>e.id===n?{...e,status:`done`,response:r}:e))}catch(e){let t=e instanceof Error?e.message:`Upload failed`;c(e=>e.map(e=>e.id===n?{...e,status:`error`,errorMessage:t}:e))}}function h(t){if(!e)return;let n=new Set(s.map(e=>e.name));t.filter(e=>!n.has(e.name)).forEach(m)}function g(e){c(t=>t.filter(t=>t.id!==e))}async function _(e){let n=e.trim(),a=s.filter(e=>e.status===`done`&&e.response).map(e=>{let t=e.response,n=t.ocr_result;return{file_path:en(t.file_path),original_name:t.original_name??e.name,ocr_result:n?.markdown_files?.map(e=>({page_number:e.page_number,full_markdown:en(e.full_markdown),simple_markdown:en(e.simple_markdown),annotated_markdown:en(e.annotated_markdown)}))}});if(!n&&a.length===0)return;let o=[{type:`text`,text:e}];a.length>0&&o.push({type:`text`,text:`\n\`\`\`attachments\n${JSON.stringify(a,null,2)}\n\`\`\``}),r.addMessage({id:crypto.randomUUID(),role:`user`,content:o}),p(``),c([]),await i.runAgent({agent:r,forwardedProps:{agent:t}})}return(0,f.jsx)($t.Provider,{value:{step:a,setStep:o,threadId:e,attachedFiles:s,addFiles:h,removeFile:g,inputValue:l,setInputValue:p,handleSubmit:_},children:n})}Object.freeze({status:`aborted`});function M(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 nn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},rn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},an={};function on(e){return e&&Object.assign(an,e),an}function sn(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 cn(e,t){return typeof t==`bigint`?t.toString():t}function ln(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function un(e){return e==null}function dn(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var fn=Symbol(`evaluating`);function N(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==fn)return r===void 0&&(r=fn,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function pn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function mn(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function hn(e){return JSON.stringify(e)}function gn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var _n=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function vn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var yn=ln(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function bn(e){if(vn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(vn(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function xn(e){return bn(e)?{...e}:Array.isArray(e)?[...e]:e}var Sn=new Set([`string`,`number`,`symbol`]);function Cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function wn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function P(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 Tn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function En(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 wn(e,mn(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 pn(this,`shape`,e),e},checks:[]}))}function Dn(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 wn(e,mn(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 pn(this,`shape`,r),r},checks:[]}))}function On(e,t){if(!bn(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 wn(e,mn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return pn(this,`shape`,n),n}}))}function kn(e,t){if(!bn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return wn(e,mn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return pn(this,`shape`,n),n}}))}function An(e,t){return wn(e,mn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return pn(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function jn(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 wn(t,mn(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 pn(this,`shape`,i),i},checks:[]}))}function Mn(e,t,n){return wn(t,mn(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 pn(this,`shape`,i),i}}))}function Nn(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 Pn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Fn(e){return typeof e==`string`?e:e?.message}function In(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Fn(e.inst?._zod.def?.error?.(e))??Fn(t?.error?.(e))??Fn(n.customError?.(e))??Fn(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ln(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Rn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var zn=(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,cn,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Bn=M(`$ZodError`,zn),Vn=M(`$ZodError`,zn,{Parent:Error});function Hn(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 Un(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 Wn=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 nn;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>In(e,a,on())));throw _n(t,i?.callee),t}return o.value},Gn=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=>In(e,a,on())));throw _n(t,i?.callee),t}return o.value},Kn=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 nn;return a.issues.length?{success:!1,error:new(e??Bn)(a.issues.map(e=>In(e,i,on())))}:{success:!0,data:a.value}},qn=Kn(Vn),Jn=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=>In(e,i,on())))}:{success:!0,data:a.value}},Yn=Jn(Vn),Xn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Wn(e)(t,n,i)},Zn=e=>(t,n,r)=>Wn(e)(t,n,r),Qn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Gn(e)(t,n,i)},$n=e=>async(t,n,r)=>Gn(e)(t,n,r),er=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Kn(e)(t,n,i)},tr=e=>(t,n,r)=>Kn(e)(t,n,r),nr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Jn(e)(t,n,i)},rr=e=>async(t,n,r)=>Jn(e)(t,n,r),ir=/^[cC][^\s-]{8,}$/,ar=/^[0-9a-z]+$/,or=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sr=/^[0-9a-vA-V]{20}$/,cr=/^[A-Za-z0-9]{27}$/,lr=/^[a-zA-Z0-9_-]{21}$/,ur=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,dr=/^([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})$/,fr=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)$/,pr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mr=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function hr(){return new RegExp(mr,`u`)}var gr=/^(?:(?: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])$/,_r=/^(([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}|:))$/,vr=/^((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])$/,yr=/^(([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])$/,br=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xr=/^[A-Za-z0-9_-]*$/,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=M(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Mr=M(`$ZodCheckMaxLength`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!un(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=Ln(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Nr=M(`$ZodCheckMinLength`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!un(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=Ln(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pr=M(`$ZodCheckLengthEquals`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!un(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=Ln(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=M(`$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=M(`$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=M(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=kr,Fr.init(e,t)}),Rr=M(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ar,Fr.init(e,t)}),zr=M(`$ZodCheckIncludes`,(e,t)=>{jr.init(e,t);let n=Cn(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=M(`$ZodCheckStartsWith`,(e,t)=>{jr.init(e,t);let n=RegExp(`^${Cn(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=M(`$ZodCheckEndsWith`,(e,t)=>{jr.init(e,t);let n=RegExp(`.*${Cn(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=M(`$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
- `))}},Gr={major:4,minor:3,patch:6},P=j(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gr;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=Pn(e),i;for(let a of t){if(a._zod.def.when){if(!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 rn;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Pn(e,t))});else{if(e.issues.length===t)continue;r||=Pn(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Pn(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new rn;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 rn;return o.then(e=>t(e,r,a))}return t(o,r,a)}}M(e,`~standard`,()=>({validate:t=>{try{let n=Jn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Xn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Kr=j(`$ZodString`,(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??kr(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)=>{Ir.init(e,t),Kr.init(e,t)}),qr=j(`$ZodGUID`,(e,t)=>{t.pattern??=fr,F.init(e,t)}),Jr=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??=pr(e)}else t.pattern??=pr();F.init(e,t)}),Yr=j(`$ZodEmail`,(e,t)=>{t.pattern??=mr,F.init(e,t)}),Xr=j(`$ZodURL`,(e,t)=>{F.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),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})}}}),Zr=j(`$ZodEmoji`,(e,t)=>{t.pattern??=gr(),F.init(e,t)}),Qr=j(`$ZodNanoID`,(e,t)=>{t.pattern??=ur,F.init(e,t)}),$r=j(`$ZodCUID`,(e,t)=>{t.pattern??=ar,F.init(e,t)}),ei=j(`$ZodCUID2`,(e,t)=>{t.pattern??=or,F.init(e,t)}),ti=j(`$ZodULID`,(e,t)=>{t.pattern??=sr,F.init(e,t)}),ni=j(`$ZodXID`,(e,t)=>{t.pattern??=cr,F.init(e,t)}),ri=j(`$ZodKSUID`,(e,t)=>{t.pattern??=lr,F.init(e,t)}),ii=j(`$ZodISODateTime`,(e,t)=>{t.pattern??=Or(t),F.init(e,t)}),ai=j(`$ZodISODate`,(e,t)=>{t.pattern??=Tr,F.init(e,t)}),oi=j(`$ZodISOTime`,(e,t)=>{t.pattern??=Dr(t),F.init(e,t)}),si=j(`$ZodISODuration`,(e,t)=>{t.pattern??=dr,F.init(e,t)}),ci=j(`$ZodIPv4`,(e,t)=>{t.pattern??=_r,F.init(e,t),e._zod.bag.format=`ipv4`}),li=j(`$ZodIPv6`,(e,t)=>{t.pattern??=vr,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})}}}),ui=j(`$ZodCIDRv4`,(e,t)=>{t.pattern??=yr,F.init(e,t)}),di=j(`$ZodCIDRv6`,(e,t)=>{t.pattern??=br,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 fi(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var pi=j(`$ZodBase64`,(e,t)=>{t.pattern??=xr,F.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{fi(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function mi(e){if(!Sr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return fi(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var hi=j(`$ZodBase64URL`,(e,t)=>{t.pattern??=Sr,F.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{mi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),gi=j(`$ZodE164`,(e,t)=>{t.pattern??=Cr,F.init(e,t)});function _i(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 vi=j(`$ZodJWT`,(e,t)=>{F.init(e,t),e._zod.check=n=>{_i(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),yi=j(`$ZodUnknown`,(e,t)=>{P.init(e,t),e._zod.parse=e=>e}),bi=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 xi(e,t,n){e.issues.length&&t.issues.push(...Fn(n,e.issues)),t.value[n]=e.value}var Si=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=>xi(t,n,e))):xi(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Ci(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...Fn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function wi(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=En(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ti(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(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=>Ci(e,n,i,t,u))):Ci(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Ei=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=un(()=>wi(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=yn,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.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Ci(n,t,e,s,r))):Ci(i,t,e,s,r)}return i?Ti(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Di=j(`$ZodObjectJIT`,(e,t)=>{Ei.init(e,t);let n=e._zod.parse,r=un(()=>wi(t)),i=e=>{let t=new Wr([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=gn(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=gn(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
8
+ `))}},Wr={major:4,minor:3,patch:6},F=M(`$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=Nn(e),i;for(let a of t){if(a._zod.def.when){if(!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 nn;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Nn(e,t))});else{if(e.issues.length===t)continue;r||=Nn(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Nn(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new nn;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 nn;return o.then(e=>t(e,r,a))}return t(o,r,a)}}N(e,`~standard`,()=>({validate:t=>{try{let n=qn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Yn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Gr=M(`$ZodString`,(e,t)=>{F.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}}),I=M(`$ZodStringFormat`,(e,t)=>{Fr.init(e,t),Gr.init(e,t)}),Kr=M(`$ZodGUID`,(e,t)=>{t.pattern??=dr,I.init(e,t)}),qr=M(`$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??=fr(e)}else t.pattern??=fr();I.init(e,t)}),Jr=M(`$ZodEmail`,(e,t)=>{t.pattern??=pr,I.init(e,t)}),Yr=M(`$ZodURL`,(e,t)=>{I.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),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=M(`$ZodEmoji`,(e,t)=>{t.pattern??=hr(),I.init(e,t)}),Zr=M(`$ZodNanoID`,(e,t)=>{t.pattern??=lr,I.init(e,t)}),Qr=M(`$ZodCUID`,(e,t)=>{t.pattern??=ir,I.init(e,t)}),$r=M(`$ZodCUID2`,(e,t)=>{t.pattern??=ar,I.init(e,t)}),ei=M(`$ZodULID`,(e,t)=>{t.pattern??=or,I.init(e,t)}),ti=M(`$ZodXID`,(e,t)=>{t.pattern??=sr,I.init(e,t)}),ni=M(`$ZodKSUID`,(e,t)=>{t.pattern??=cr,I.init(e,t)}),ri=M(`$ZodISODateTime`,(e,t)=>{t.pattern??=Dr(t),I.init(e,t)}),ii=M(`$ZodISODate`,(e,t)=>{t.pattern??=wr,I.init(e,t)}),ai=M(`$ZodISOTime`,(e,t)=>{t.pattern??=Er(t),I.init(e,t)}),oi=M(`$ZodISODuration`,(e,t)=>{t.pattern??=ur,I.init(e,t)}),si=M(`$ZodIPv4`,(e,t)=>{t.pattern??=gr,I.init(e,t),e._zod.bag.format=`ipv4`}),ci=M(`$ZodIPv6`,(e,t)=>{t.pattern??=_r,I.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=M(`$ZodCIDRv4`,(e,t)=>{t.pattern??=vr,I.init(e,t)}),ui=M(`$ZodCIDRv6`,(e,t)=>{t.pattern??=yr,I.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(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var fi=M(`$ZodBase64`,(e,t)=>{t.pattern??=br,I.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(!xr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return di(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var mi=M(`$ZodBase64URL`,(e,t)=>{t.pattern??=xr,I.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=M(`$ZodE164`,(e,t)=>{t.pattern??=Sr,I.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=M(`$ZodJWT`,(e,t)=>{I.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=M(`$ZodUnknown`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),yi=M(`$ZodNever`,(e,t)=>{F.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(...Pn(n,e.issues)),t.value[n]=e.value}var xi=M(`$ZodArray`,(e,t)=>{F.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){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...Pn(n,e.issues))}e.value===void 0?n in r&&(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=Tn(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.optout===`optional`;for(let i in t){if(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))):Si(a,n,i,t,u)}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=M(`$ZodObject`,(e,t)=>{if(F.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=ln(()=>Ci(t));N(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=vn,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.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Si(n,t,e,s,r))):Si(i,t,e,s,r)}return i?wi(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ei=M(`$ZodObjectJIT`,(e,t)=>{Ti.init(e,t);let n=e._zod.parse,r=ln(()=>Ci(t)),i=e=>{let t=new Ur([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=hn(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=hn(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?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 => ({
@@ -39,16 +39,16 @@ 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=yn,s=!on.jitless,c=s&&bn.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?Ti([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Oi(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=>!Pn(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=>Ln(e,r,sn())))}),t)}var ki=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=>fn(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=>Oi(t,i,e,a)):Oi(s,i,e,a)}}),Ai=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])=>Mi(e,t,n)):Mi(e,i,a)}});function ji(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(xn(e)&&xn(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=ji(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=ji(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 Mi(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}),Pn(e))return e;let o=ji(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ni=j(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=cn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Cn.has(typeof e)).map(e=>typeof e==`string`?wn(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}}),Pi=j(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new an(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 rn;return n.value=i,n}});function Fi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ii=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(`^(${fn(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=>Fi(t,e.value)):Fi(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Li=j(`$ZodExactOptional`,(e,t)=>{Ii.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)}),Ri=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(`^(${fn(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)}),zi=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=>Bi(e,t)):Bi(r,t)}});function Bi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Vi=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))}),Hi=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=>Ui(t,e)):Ui(i,e)}});function Ui(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 Wi=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=>Ln(e,n,sn()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ln(e,n,sn()))},input:e.value}),e.issues=[]),e)}}),Gi=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=>Ki(e,t.in,n)):Ki(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ki(e,t.out,n)):Ki(r,t.out,n)}});function Ki(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var qi=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(Ji):Ji(r)}});function Ji(e){return e.value=Object.freeze(e.value),e}var Yi=j(`$ZodCustom`,(e,t)=>{Mr.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=>Xi(t,n,r,e));Xi(i,n,r,e)}});function Xi(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(zn(e))}}var Zi,Qi=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 $i(){return new Qi}(Zi=globalThis).__zod_globalRegistry??(Zi.__zod_globalRegistry=$i());var ea=globalThis.__zod_globalRegistry;function ta(e,t){return new e({type:`string`,...N(t)})}function na(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}function ra(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}function ia(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}function aa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}function oa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}function sa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}function ca(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}function la(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}function ua(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}function da(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}function fa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}function pa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}function ma(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}function ha(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}function ga(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}function _a(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}function va(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}function ya(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}function ba(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}function xa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}function Sa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}function Ca(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(t)})}function wa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N(t)})}function Ta(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}function Ea(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}function Da(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}function Oa(e){return new e({type:`unknown`})}function ka(e,t){return new e({type:`never`,...N(t)})}function Aa(e,t){return new Nr({check:`max_length`,...N(t),maximum:e})}function ja(e,t){return new Pr({check:`min_length`,...N(t),minimum:e})}function Ma(e,t){return new Fr({check:`length_equals`,...N(t),length:e})}function Na(e,t){return new Lr({check:`string_format`,format:`regex`,...N(t),pattern:e})}function Pa(e){return new Rr({check:`string_format`,format:`lowercase`,...N(e)})}function Fa(e){return new zr({check:`string_format`,format:`uppercase`,...N(e)})}function Ia(e,t){return new Br({check:`string_format`,format:`includes`,...N(t),includes:e})}function La(e,t){return new Vr({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}function Ra(e,t){return new Hr({check:`string_format`,format:`ends_with`,...N(t),suffix:e})}function za(e){return new Ur({check:`overwrite`,tx:e})}function Ba(e){return za(t=>t.normalize(e))}function Va(){return za(e=>e.trim())}function Ha(){return za(e=>e.toLowerCase())}function Ua(){return za(e=>e.toUpperCase())}function Wa(){return za(e=>_n(e))}function Ga(e,t,n){return new e({type:`array`,element:t,...N(n)})}function Ka(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N(n)})}function qa(e){let t=Ja(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(zn(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(zn(r))}},e(n.value,n)));return t}function Ja(e,t){let n=new Mr({check:`custom`,...N(t)});return n._zod.check=e,n}function Ya(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??ea,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 Xa(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(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=vn,s=!an.jitless,c=s&&yn.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=>!Nn(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=>In(e,r,on())))}),t)}var Oi=M(`$ZodUnion`,(e,t)=>{F.init(e,t),N(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),N(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),N(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),N(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=>dn(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=>Di(t,i,e,a)):Di(s,i,e,a)}}),ki=M(`$ZodIntersection`,(e,t)=>{F.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(bn(e)&&bn(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}),Nn(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=M(`$ZodEnum`,(e,t)=>{F.init(e,t);let n=sn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Sn.has(typeof e)).map(e=>typeof e==`string`?Cn(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=M(`$ZodTransform`,(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new rn(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 nn;return n.value=i,n}});function Pi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Fi=M(`$ZodOptional`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,N(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),N(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${dn(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=>Pi(t,e.value)):Pi(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ii=M(`$ZodExactOptional`,(e,t)=>{Fi.init(e,t),N(e._zod,`values`,()=>t.innerType._zod.values),N(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Li=M(`$ZodNullable`,(e,t)=>{F.init(e,t),N(e._zod,`optin`,()=>t.innerType._zod.optin),N(e._zod,`optout`,()=>t.innerType._zod.optout),N(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${dn(e.source)}|null)$`):void 0}),N(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=M(`$ZodDefault`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,N(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=M(`$ZodPrefault`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,N(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=M(`$ZodNonOptional`,(e,t)=>{F.init(e,t),N(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=M(`$ZodCatch`,(e,t)=>{F.init(e,t),N(e._zod,`optin`,()=>t.innerType._zod.optin),N(e._zod,`optout`,()=>t.innerType._zod.optout),N(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=>In(e,n,on()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>In(e,n,on()))},input:e.value}),e.issues=[]),e)}}),Wi=M(`$ZodPipe`,(e,t)=>{F.init(e,t),N(e._zod,`values`,()=>t.in._zod.values),N(e._zod,`optin`,()=>t.in._zod.optin),N(e._zod,`optout`,()=>t.out._zod.optout),N(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},n)}var Ki=M(`$ZodReadonly`,(e,t)=>{F.init(e,t),N(e._zod,`propValues`,()=>t.innerType._zod.propValues),N(e._zod,`values`,()=>t.innerType._zod.values),N(e._zod,`optin`,()=>t.innerType?._zod?.optin),N(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=M(`$ZodCustom`,(e,t)=>{jr.init(e,t),F.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(Rn(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`,...P(t)})}function ta(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...P(t)})}function na(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...P(t)})}function ra(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...P(t)})}function ia(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...P(t)})}function aa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...P(t)})}function oa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...P(t)})}function sa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...P(t)})}function ca(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...P(t)})}function la(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...P(t)})}function ua(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...P(t)})}function da(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...P(t)})}function fa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...P(t)})}function pa(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...P(t)})}function ma(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...P(t)})}function ha(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...P(t)})}function ga(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...P(t)})}function _a(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...P(t)})}function va(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...P(t)})}function ya(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...P(t)})}function ba(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...P(t)})}function xa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...P(t)})}function Sa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...P(t)})}function Ca(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...P(t)})}function wa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...P(t)})}function Ta(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...P(t)})}function Ea(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...P(t)})}function Da(e){return new e({type:`unknown`})}function Oa(e,t){return new e({type:`never`,...P(t)})}function ka(e,t){return new Mr({check:`max_length`,...P(t),maximum:e})}function Aa(e,t){return new Nr({check:`min_length`,...P(t),minimum:e})}function ja(e,t){return new Pr({check:`length_equals`,...P(t),length:e})}function Ma(e,t){return new Ir({check:`string_format`,format:`regex`,...P(t),pattern:e})}function Na(e){return new Lr({check:`string_format`,format:`lowercase`,...P(e)})}function Pa(e){return new Rr({check:`string_format`,format:`uppercase`,...P(e)})}function Fa(e,t){return new zr({check:`string_format`,format:`includes`,...P(t),includes:e})}function Ia(e,t){return new Br({check:`string_format`,format:`starts_with`,...P(t),prefix:e})}function La(e,t){return new Vr({check:`string_format`,format:`ends_with`,...P(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=>gn(e))}function Wa(e,t,n){return new e({type:`array`,element:t,...P(n)})}function Ga(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...P(n)})}function Ka(e){let t=qa(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Rn(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(Rn(r))}},e(n.value,n)));return t}function qa(e,t){let n=new jr({check:`custom`,...P(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 L(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,L(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`&&R(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 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
43
 
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 Za(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:$a(t,`input`,e.processors),output:$a(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 Qa=(e,t={})=>n=>{let r=Ya({...n,processors:t});return I(e,r),Xa(r,e),Za(r,e)},$a=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ya({...i??{},target:a,io:t,processors:n});return I(e,o),Xa(o,e),Za(o,e)},eo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},to=(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=eo[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}))])}},no=(e,t,n,r)=>{n.not={}},ro=(e,t,n,r)=>{let i=e._zod.def,a=cn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},io=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},oo=(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`]})},so=(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)},co=(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},lo=(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]]},uo=(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`}]},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},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.default=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,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ho=(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},go=(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},_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,n.readOnly=!0},vo=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},yo=j(`ZodISODateTime`,(e,t)=>{ii.init(e,t),z.init(e,t)});function bo(e){return wa(yo,e)}var xo=j(`ZodISODate`,(e,t)=>{ai.init(e,t),z.init(e,t)});function So(e){return Ta(xo,e)}var Co=j(`ZodISOTime`,(e,t)=>{oi.init(e,t),z.init(e,t)});function wo(e){return Ea(Co,e)}var To=j(`ZodISODuration`,(e,t)=>{si.init(e,t),z.init(e,t)});function Eo(e){return Da(To,e)}var Do=(e,t)=>{Vn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Wn(e,t)},flatten:{value:t=>Un(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ln,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ln,2)}},isEmpty:{get(){return e.issues.length===0}}})};j(`ZodError`,Do);var Oo=j(`ZodError`,Do,{Parent:Error}),ko=Gn(Oo),Ao=Kn(Oo),jo=qn(Oo),Mo=Yn(Oo),No=Zn(Oo),Po=Qn(Oo),Fo=$n(Oo),Io=er(Oo),Lo=tr(Oo),Ro=nr(Oo),zo=rr(Oo),Bo=ir(Oo),R=j(`ZodType`,(e,t)=>(P.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:$a(e,`input`),output:$a(e,`output`)}}),e.toJSONSchema=Qa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(hn(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)=>Tn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ko(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>jo(e,t,n),e.parseAsync=async(t,n)=>Ao(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Mo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>No(e,t,n),e.decode=(t,n)=>Po(e,t,n),e.encodeAsync=async(t,n)=>Fo(e,t,n),e.decodeAsync=async(t,n)=>Io(e,t,n),e.safeEncode=(t,n)=>Lo(e,t,n),e.safeDecode=(t,n)=>Ro(e,t,n),e.safeEncodeAsync=async(t,n)=>zo(e,t,n),e.safeDecodeAsync=async(t,n)=>Bo(e,t,n),e.refine=(t,n)=>e.check(Ws(t,n)),e.superRefine=t=>e.check(Gs(t)),e.overwrite=t=>e.check(za(t)),e.optional=()=>Es(e),e.exactOptional=()=>Os(e),e.nullable=()=>As(e),e.nullish=()=>Es(As(e)),e.nonoptional=t=>Is(e,t),e.array=()=>ms(e),e.or=t=>vs([e,t]),e.and=t=>bs(e,t),e.transform=t=>Bs(e,ws(t)),e.default=t=>Ms(e,t),e.prefault=t=>Ps(e,t),e.catch=t=>Rs(e,t),e.pipe=t=>Bs(e,t),e.readonly=()=>Hs(e),e.describe=t=>{let n=e.clone();return ea.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return ea.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return ea.get(e);let n=e.clone();return ea.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Vo=j(`_ZodString`,(e,t)=>{Kr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(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(Na(...t)),e.includes=(...t)=>e.check(Ia(...t)),e.startsWith=(...t)=>e.check(La(...t)),e.endsWith=(...t)=>e.check(Ra(...t)),e.min=(...t)=>e.check(ja(...t)),e.max=(...t)=>e.check(Aa(...t)),e.length=(...t)=>e.check(Ma(...t)),e.nonempty=(...t)=>e.check(ja(1,...t)),e.lowercase=t=>e.check(Pa(t)),e.uppercase=t=>e.check(Fa(t)),e.trim=()=>e.check(Va()),e.normalize=(...t)=>e.check(Ba(...t)),e.toLowerCase=()=>e.check(Ha()),e.toUpperCase=()=>e.check(Ua()),e.slugify=()=>e.check(Wa())}),Ho=j(`ZodString`,(e,t)=>{Kr.init(e,t),Vo.init(e,t),e.email=t=>e.check(na(Wo,t)),e.url=t=>e.check(ca(qo,t)),e.jwt=t=>e.check(Ca(cs,t)),e.emoji=t=>e.check(la(Jo,t)),e.guid=t=>e.check(ra(Go,t)),e.uuid=t=>e.check(ia(Ko,t)),e.uuidv4=t=>e.check(aa(Ko,t)),e.uuidv6=t=>e.check(oa(Ko,t)),e.uuidv7=t=>e.check(sa(Ko,t)),e.nanoid=t=>e.check(ua(Yo,t)),e.guid=t=>e.check(ra(Go,t)),e.cuid=t=>e.check(da(Xo,t)),e.cuid2=t=>e.check(fa(Zo,t)),e.ulid=t=>e.check(pa(Qo,t)),e.base64=t=>e.check(ba(as,t)),e.base64url=t=>e.check(xa(os,t)),e.xid=t=>e.check(ma($o,t)),e.ksuid=t=>e.check(ha(es,t)),e.ipv4=t=>e.check(ga(ts,t)),e.ipv6=t=>e.check(_a(ns,t)),e.cidrv4=t=>e.check(va(rs,t)),e.cidrv6=t=>e.check(ya(is,t)),e.e164=t=>e.check(Sa(ss,t)),e.datetime=t=>e.check(bo(t)),e.date=t=>e.check(So(t)),e.time=t=>e.check(wo(t)),e.duration=t=>e.check(Eo(t))});function Uo(e){return ta(Ho,e)}var z=j(`ZodStringFormat`,(e,t)=>{F.init(e,t),Vo.init(e,t)}),Wo=j(`ZodEmail`,(e,t)=>{Yr.init(e,t),z.init(e,t)}),Go=j(`ZodGUID`,(e,t)=>{qr.init(e,t),z.init(e,t)}),Ko=j(`ZodUUID`,(e,t)=>{Jr.init(e,t),z.init(e,t)}),qo=j(`ZodURL`,(e,t)=>{Xr.init(e,t),z.init(e,t)}),Jo=j(`ZodEmoji`,(e,t)=>{Zr.init(e,t),z.init(e,t)}),Yo=j(`ZodNanoID`,(e,t)=>{Qr.init(e,t),z.init(e,t)}),Xo=j(`ZodCUID`,(e,t)=>{$r.init(e,t),z.init(e,t)}),Zo=j(`ZodCUID2`,(e,t)=>{ei.init(e,t),z.init(e,t)}),Qo=j(`ZodULID`,(e,t)=>{ti.init(e,t),z.init(e,t)}),$o=j(`ZodXID`,(e,t)=>{ni.init(e,t),z.init(e,t)}),es=j(`ZodKSUID`,(e,t)=>{ri.init(e,t),z.init(e,t)}),ts=j(`ZodIPv4`,(e,t)=>{ci.init(e,t),z.init(e,t)}),ns=j(`ZodIPv6`,(e,t)=>{li.init(e,t),z.init(e,t)}),rs=j(`ZodCIDRv4`,(e,t)=>{ui.init(e,t),z.init(e,t)}),is=j(`ZodCIDRv6`,(e,t)=>{di.init(e,t),z.init(e,t)}),as=j(`ZodBase64`,(e,t)=>{pi.init(e,t),z.init(e,t)}),os=j(`ZodBase64URL`,(e,t)=>{hi.init(e,t),z.init(e,t)}),ss=j(`ZodE164`,(e,t)=>{gi.init(e,t),z.init(e,t)}),cs=j(`ZodJWT`,(e,t)=>{vi.init(e,t),z.init(e,t)}),ls=j(`ZodUnknown`,(e,t)=>{yi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function us(){return Oa(ls)}var ds=j(`ZodNever`,(e,t)=>{bi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function fs(e){return ka(ds,e)}var ps=j(`ZodArray`,(e,t)=>{Si.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(ja(t,n)),e.nonempty=t=>e.check(ja(1,t)),e.max=(t,n)=>e.check(Aa(t,n)),e.length=(t,n)=>e.check(Ma(t,n)),e.unwrap=()=>e.element});function ms(e,t){return Ga(ps,e,t)}var hs=j(`ZodObject`,(e,t)=>{Di.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),M(e,`shape`,()=>t.shape),e.keyof=()=>Ss(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:us()}),e.loose=()=>e.clone({...e._zod.def,catchall:us()}),e.strict=()=>e.clone({...e._zod.def,catchall:fs()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>kn(e,t),e.safeExtend=t=>An(e,t),e.merge=t=>jn(e,t),e.pick=t=>Dn(e,t),e.omit=t=>On(e,t),e.partial=(...t)=>Mn(Ts,e,t[0]),e.required=(...t)=>Nn(Fs,e,t[0])});function gs(e,t){return new hs({type:`object`,shape:e??{},...N(t)})}var _s=j(`ZodUnion`,(e,t)=>{ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(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)=>{Ai.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r)});function bs(e,t){return new ys({type:`intersection`,left:e,right:t})}var xs=j(`ZodEnum`,(e,t)=>{Ni.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(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)=>{Pi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new an(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(zn(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(zn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ws(e){return new Cs({type:`transform`,transform:e})}var Ts=j(`ZodOptional`,(e,t)=>{Ii.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(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)=>{Li.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(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)=>{Ri.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 As(e){return new ks({type:`nullable`,innerType:e})}var js=j(`ZodDefault`,(e,t)=>{zi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(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():Sn(t)}})}var Ns=j(`ZodPrefault`,(e,t)=>{Vi.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 Ps(e,t){return new Ns({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Sn(t)}})}var Fs=j(`ZodNonOptional`,(e,t)=>{Hi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(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)=>{Wi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(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)=>{Gi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(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)=>{qi.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 Hs(e){return new Vs({type:`readonly`,innerType:e})}var Us=j(`ZodCustom`,(e,t)=>{Yi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r)});function Ws(e,t={}){return Ka(Us,e,t)}function Gs(e){return qa(e)}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=gs({filled_template:gs({template_name:Uo(),output_filename:Uo(),s3_path:Uo()})}),Ys={get:async(e,t)=>{let{data:n}=await Kt({path:{threadId:e,filename:t},throwOnError:!0});return n}},Xs=[`bar`,`line`,`pie`,`bignumber`,`table`,`scatter`,`funnel`],Zs=/(\w+)=(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|(true|false|-?(?:\d+\.?\d*|\.\d+)))/g;function Qs(e){let t={},n=new RegExp(Zs.source,Zs.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 $s=/\{%\s*(\w+)\s+((?:(?!\/%\})[\s\S])*)\/%\}/g;function ec(e){let t=[],n=0,r=new RegExp($s.source,$s.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(Xs.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 tc(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 nc(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 rc(e){if(e===void 0)return;let t=Number(e);return isNaN(t)?void 0:t}function ic(e){if(e===void 0)return;let t=Number(e);return isNaN(t)?e:t}function ac(e){if(e!==void 0)return e.includes(`,`)?e.split(`,`).map(e=>e.trim()):e}function oc(e){if(e!==void 0)return e.split(`,`).map(e=>e.trim())}function sc(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function cc(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function lc(e){let t={};for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function uc({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 dc({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 lc({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)(uc,{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 fc({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 lc({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)(uc,{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 pc={red:`#dc2626`,green:`#16a34a`,blue:`#2563eb`,yellow:`#ca8a04`,orange:`#ea580c`,purple:`#9333ea`,pink:`#db2777`,gray:`#6b7280`,black:`#111827`,white:`#ffffff`},mc=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:pc[n]??n}:{text:e}};function hc({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)(()=>mc(r),[r]),g=(0,u.useMemo)(()=>mc(i),[i]),_=(0,u.useMemo)(()=>mc(a),[a]),v=(0,u.useMemo)(()=>mc(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 gc({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 lc({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)(uc,{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 _c=e=>e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e);function vc({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:_c(e[n])})},`${t}-${n}`))},String(e._erica_id??t)))})]})})]})}function yc({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 lc({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)(uc,{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 bc({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 lc({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)(uc,{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 xc({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 Sc(e){let{type:t,attrs:n}=e,r=tc(t,n);if(!r.valid)return(0,f.jsx)(xc,{type:t,errors:r.errors});switch(t){case`bar`:return(0,f.jsx)(dc,{sql:n.sql,data:cc(n.data),x:n.x,y:ac(n.y)??n.y,title:n.title,height:ic(n.height),color:ac(n.color),xAxisName:n.xAxisName,yAxisName:n.yAxisName,horizontal:nc(n.horizontal),stack:nc(n.stack),seriesNames:sc(n.seriesNames)});case`line`:return(0,f.jsx)(fc,{sql:n.sql,data:cc(n.data),x:n.x,y:ac(n.y)??n.y,title:n.title,height:ic(n.height),color:ac(n.color),xAxisName:n.xAxisName||n.x_title,yAxisName:n.yAxisName||n.y_title,smooth:nc(n.smooth),area:nc(n.area),seriesNames:sc(n.seriesNames),secondary_y:ac(n.secondary_y),secondary_title:n.secondary_title,prefix:n.prefix,suffix:n.suffix});case`bignumber`:return(0,f.jsx)(hc,{sql:n.sql,data:cc(n.data),value:n.value,title:n.title,subtitle:n.subtitle,description:n.description,height:ic(n.height),prefix:n.prefix,suffix:n.suffix,decimals:rc(n.decimals)});case`funnel`:return(0,f.jsx)(gc,{sql:n.sql,data:cc(n.data),name:n.name||n.label||n.stage||n.x,value:n.value||n.y,title:n.title,height:ic(n.height),showLabels:nc(n.showLabels),showLegend:nc(n.showLegend),sort:n.sort});case`scatter`:return(0,f.jsx)(bc,{sql:n.sql,data:cc(n.data),x:n.x,y:ac(n.y)??n.y,seriesBy:n.seriesBy,size:n.size,color:n.color,title:n.title,height:ic(n.height),xAxisName:n.xAxisName,yAxisName:n.yAxisName,seriesNames:sc(n.seriesNames)});case`pie`:return(0,f.jsx)(yc,{sql:n.sql,data:cc(n.data),name:n.name||n.label||n.x,value:n.value||n.y,title:n.title,height:ic(n.height),donut:nc(n.donut),showLabels:nc(n.showLabels),showLegend:nc(n.showLegend)});case`table`:return(0,f.jsx)(vc,{sql:n.sql,data:cc(n.data),title:n.title,height:ic(n.height),columns:oc(n.columns),maxRows:rc(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 Cc({markdown:e}){return(0,f.jsx)(`div`,{className:`erica-chart-container`,children:(0,u.useMemo)(()=>ec(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:Sc(e.node)},t))})}function wc({chartConfig:e}){return(0,f.jsx)(`div`,{className:`chart-card-container`,children:(0,f.jsx)(Cc,{markdown:e})})}function Tc({path:e}){let t=(0,u.useContext)(en)?.threadId||``,{data:n,isLoading:r}=Rt({queryKey:[`artifact`,t,e],queryFn:async()=>await Ys.get(t,e),enabled:!!t&&!!e});return r?(0,f.jsx)(`div`,{className:`chart-loader-loading`,children:`loading chart...`}):n?(0,f.jsx)(wc,{chartConfig:n}):(0,f.jsx)(`div`,{className:`chart-loader-no-data`,children:`No chart data available`})}var Ec=(0,u.createContext)(null);function Dc({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)(Ec.Provider,{value:{isOpen:t,onOpen:()=>n(!0),onClose:()=>n(!1),content:r,setContent:i,title:a,setTitle:o},children:e})}var Oc=()=>(0,u.useContext)(Ec)||{isOpen:!1,onOpen:()=>{},onClose:()=>{},content:null,setContent:()=>{},title:`Artifacts`,setTitle:()=>{}};function kc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ac=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jc=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Mc={};function Nc(e,t){return((t||Mc).jsx?jc:Ac).test(e)}var Pc=/[ \t\n\f\r]/g;function Fc(e){return typeof e==`object`?e.type===`text`?Ic(e.value):!1:Ic(e)}function Ic(e){return e.replace(Pc,``)===``}var Lc=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Lc.prototype.normal={},Lc.prototype.property={},Lc.prototype.space=void 0;function Rc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Lc(n,r,t)}function zc(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 Bc=s({boolean:()=>V,booleanish:()=>H,commaOrSpaceSeparated:()=>G,commaSeparated:()=>Uc,number:()=>U,overloadedBoolean:()=>Hc,spaceSeparated:()=>W}),Vc=0,V=Wc(),H=Wc(),Hc=Wc(),U=Wc(),W=Wc(),Uc=Wc(),G=Wc();function Wc(){return 2**++Vc}var Gc=Object.keys(Bc),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&Bc[e])===Bc[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[zc(r)]=r,n[zc(a.attribute)]=r}return new Lc(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:Uc,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|Uc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:V,defer:V,dir:null,dirName:null,disabled:V,download:Hc,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:Hc,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:Uc,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:G,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:Uc,g2:Uc,glyphName:Uc,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:G,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:G,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:G,rev:G,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:G,requiredFeatures:G,requiredFonts:G,requiredFormats:G,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:G,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:G,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:G,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=zc(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=Rc([Yc,Qc,el,tl,nl],`html`),dl=Rc([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=`
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})),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 K=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}};K.prototype.file=``,K.prototype.name=``,K.prototype.reason=``,K.prototype.message=``,K.prototype.stack=``,K.prototype.column=void 0,K.prototype.line=void 0,K.prototype.ancestors=void 0,K.prototype.cause=void 0,K.prototype.fatal=void 0,K.prototype.place=void 0,K.prototype.ruleId=void 0,K.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`]),jl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ml(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=Ul(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=Hl(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=Nl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Nl(e,t,n){if(t.type===`element`)return Pl(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Fl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ll(e,t,n);if(t.type===`mdxjsEsm`)return Il(e,t);if(t.type===`root`)return Rl(e,t,n);if(t.type===`text`)return zl(e,t)}function Pl(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=Yl(e,t.tagName,!1),o=Wl(e,t),s=Kl(e,t);return kl.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Fc(e):!0})),Bl(e,o,a,t),Vl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Fl(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)}Xl(e,t.position)}function Il(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xl(e,t.position)}function Ll(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:Yl(e,t.name,!0),o=Gl(e,t),s=Kl(e,t);return Bl(e,o,a,t),Vl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Rl(e,t,n){let r={};return Vl(r,Kl(e,t)),e.create(t,e.Fragment,r,n)}function zl(e,t){return t.value}function Bl(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vl(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Hl(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 Ul(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 Wl(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&El.call(t.properties,i)){let a=ql(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 Gl(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 Xl(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 Xl(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Kl(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=Nl(e,a,o);s!==void 0&&n.push(s)}return n}function ql(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?kc(n):fl(n)),r.property===`style`){let t=typeof n==`object`?n:Jl(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Zl(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?rl[r.property]||r.property:r.attribute,n]}}function Jl(e,t){try{return(0,Tl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new K("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=jl+`#cannot-parse-style-attribute`,r}}function Yl(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=Nc(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=Nc(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);Xl(e)}function Xl(e,t){let n=new K("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=jl+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Zl(e){let t={},n;for(n in e)El.call(e,n)&&(t[Ql(n)]=e[n]);return t}function Ql(e){let t=e.replace(Ol,$l);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function $l(e){return`-`+e.toLowerCase()}var eu={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`]},tu={};function nu(e,t){let n=t||tu;return ru(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function ru(e,t,n){if(au(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 iu(e.children,t,n)}return Array.isArray(e)?iu(e,t,n):``}function iu(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ru(e[i],t,n);return r.join(``)}function au(e){return!!(e&&typeof e==`object`)}var ou=document.createElement(`i`);function su(e){let t=`&`+e+`;`;ou.innerHTML=t;let n=ou.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function cu(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 lu(e,t){return e.length>0?(cu(e,e.length,0,t),e):t}var uu={}.hasOwnProperty;function du(e){let t={},n=-1;for(;++n<e.length;)fu(t,e[n]);return t}function fu(e,t){let n;for(n in t){let r=(uu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){uu.call(r,a)||(r[a]=[]);let e=i[a];pu(r[a],Array.isArray(e)?e:e?[e]:[])}}}function pu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);cu(e,0,0,r)}function mu(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 hu(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var q=Cu(/[A-Za-z]/),J=Cu(/[\dA-Za-z]/),gu=Cu(/[#-'*+\--9=?A-Z^-~]/);function _u(e){return e!==null&&(e<32||e===127)}var vu=Cu(/\d/),yu=Cu(/[\dA-Fa-f]/),bu=Cu(/[!-/:-@[-`{-~]/);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 xu=Cu(/\p{P}|\p{S}/u),Su=Cu(/\s/);function Cu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function wu(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 Tu={tokenize:Eu};function Eu(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 Du={tokenize:ku},Ou={tokenize:Au};function ku(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 cu(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(Ou,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(Ou,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++;cu(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 Au(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 ju(e){if(e===null||X(e)||Su(e))return 1;if(xu(e))return 2}function Mu(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 Nu={name:`attention`,resolveAll:Pu,tokenize:Fu};function Pu(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};Iu(d,-c),Iu(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=lu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=lu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=lu(l,Mu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=lu(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=lu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,cu(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 Fu(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ju(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=ju(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 Iu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Lu={name:`autolink`,tokenize:Ru};function Ru(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||_u(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):gu(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 zu={partial:!0,tokenize:Bu};function Bu(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 Vu={continuation:{tokenize:Uu},exit:Wu,name:`blockQuote`,tokenize:Hu};function Hu(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 Uu(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(Vu,t,n)(r)}}function Wu(e){e.exit(`blockQuote`)}var Gu={name:`characterEscape`,tokenize:Ku};function Ku(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 bu(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var qu={name:`characterReference`,tokenize:Ju};function Ju(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=yu,u):(e.enter(`characterReferenceValue`),a=7,o=vu,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===J&&!su(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 Yu={partial:!0,tokenize:Qu},Xu={concrete:!0,name:`codeFenced`,tokenize:Zu};function Zu(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(Yu,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(Yu,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 $u={name:`codeIndented`,tokenize:td},ed={partial:!0,tokenize:nd};function td(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(ed,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 nd(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 rd={name:`codeText`,previous:ad,resolve:id,tokenize:od};function id(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 ad(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function od(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 sd=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&&cd(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),cd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),cd(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);cd(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);cd(this.left,t.reverse())}}};function cd(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 ld(e){let t={},n=-1,r,i,a,o,s,c,l,u=new sd(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,ud(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 cu(e,0,1/0,u.slice(0)),!l}function ud(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 dd={resolve:pd,tokenize:md},fd={partial:!0,tokenize:hd};function pd(e){return ld(e),e}function md(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(fd,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 hd(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 gd(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||_u(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||_u(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 _d(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 vd(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 yd(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 bd={name:`definition`,tokenize:Sd},xd={partial:!0,tokenize:Cd};function Sd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return _d.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=hu(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)?yd(e,l)(t):l(t)}function l(t){return gd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(xd,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 Cd(e,t,n){return r;function r(t){return X(t)?yd(e,i)(t):n(t)}function i(t){return vd(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 wd={name:`hardBreakEscape`,tokenize:Td};function Td(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 Ed={name:`headingAtx`,resolve:Dd,tokenize:Od};function Dd(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`},cu(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Od(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 kd=`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(`.`),Ad=[`pre`,`script`,`style`,`textarea`],jd={concrete:!0,name:`htmlFlow`,resolveTo:Pd,tokenize:Fd},Md={partial:!0,tokenize:Ld},Nd={partial:!0,tokenize:Id};function Pd(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 Fd(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&&Ad.includes(l)?(i=1,r.interrupt?t(s):D(s)):kd.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(Md,ue,te)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(Nd,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 Ad.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 Id(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 Ld(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(zu,t,n)}}var Rd={name:`htmlText`,tokenize:zd};function zd(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 Bd={name:`labelEnd`,resolveAll:Wd,resolveTo:Gd,tokenize:Kd},Vd={tokenize:qd},Hd={tokenize:Jd},Ud={tokenize:Yd};function Wd(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&&cu(e,0,e.length,n),e}function Gd(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=lu(s,e.slice(a+1,a+r+3)),s=lu(s,[[`enter`,u,t]]),s=lu(s,Mu(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=lu(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=lu(s,e.slice(o+1)),s=lu(s,[[`exit`,c,t]]),cu(e,a,e.length,s),e}function Kd(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(hu(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(Vd,u,o?u:d)(t):t===91?e.attempt(Hd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Ud,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function qd(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)?yd(e,a)(t):a(t)}function a(t){return t===41?u(t):gd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return X(t)?yd(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?vd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return X(t)?yd(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 Jd(e,t,n){let r=this;return i;function i(t){return _d.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(hu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Yd(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 Xd={name:`labelStartImage`,resolveAll:Bd.resolveAll,tokenize:Zd};function Zd(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:Bd.resolveAll,tokenize:$d};function $d(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 ef={name:`lineEnding`,tokenize:tf};function tf(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}var nf={name:`thematicBreak`,tokenize:rf};function rf(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:cf},exit:uf,name:`list`,tokenize:sf},af={partial:!0,tokenize:df},of={partial:!0,tokenize:lf};function sf(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:vu(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(nf,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 vu(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(zu,r.interrupt?n:u,e.attempt(af,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 cf(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(zu,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(of,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 lf(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 uf(e){e.exit(this.containerState.type)}function df(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 ff={name:`setextUnderline`,resolveTo:pf,tokenize:mf};function pf(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 mf(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 hf={tokenize:gf};function gf(e){let t=this,n=e.attempt(zu,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(dd,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 _f={resolveAll:xf()},vf=bf(`string`),yf=bf(`text`);function bf(e){return{resolveAll:xf(e===`text`?Sf: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 xf(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 Sf(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 Cf=s({attentionMarkers:()=>jf,contentInitial:()=>Tf,disable:()=>Mf,document:()=>wf,flow:()=>Df,flowInitial:()=>Ef,insideSpan:()=>Af,string:()=>Of,text:()=>kf}),wf={42:$,43:$,45:$,48:$,49:$,50:$,51:$,52:$,53:$,54:$,55:$,56:$,57:$,62:Vu},Tf={91:bd},Ef={[-2]:$u,[-1]:$u,32:$u},Df={35:Ed,42:nf,45:[ff,nf],60:jd,61:ff,95:nf,96:Xu,126:Xu},Of={38:qu,92:Gu},kf={[-5]:ef,[-4]:ef,[-3]:ef,33:Xd,38:qu,42:Nu,60:[Lu,Rd],91:Qd,92:[wd,Gu],93:Bd,95:Nu,96:rd},Af={null:[Nu,_f]},jf={null:[42,95]},Mf={null:[]};function Nf(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=lu(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Mu(a,l.events,l),l.events):[]}function f(e,t){return Ff(p(e),t)}function p(e){return Pf(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&&cu(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 Pf(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 Ff(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=`
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 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.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: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 R(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 R(r.element,n);if(r.type===`set`)return R(r.valueType,n);if(r.type===`lazy`)return R(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 R(r.innerType,n);if(r.type===`intersection`)return R(r.left,n)||R(r.right,n);if(r.type===`record`||r.type===`map`)return R(r.keyType,n)||R(r.valueType,n);if(r.type===`pipe`)return R(r.in,n)||R(r.out,n);if(r.type===`object`){for(let e in r.shape)if(R(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(R(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(R(e,n))return!0;return!!(r.rest&&R(r.rest,n))}return!1}var Za=(e,t={})=>n=>{let r=Ja({...n,processors:t});return L(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 L(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=sn(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=L(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]=L(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=L(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)=>L(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=L(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L(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=L(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;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fo=(e,t,n,r)=>{let i=e._zod.def;L(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;L(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;L(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=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;L(a,t,r);let o=t.seen.get(e);o.ref=a},go=(e,t,n,r)=>{let i=e._zod.def;L(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;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},vo=M(`ZodISODateTime`,(e,t)=>{ri.init(e,t),B.init(e,t)});function yo(e){return Ca(vo,e)}var bo=M(`ZodISODate`,(e,t)=>{ii.init(e,t),B.init(e,t)});function xo(e){return wa(bo,e)}var So=M(`ZodISOTime`,(e,t)=>{ai.init(e,t),B.init(e,t)});function Co(e){return Ta(So,e)}var wo=M(`ZodISODuration`,(e,t)=>{oi.init(e,t),B.init(e,t)});function To(e){return Ea(wo,e)}var Eo=(e,t)=>{Bn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Un(e,t)},flatten:{value:t=>Hn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,cn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,cn,2)}},isEmpty:{get(){return e.issues.length===0}}})};M(`ZodError`,Eo);var Do=M(`ZodError`,Eo,{Parent:Error}),Oo=Wn(Do),ko=Gn(Do),Ao=Kn(Do),jo=Jn(Do),Mo=Xn(Do),No=Zn(Do),Po=Qn(Do),Fo=$n(Do),Io=er(Do),Lo=tr(Do),Ro=nr(Do),zo=rr(Do),z=M(`ZodType`,(e,t)=>(F.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.check=(...n)=>e.clone(mn(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)=>wn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Oo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ao(e,t,n),e.parseAsync=async(t,n)=>ko(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>jo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Mo(e,t,n),e.decode=(t,n)=>No(e,t,n),e.encodeAsync=async(t,n)=>Po(e,t,n),e.decodeAsync=async(t,n)=>Fo(e,t,n),e.safeEncode=(t,n)=>Io(e,t,n),e.safeDecode=(t,n)=>Lo(e,t,n),e.safeEncodeAsync=async(t,n)=>Ro(e,t,n),e.safeDecodeAsync=async(t,n)=>zo(e,t,n),e.refine=(t,n)=>e.check(Us(t,n)),e.superRefine=t=>e.check(Ws(t)),e.overwrite=t=>e.check(Ra(t)),e.optional=()=>Ts(e),e.exactOptional=()=>Ds(e),e.nullable=()=>ks(e),e.nullish=()=>Ts(ks(e)),e.nonoptional=t=>Fs(e,t),e.array=()=>ps(e),e.or=t=>_s([e,t]),e.and=t=>ys(e,t),e.transform=t=>zs(e,Cs(t)),e.default=t=>js(e,t),e.prefault=t=>Ns(e,t),e.catch=t=>Ls(e,t),e.pipe=t=>zs(e,t),e.readonly=()=>Vs(e),e.describe=t=>{let n=e.clone();return $i.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return $i.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return $i.get(e);let n=e.clone();return $i.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Bo=M(`_ZodString`,(e,t)=>{Gr.init(e,t),z.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,e.regex=(...t)=>e.check(Ma(...t)),e.includes=(...t)=>e.check(Fa(...t)),e.startsWith=(...t)=>e.check(Ia(...t)),e.endsWith=(...t)=>e.check(La(...t)),e.min=(...t)=>e.check(Aa(...t)),e.max=(...t)=>e.check(ka(...t)),e.length=(...t)=>e.check(ja(...t)),e.nonempty=(...t)=>e.check(Aa(1,...t)),e.lowercase=t=>e.check(Na(t)),e.uppercase=t=>e.check(Pa(t)),e.trim=()=>e.check(Ba()),e.normalize=(...t)=>e.check(za(...t)),e.toLowerCase=()=>e.check(Va()),e.toUpperCase=()=>e.check(Ha()),e.slugify=()=>e.check(Ua())}),Vo=M(`ZodString`,(e,t)=>{Gr.init(e,t),Bo.init(e,t),e.email=t=>e.check(ta(Uo,t)),e.url=t=>e.check(sa(Ko,t)),e.jwt=t=>e.check(Sa(ss,t)),e.emoji=t=>e.check(ca(qo,t)),e.guid=t=>e.check(na(Wo,t)),e.uuid=t=>e.check(ra(Go,t)),e.uuidv4=t=>e.check(ia(Go,t)),e.uuidv6=t=>e.check(aa(Go,t)),e.uuidv7=t=>e.check(oa(Go,t)),e.nanoid=t=>e.check(la(Jo,t)),e.guid=t=>e.check(na(Wo,t)),e.cuid=t=>e.check(ua(Yo,t)),e.cuid2=t=>e.check(da(Xo,t)),e.ulid=t=>e.check(fa(Zo,t)),e.base64=t=>e.check(ya(is,t)),e.base64url=t=>e.check(ba(as,t)),e.xid=t=>e.check(pa(Qo,t)),e.ksuid=t=>e.check(ma($o,t)),e.ipv4=t=>e.check(ha(es,t)),e.ipv6=t=>e.check(ga(ts,t)),e.cidrv4=t=>e.check(_a(ns,t)),e.cidrv6=t=>e.check(va(rs,t)),e.e164=t=>e.check(xa(os,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 Ho(e){return ea(Vo,e)}var B=M(`ZodStringFormat`,(e,t)=>{I.init(e,t),Bo.init(e,t)}),Uo=M(`ZodEmail`,(e,t)=>{Jr.init(e,t),B.init(e,t)}),Wo=M(`ZodGUID`,(e,t)=>{Kr.init(e,t),B.init(e,t)}),Go=M(`ZodUUID`,(e,t)=>{qr.init(e,t),B.init(e,t)}),Ko=M(`ZodURL`,(e,t)=>{Yr.init(e,t),B.init(e,t)}),qo=M(`ZodEmoji`,(e,t)=>{Xr.init(e,t),B.init(e,t)}),Jo=M(`ZodNanoID`,(e,t)=>{Zr.init(e,t),B.init(e,t)}),Yo=M(`ZodCUID`,(e,t)=>{Qr.init(e,t),B.init(e,t)}),Xo=M(`ZodCUID2`,(e,t)=>{$r.init(e,t),B.init(e,t)}),Zo=M(`ZodULID`,(e,t)=>{ei.init(e,t),B.init(e,t)}),Qo=M(`ZodXID`,(e,t)=>{ti.init(e,t),B.init(e,t)}),$o=M(`ZodKSUID`,(e,t)=>{ni.init(e,t),B.init(e,t)}),es=M(`ZodIPv4`,(e,t)=>{si.init(e,t),B.init(e,t)}),ts=M(`ZodIPv6`,(e,t)=>{ci.init(e,t),B.init(e,t)}),ns=M(`ZodCIDRv4`,(e,t)=>{li.init(e,t),B.init(e,t)}),rs=M(`ZodCIDRv6`,(e,t)=>{ui.init(e,t),B.init(e,t)}),is=M(`ZodBase64`,(e,t)=>{fi.init(e,t),B.init(e,t)}),as=M(`ZodBase64URL`,(e,t)=>{mi.init(e,t),B.init(e,t)}),os=M(`ZodE164`,(e,t)=>{hi.init(e,t),B.init(e,t)}),ss=M(`ZodJWT`,(e,t)=>{_i.init(e,t),B.init(e,t)}),cs=M(`ZodUnknown`,(e,t)=>{vi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ls(){return Da(cs)}var us=M(`ZodNever`,(e,t)=>{yi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r)});function ds(e){return Oa(us,e)}var fs=M(`ZodArray`,(e,t)=>{xi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Aa(t,n)),e.nonempty=t=>e.check(Aa(1,t)),e.max=(t,n)=>e.check(ka(t,n)),e.length=(t,n)=>e.check(ja(t,n)),e.unwrap=()=>e.element});function ps(e,t){return Wa(fs,e,t)}var ms=M(`ZodObject`,(e,t)=>{Ei.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),N(e,`shape`,()=>t.shape),e.keyof=()=>xs(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ls()}),e.loose=()=>e.clone({...e._zod.def,catchall:ls()}),e.strict=()=>e.clone({...e._zod.def,catchall:ds()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>On(e,t),e.safeExtend=t=>kn(e,t),e.merge=t=>An(e,t),e.pick=t=>En(e,t),e.omit=t=>Dn(e,t),e.partial=(...t)=>jn(ws,e,t[0]),e.required=(...t)=>Mn(Ps,e,t[0])});function hs(e,t){return new ms({type:`object`,shape:e??{},...P(t)})}var gs=M(`ZodUnion`,(e,t)=>{Oi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.options=t.options});function _s(e,t){return new gs({type:`union`,options:e,...P(t)})}var vs=M(`ZodIntersection`,(e,t)=>{ki.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r)});function ys(e,t){return new vs({type:`intersection`,left:e,right:t})}var bs=M(`ZodEnum`,(e,t)=>{Mi.init(e,t),z.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 bs({...t,checks:[],...P(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 bs({...t,checks:[],...P(r),entries:i})}});function xs(e,t){return new bs({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var Ss=M(`ZodTransform`,(e,t)=>{Ni.init(e,t),z.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 rn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Rn(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(Rn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Cs(e){return new Ss({type:`transform`,transform:e})}var ws=M(`ZodOptional`,(e,t)=>{Fi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ts(e){return new ws({type:`optional`,innerType:e})}var Es=M(`ZodExactOptional`,(e,t)=>{Ii.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ds(e){return new Es({type:`optional`,innerType:e})}var Os=M(`ZodNullable`,(e,t)=>{Li.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ks(e){return new Os({type:`nullable`,innerType:e})}var As=M(`ZodDefault`,(e,t)=>{Ri.init(e,t),z.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 js(e,t){return new As({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xn(t)}})}var Ms=M(`ZodPrefault`,(e,t)=>{Bi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ns(e,t){return new Ms({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xn(t)}})}var Ps=M(`ZodNonOptional`,(e,t)=>{Vi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fs(e,t){return new Ps({type:`nonoptional`,innerType:e,...P(t)})}var Is=M(`ZodCatch`,(e,t)=>{Ui.init(e,t),z.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 Ls(e,t){return new Is({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Rs=M(`ZodPipe`,(e,t)=>{Wi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.in=t.in,e.out=t.out});function zs(e,t){return new Rs({type:`pipe`,in:e,out:t})}var Bs=M(`ZodReadonly`,(e,t)=>{Ki.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vs(e){return new Bs({type:`readonly`,innerType:e})}var Hs=M(`ZodCustom`,(e,t)=>{Ji.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r)});function Us(e,t={}){return Ga(Hs,e,t)}function Ws(e){return Ka(e)}hs({chartConfig:Ho().describe(`Erica chart config syntax.`)});var Gs=hs({compiled_chart:hs({path:Ho().describe(`Path to the chart JSON file.`)}).describe(`Compiled chart`)});hs({title:Ho().describe(`Title of the report.`),reportContent:Ho().describe(`Markdown content of the report.`)});var Ks=hs({compiled_report:hs({title:Ho().describe(`Title of the report.`),path:Ho().describe(`Path to the compiled report.`)})}),qs=hs({filled_template:hs({template_name:Ho(),output_filename:Ho(),s3_path:Ho()})}),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)($t)?.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 V=class{constructor(e,t){this.attribute=t,this.property=e}};V.prototype.attribute=``,V.prototype.booleanish=!1,V.prototype.boolean=!1,V.prototype.commaOrSpaceSeparated=!1,V.prototype.commaSeparated=!1,V.prototype.defined=!1,V.prototype.mustUseProperty=!1,V.prototype.number=!1,V.prototype.overloadedBoolean=!1,V.prototype.property=``,V.prototype.spaceSeparated=!1,V.prototype.space=void 0;var zc=s({boolean:()=>H,booleanish:()=>U,commaOrSpaceSeparated:()=>Uc,commaSeparated:()=>Hc,number:()=>W,overloadedBoolean:()=>Vc,spaceSeparated:()=>G}),Bc=0,H=Wc(),U=Wc(),Vc=Wc(),W=Wc(),G=Wc(),Hc=Wc(),Uc=Wc();function Wc(){return 2**++Bc}var Gc=Object.keys(zc),Kc=class extends V{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:U,ariaAutoComplete:null,ariaBusy:U,ariaChecked:U,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:G,ariaCurrent:null,ariaDescribedBy:G,ariaDetails:null,ariaDisabled:U,ariaDropEffect:G,ariaErrorMessage:null,ariaExpanded:U,ariaFlowTo:G,ariaGrabbed:U,ariaHasPopup:null,ariaHidden:U,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:G,ariaLevel:W,ariaLive:null,ariaModal:U,ariaMultiLine:U,ariaMultiSelectable:U,ariaOrientation:null,ariaOwns:G,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:U,ariaReadOnly:U,ariaRelevant:null,ariaRequired:U,ariaRoleDescription:G,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:U,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,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:G,accessKey:G,action:null,allow:null,allowFullScreen:H,allowPaymentRequest:H,allowUserMedia:H,alpha:H,alt:null,as:null,async:H,autoCapitalize:null,autoComplete:G,autoFocus:H,autoPlay:H,blocking:G,capture:null,charSet:null,checked:H,cite:null,className:G,closedBy:null,colorSpace:null,cols:W,colSpan:W,command:null,commandFor:null,content:null,contentEditable:U,controls:H,controlsList:G,coords:W|Hc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:H,defer:H,dir:null,dirName:null,disabled:H,download:Vc,draggable:U,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:H,formTarget:null,headers:G,height:W,hidden:Vc,high:W,href:null,hrefLang:null,htmlFor:G,httpEquiv:G,id:null,imageSizes:null,imageSrcSet:null,inert:H,inputMode:null,integrity:null,is:null,isMap:H,itemId:null,itemProp:G,itemRef:G,itemScope:H,itemType:G,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:H,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:H,muted:H,name:null,nonce:null,noModule:H,noValidate:H,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:H,optimum:W,pattern:null,ping:G,placeholder:null,playsInline:H,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:H,referrerPolicy:null,rel:G,required:H,reversed:H,rows:W,rowSpan:W,sandbox:G,scope:null,scoped:H,seamless:H,selected:H,shadowRootClonable:H,shadowRootCustomElementRegistry:H,shadowRootDelegatesFocus:H,shadowRootMode:null,shadowRootSerializable:H,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:U,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:H,useMap:null,value:U,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:G,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:H,declare:H,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:H,noHref:H,noShade:H,noWrap:H,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:U,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:H,disablePictureInPicture:H,disableRemotePlayback:H,exportParts:Hc,part:G,prefix:null,property:null,results:W,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:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:G,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:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:H,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,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:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:Uc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,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:W,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:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:G,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,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:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:Uc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Uc,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,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:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,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=V;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=`
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 D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}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 K=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}};K.prototype.file=``,K.prototype.name=``,K.prototype.reason=``,K.prototype.message=``,K.prototype.stack=``,K.prototype.column=void 0,K.prototype.line=void 0,K.prototype.ancestors=void 0,K.prototype.cause=void 0,K.prototype.fatal=void 0,K.prototype.place=void 0,K.prototype.ruleId=void 0,K.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`]),jl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ml(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=Ul(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=Hl(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=Nl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Nl(e,t,n){if(t.type===`element`)return Pl(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Fl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ll(e,t,n);if(t.type===`mdxjsEsm`)return Il(e,t);if(t.type===`root`)return Rl(e,t,n);if(t.type===`text`)return zl(e,t)}function Pl(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=Yl(e,t.tagName,!1),o=Wl(e,t),s=Kl(e,t);return kl.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Pc(e):!0})),Bl(e,o,a,t),Vl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Fl(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)}Xl(e,t.position)}function Il(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xl(e,t.position)}function Ll(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:Yl(e,t.name,!0),o=Gl(e,t),s=Kl(e,t);return Bl(e,o,a,t),Vl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Rl(e,t,n){let r={};return Vl(r,Kl(e,t)),e.create(t,e.Fragment,r,n)}function zl(e,t){return t.value}function Bl(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vl(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Hl(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 Ul(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 Wl(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&El.call(t.properties,i)){let a=ql(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 Gl(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 Xl(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 Xl(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Kl(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=Nl(e,a,o);s!==void 0&&n.push(s)}return n}function ql(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:Jl(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Zl(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?rl[r.property]||r.property:r.attribute,n]}}function Jl(e,t){try{return(0,Tl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new K("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=jl+`#cannot-parse-style-attribute`,r}}function Yl(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);Xl(e)}function Xl(e,t){let n=new K("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=jl+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Zl(e){let t={},n;for(n in e)El.call(e,n)&&(t[Ql(n)]=e[n]);return t}function Ql(e){let t=e.replace(Ol,$l);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function $l(e){return`-`+e.toLowerCase()}var eu={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`]},tu={};function nu(e,t){let n=t||tu;return ru(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function ru(e,t,n){if(au(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 iu(e.children,t,n)}return Array.isArray(e)?iu(e,t,n):``}function iu(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ru(e[i],t,n);return r.join(``)}function au(e){return!!(e&&typeof e==`object`)}var ou=document.createElement(`i`);function su(e){let t=`&`+e+`;`;ou.innerHTML=t;let n=ou.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function cu(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 lu(e,t){return e.length>0?(cu(e,e.length,0,t),e):t}var uu={}.hasOwnProperty;function du(e){let t={},n=-1;for(;++n<e.length;)fu(t,e[n]);return t}function fu(e,t){let n;for(n in t){let r=(uu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){uu.call(r,a)||(r[a]=[]);let e=i[a];pu(r[a],Array.isArray(e)?e:e?[e]:[])}}}function pu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);cu(e,0,0,r)}function mu(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 hu(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var q=Cu(/[A-Za-z]/),J=Cu(/[\dA-Za-z]/),gu=Cu(/[#-'*+\--9=?A-Z^-~]/);function _u(e){return e!==null&&(e<32||e===127)}var vu=Cu(/\d/),yu=Cu(/[\dA-Fa-f]/),bu=Cu(/[!-/:-@[-`{-~]/);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 xu=Cu(/\p{P}|\p{S}/u),Su=Cu(/\s/);function Cu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function wu(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 Tu={tokenize:Eu};function Eu(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 Du={tokenize:ku},Ou={tokenize:Au};function ku(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 cu(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(Ou,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(Ou,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++;cu(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 Au(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 ju(e){if(e===null||X(e)||Su(e))return 1;if(xu(e))return 2}function Mu(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 Nu={name:`attention`,resolveAll:Pu,tokenize:Fu};function Pu(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};Iu(d,-c),Iu(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=lu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=lu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=lu(l,Mu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=lu(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=lu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,cu(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 Fu(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ju(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=ju(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 Iu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Lu={name:`autolink`,tokenize:Ru};function Ru(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||_u(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):gu(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 zu={partial:!0,tokenize:Bu};function Bu(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 Vu={continuation:{tokenize:Uu},exit:Wu,name:`blockQuote`,tokenize:Hu};function Hu(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 Uu(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(Vu,t,n)(r)}}function Wu(e){e.exit(`blockQuote`)}var Gu={name:`characterEscape`,tokenize:Ku};function Ku(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 bu(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var qu={name:`characterReference`,tokenize:Ju};function Ju(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=yu,u):(e.enter(`characterReferenceValue`),a=7,o=vu,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===J&&!su(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 Yu={partial:!0,tokenize:Qu},Xu={concrete:!0,name:`codeFenced`,tokenize:Zu};function Zu(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(Yu,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(Yu,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 $u={name:`codeIndented`,tokenize:td},ed={partial:!0,tokenize:nd};function td(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(ed,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 nd(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 rd={name:`codeText`,previous:ad,resolve:id,tokenize:od};function id(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 ad(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function od(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 sd=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&&cd(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),cd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),cd(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);cd(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);cd(this.left,t.reverse())}}};function cd(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 ld(e){let t={},n=-1,r,i,a,o,s,c,l,u=new sd(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,ud(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 cu(e,0,1/0,u.slice(0)),!l}function ud(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 dd={resolve:pd,tokenize:md},fd={partial:!0,tokenize:hd};function pd(e){return ld(e),e}function md(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(fd,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 hd(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 gd(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||_u(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||_u(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 _d(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 vd(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 yd(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 bd={name:`definition`,tokenize:Sd},xd={partial:!0,tokenize:Cd};function Sd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return _d.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=hu(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)?yd(e,l)(t):l(t)}function l(t){return gd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(xd,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 Cd(e,t,n){return r;function r(t){return X(t)?yd(e,i)(t):n(t)}function i(t){return vd(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 wd={name:`hardBreakEscape`,tokenize:Td};function Td(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 Ed={name:`headingAtx`,resolve:Dd,tokenize:Od};function Dd(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`},cu(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Od(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 kd=`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(`.`),Ad=[`pre`,`script`,`style`,`textarea`],jd={concrete:!0,name:`htmlFlow`,resolveTo:Pd,tokenize:Fd},Md={partial:!0,tokenize:Ld},Nd={partial:!0,tokenize:Id};function Pd(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 Fd(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:se):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:se):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:se):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O: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&&Ad.includes(l)?(i=1,r.interrupt?t(s):O(s)):kd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(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:O):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),D):n(t)}function D(t){return t===null||Y(t)?O(t):Z(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),re):t===60&&i===1?(e.consume(t),ie):t===62&&i===4?(e.consume(t),ce):t===63&&i===3?(e.consume(t),se):t===93&&i===5?(e.consume(t),oe):Y(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Md,le,ee)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(Nd,te,le)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||Y(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function re(t){return t===45?(e.consume(t),se):O(t)}function ie(t){return t===47?(e.consume(t),o=``,ae):O(t)}function ae(t){if(t===62){let n=o.toLowerCase();return Ad.includes(n)?(e.consume(t),ce):O(t)}return q(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ae):O(t)}function oe(t){return t===93?(e.consume(t),se):O(t)}function se(t){return t===62?(e.consume(t),ce):t===45&&i===2?(e.consume(t),se):O(t)}function ce(t){return t===null||Y(t)?(e.exit(`htmlFlowData`),le(t)):(e.consume(t),ce)}function le(n){return e.exit(`htmlFlow`),t(n)}}function Id(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 Ld(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(zu,t,n)}}var Rd={name:`htmlText`,tokenize:zd};function zd(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,ie(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?re(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,ie(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?re(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?re(t):Y(t)?(o=v,ie(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Y(t)?(o=y,ie(t)):(e.consume(t),y)}function b(e){return e===62?re(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,ie(t)):Z(t)?(e.consume(t),C):re(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),re):t===58||t===95||q(t)?(e.consume(t),E):Y(t)?(o=T,ie(t)):Z(t)?(e.consume(t),T):re(t)}function E(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Y(t)?(o=D,ie(t)):Z(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):Y(t)?(o=O,ie(t)):Z(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):Y(t)?(o=ee,ie(t)):(e.consume(t),ee)}function te(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),te)}function ne(e){return e===47||e===62||X(e)?T(e):n(e)}function re(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ie(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ae}function ae(t){return Z(t)?Q(e,oe,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):oe(t)}function oe(t){return e.enter(`htmlTextData`),o(t)}}var Bd={name:`labelEnd`,resolveAll:Wd,resolveTo:Gd,tokenize:Kd},Vd={tokenize:qd},Hd={tokenize:Jd},Ud={tokenize:Yd};function Wd(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&&cu(e,0,e.length,n),e}function Gd(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=lu(s,e.slice(a+1,a+r+3)),s=lu(s,[[`enter`,u,t]]),s=lu(s,Mu(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=lu(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=lu(s,e.slice(o+1)),s=lu(s,[[`exit`,c,t]]),cu(e,a,e.length,s),e}function Kd(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(hu(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(Vd,u,o?u:d)(t):t===91?e.attempt(Hd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Ud,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function qd(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)?yd(e,a)(t):a(t)}function a(t){return t===41?u(t):gd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return X(t)?yd(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?vd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return X(t)?yd(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 Jd(e,t,n){let r=this;return i;function i(t){return _d.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(hu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Yd(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 Xd={name:`labelStartImage`,resolveAll:Bd.resolveAll,tokenize:Zd};function Zd(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:Bd.resolveAll,tokenize:$d};function $d(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 ef={name:`lineEnding`,tokenize:tf};function tf(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}var nf={name:`thematicBreak`,tokenize:rf};function rf(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:cf},exit:uf,name:`list`,tokenize:sf},af={partial:!0,tokenize:df},of={partial:!0,tokenize:lf};function sf(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:vu(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(nf,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 vu(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(zu,r.interrupt?n:u,e.attempt(af,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 cf(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(zu,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(of,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 lf(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 uf(e){e.exit(this.containerState.type)}function df(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 ff={name:`setextUnderline`,resolveTo:pf,tokenize:mf};function pf(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 mf(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 hf={tokenize:gf};function gf(e){let t=this,n=e.attempt(zu,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(dd,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 _f={resolveAll:xf()},vf=bf(`string`),yf=bf(`text`);function bf(e){return{resolveAll:xf(e===`text`?Sf: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 xf(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 Sf(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 Cf=s({attentionMarkers:()=>jf,contentInitial:()=>Tf,disable:()=>Mf,document:()=>wf,flow:()=>Df,flowInitial:()=>Ef,insideSpan:()=>Af,string:()=>Of,text:()=>kf}),wf={42:$,43:$,45:$,48:$,49:$,50:$,51:$,52:$,53:$,54:$,55:$,56:$,57:$,62:Vu},Tf={91:bd},Ef={[-2]:$u,[-1]:$u,32:$u},Df={35:Ed,42:nf,45:[ff,nf],60:jd,61:ff,95:nf,96:Xu,126:Xu},Of={38:qu,92:Gu},kf={[-5]:ef,[-4]:ef,[-3]:ef,33:Xd,38:qu,42:Nu,60:[Lu,Rd],91:Qd,92:[wd,Gu],93:Bd,95:Nu,96:rd},Af={null:[Nu,_f]},jf={null:[42,95]},Mf={null:[]};function Nf(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=lu(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Mu(a,l.events,l),l.events):[]}function f(e,t){return Ff(p(e),t)}function p(e){return Pf(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&&cu(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 Pf(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 Ff(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
46
  `;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 If(e){let t={constructs:du([Cf,...(e||{}).extensions||[]]),content:n(Tu),defined:[],document:n(Du),flow:n(hf),lazy:{},string:n(vf),text:n(yf)};return t;function n(e){return n;function n(n){return Nf(t,e,n)}}}function Lf(e){for(;!ld(e););return e}var Rf=/[\0\t\n\r]/g;function zf(){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(Rf.lastIndex=u,c=Rf.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 Bf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Vf(e){return e.replace(Bf,Hf)}function Hf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return mu(n.slice(t?2:1),t?16:10)}return su(n)||e}var Uf={}.hasOwnProperty;function Wf(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Gf(n)(Lf(If(n).document().write(zf()(e,t,!0))))}function Gf(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Ee),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(O),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(Se),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(Ee),listItem:a(De),listItemValue:f,listOrdered:a(k,d),listUnordered:a(k),paragraph:a(Oe),reference:de,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(O),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()}};qf(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]];Uf.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]||Yf).call(a,void 0,e[0])}for(r.position={start:Kf(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Kf(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:Kf(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]||Yf).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=Kf(e.end)}function u(){return nu(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=hu(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:Kf(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=Kf(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=Kf(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=Vf(t),n.identifier=hu(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=hu(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=mu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=su(t);let i=this.stack[this.stack.length-1];i.value+=r}function he(e){let t=this.stack.pop();t.position.end=Kf(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 Se(){return{type:`emphasis`,children:[]}}function O(){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 Ee(){return{type:`link`,title:null,url:``,children:[]}}function k(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 Kf(e){return{line:e.line,column:e.column,offset:e.offset}}function qf(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?qf(e,r):Jf(e,r)}}function Jf(e,t){let n;for(n in t)if(Uf.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 Yf(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 Xf(e){let t=this;t.parser=n;function n(n){return Wf(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Zf(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:`
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 If(e){let t={constructs:du([Cf,...(e||{}).extensions||[]]),content:n(Tu),defined:[],document:n(Du),flow:n(hf),lazy:{},string:n(vf),text:n(yf)};return t;function n(e){return n;function n(n){return Nf(t,e,n)}}}function Lf(e){for(;!ld(e););return e}var Rf=/[\0\t\n\r]/g;function zf(){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(Rf.lastIndex=u,c=Rf.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 Bf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Vf(e){return e.replace(Bf,Hf)}function Hf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return mu(n.slice(t?2:1),t?16:10)}return su(n)||e}var Uf={}.hasOwnProperty;function Wf(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Gf(n)(Lf(If(n).document().write(zf()(e,t,!0))))}function Gf(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Te),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(k),blockQuote:a(_e),characterEscape:T,characterReference:T,codeFenced:a(ve),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ve,o),codeText:a(ye,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(be),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(xe),hardBreakEscape:a(Se),hardBreakTrailing:a(Se),htmlFlow:a(Ce,o),htmlFlowData:T,htmlText:a(Ce,o),htmlTextData:T,image:a(we),label:o,link:a(Te),listItem:a(Ee),listItemValue:f,listOrdered:a(A,d),listUnordered:a(A),paragraph:a(De),reference:ue,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(k),strong:a(Oe),thematicBreak:a(Ae)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ge,autolinkProtocol:he,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:pe,characterReference:me,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ne),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(ee),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(ie),label:oe,labelText:ae,lineEnding:D,link:c(re),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:de,resourceDestinationString:se,resourceTitleString:ce,resource:le,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};qf(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]];Uf.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]||Yf).call(a,void 0,e[0])}for(r.position={start:Kf(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Kf(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:Kf(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]||Yf).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=Kf(e.end)}function u(){return nu(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=hu(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=ke(),n.position={start:Kf(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=Kf(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Kf(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 O(){this.data.atHardBreak=!0}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}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.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 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(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Vf(t),n.identifier=hu(t).toLowerCase()}function oe(){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 se(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function le(){this.data.inReference=void 0}function ue(){this.data.referenceType=`collapsed`}function de(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=hu(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function fe(e){this.data.characterReferenceType=e.type}function pe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=mu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=su(t);let i=this.stack[this.stack.length-1];i.value+=r}function me(e){let t=this.stack.pop();t.position.end=Kf(e.end)}function he(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ge(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function _e(){return{type:`blockquote`,children:[]}}function ve(){return{type:`code`,lang:null,meta:null,value:``}}function ye(){return{type:`inlineCode`,value:``}}function be(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function xe(){return{type:`emphasis`,children:[]}}function k(){return{type:`heading`,depth:0,children:[]}}function Se(){return{type:`break`}}function Ce(){return{type:`html`,value:``}}function we(){return{type:`image`,title:null,url:``,alt:null}}function Te(){return{type:`link`,title:null,url:``,children:[]}}function A(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ee(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function De(){return{type:`paragraph`,children:[]}}function Oe(){return{type:`strong`,children:[]}}function ke(){return{type:`text`,value:``}}function Ae(){return{type:`thematicBreak`}}}function Kf(e){return{line:e.line,column:e.column,offset:e.offset}}function qf(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?qf(e,r):Jf(e,r)}}function Jf(e,t){let n;for(n in t)if(Uf.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 Yf(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 Xf(e){let t=this;t.parser=n;function n(n){return Wf(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Zf(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
48
  `}]}function $f(e,t){let n=t.value?t.value+`
49
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 ep(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tp(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function np(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=wu(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 rp(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 ip(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ap(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 op(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ap(e,t);let i={src:wu(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 sp(e,t){let n={src:wu(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 cp(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 lp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ap(e,t);let i={href:wu(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 up(e,t){let n={href:wu(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 dp(e,t,n){let r=e.all(t),i=n?fp(n):pp(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
50
  `}),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 fp(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=pp(n[r])}return t}function pp(e){return e.spread??e.children.length>1}function mp(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 hp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function _p(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vp(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 yp(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 bp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var xp=9,Sp=32;function Cp(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(wp(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(wp(t.slice(i),i>0,!1)),a.join(``)}function wp(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===xp||t===Sp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===xp||t===Sp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Tp(e,t){let n={type:`text`,value:Cp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Ep(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Dp={blockquote:Zf,break:Qf,code:$f,delete:ep,emphasis:tp,footnoteReference:np,heading:rp,html:ip,imageReference:op,image:sp,inlineCode:cp,linkReference:lp,link:up,listItem:dp,list:mp,paragraph:hp,root:gp,strong:_p,table:vp,tableCell:bp,tableRow:yp,text:Tp,thematicBreak:Ep,toml:Op,yaml:Op,definition:Op,footnoteDefinition:Op};function Op(){}var kp=typeof self==`object`?self:globalThis,Ap=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new kp[e](t)},jp=(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(typeof kp[e]==`function`?Ap(e,t):Error(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(Ap(a,o),i)};return r},Mp=e=>jp(new Map,e)(0),Np=``,{toString:Pp}={},{keys:Fp}=Object,Ip=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Pp.call(e).slice(8,-1);switch(n){case`Array`:return[1,Np];case`Object`:return[2,Np];case`Date`:return[3,Np];case`RegExp`:return[4,Np];case`Map`:return[5,Np];case`Set`:return[6,Np];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},Lp=([e,t])=>e===0&&(t===`function`||t===`symbol`),Rp=(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]=Ip(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 Fp(r))(e||!Lp(Ip(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?Np: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||!(Lp(Ip(n))||Lp(Ip(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Lp(Ip(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},zp=(e,{json:t,lossy:n}={})=>{let r=[];return Rp(!(t||n),!!t,new Map,r)(e),r},Bp=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Mp(zp(e,t)):structuredClone(e):(e,t)=>Mp(zp(e,t));function Vp(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 Hp(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Up(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Vp,r=e.options.footnoteBackLabel||Hp,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=wu(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:{...Bp(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
51
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function fp(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=pp(n[r])}return t}function pp(e){return e.spread??e.children.length>1}function mp(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 hp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function _p(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vp(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 yp(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 bp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var xp=9,Sp=32;function Cp(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(wp(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(wp(t.slice(i),i>0,!1)),a.join(``)}function wp(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===xp||t===Sp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===xp||t===Sp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Tp(e,t){let n={type:`text`,value:Cp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Ep(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Dp={blockquote:Zf,break:Qf,code:$f,delete:ep,emphasis:tp,footnoteReference:np,heading:rp,html:ip,imageReference:op,image:sp,inlineCode:cp,linkReference:lp,link:up,listItem:dp,list:mp,paragraph:hp,root:gp,strong:_p,table:vp,tableCell:bp,tableRow:yp,text:Tp,thematicBreak:Ep,toml:Op,yaml:Op,definition:Op,footnoteDefinition:Op};function Op(){}var kp=typeof self==`object`?self:globalThis,Ap=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new kp[e](t)},jp=(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(Ap(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(Ap(a,o),i)};return r},Mp=e=>jp(new Map,e)(0),Np=``,{toString:Pp}={},{keys:Fp}=Object,Ip=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Pp.call(e).slice(8,-1);switch(n){case`Array`:return[1,Np];case`Object`:return[2,Np];case`Date`:return[3,Np];case`RegExp`:return[4,Np];case`Map`:return[5,Np];case`Set`:return[6,Np];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Lp=([e,t])=>e===0&&(t===`function`||t===`symbol`),Rp=(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]=Ip(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 Fp(r))(e||!Lp(Ip(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||!(Lp(Ip(n))||Lp(Ip(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Lp(Ip(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},zp=(e,{json:t,lossy:n}={})=>{let r=[];return Rp(!(t||n),!!t,new Map,r)(e),r},Bp=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Mp(zp(e,t)):structuredClone(e):(e,t)=>Mp(zp(e,t));function Vp(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 Hp(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Up(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Vp,r=e.options.footnoteBackLabel||Hp,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=wu(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:{...Bp(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
52
52
  `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
53
53
  `}]}}var Wp=(function(e){if(e==null)return Yp;if(typeof e==`function`)return Jp(e);if(typeof e==`object`)return Array.isArray(e)?Gp(e):Kp(e);if(typeof e==`string`)return qp(e);throw Error(`Expected function, string, or object as test`)});function Gp(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Wp(e[n]);return Jp(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Kp(e){let t=e;return Jp(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function qp(e){return Jp(t);function t(t){return t&&t.type===e}}function Jp(e){return t;function t(t,n,r){return!!(Xp(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Yp(){return!0}function Xp(e){return typeof e==`object`&&!!e&&`type`in e}function Zp(e){return e}var Qp=[];function $p(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Wp(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 (`+Zp(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Qp,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=em(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 em(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Qp:[e]}function tm(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),$p(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 nm={}.hasOwnProperty,rm={};function im(e,t){let n=t||rm,r=new Map,i=new Map,a={all:s,applyData:om,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Dp,...n.handlers},one:o,options:n,patch:am,wrap:cm};return tm(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(nm.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=Bp(n);return r.children=a.all(e),r}return Bp(e)}return(a.options.unknownHandler||sm)(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=lm(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=lm(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function am(e,t){e.position&&(t.position=bl(e))}function om(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,Bp(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function sm(e,t){let n=t.data||{},r=`value`in t&&!(nm.call(n,`hProperties`)||nm.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 cm(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
54
54
  `});++r<e.length;)r&&n.push({type:`text`,value:`
@@ -73,6 +73,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
73
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=Kv(e),s=n.enter(e.type),c=a.move(o+(e.name||``)),l;if(e.type===`containerDirective`){let t=(e.children||[])[0];l=Gv(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;Gv(t)&&(r=Object.assign({},e,{children:e.children.slice(1)})),r&&r.children&&r.children.length>0&&(c+=a.move(`
74
74
  `),c+=a.move(n.containerFlow(r,a.current()))),c+=a.move(`
75
75
  `+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(wv.call(r,l)&&r[l]!==void 0&&r[l]!==null){let u=String(r[l]);if(l===`id`)c=t.preferShortcut!==!1&&Ev.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&&Ev.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&&Dv.test(n))return e+`=`+n;let a=t.quote||i.options.quote||`"`,o=a===`"`?`'`:`"`,s=t.quoteSmart&&ih(n,a)>ih(n,o)?o:a,c=r.type===`textDirective`?[s]:[s,`
76
- `,`\r`];return e+`=`+s+Cv(n,{subset:c})+s}}function Av(e){Nv.call(this,`containerDirective`,e)}function jv(e){Nv.call(this,`leafDirective`,e)}function Mv(e){Nv.call(this,`textDirective`,e)}function Nv(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function Pv(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function Fv(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function Iv(e){this.exit(e)}function Lv(){this.data.directiveAttributes=[],this.buffer()}function Rv(e){this.data.directiveAttributes.push([`id`,dv(this.sliceSerialize(e),{attribute:!0})])}function zv(e){this.data.directiveAttributes.push([`class`,dv(this.sliceSerialize(e),{attribute:!0})])}function Bv(e){let t=this.data.directiveAttributes;t[t.length-1][1]=dv(this.sliceSerialize(e),{attribute:!0})}function Vv(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Hv(){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 Uv(e){this.exit(e)}function Wv(){return`:`}function Gv(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function Kv(e){let t=0;return e.type===`containerDirective`?($p(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 qv(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)?yd(e,v)(t):t===null||Y(t)||Su(t)||xu(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)||Su(t)||xu(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Z(t)?Q(e,C,`whitespace`)(t):!m&&X(t)?yd(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)?yd(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):yd(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 Jv(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 Yv(e,t,n,r){let i=this;return a;function a(t){return t===null||Y(t)||xu(t)||Su(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Y(a)||Su(a)||xu(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var Xv={tokenize:ey,concrete:!0},Zv={tokenize:ty,partial:!0},Qv={tokenize:ny,partial:!0},$v={tokenize:ry,partial:!0};function ey(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`),Yv.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(Zv,d,d)(t):d(t)}function d(t){return t===123?e.attempt(Qv,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($v,m,C)(i):n(i)}function m(t){return t===null?C(t):Y(t)?e.check($v,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($v,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($v,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 ty(e,t,n){return Jv(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function ny(e,t,n){return qv(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function ry(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 iy={tokenize:sy},ay={tokenize:cy,partial:!0},oy={tokenize:ly,partial:!0};function sy(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`),Yv.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(ay,s,s)(t):s(t)}function s(t){return t===123?e.attempt(oy,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 cy(e,t,n){return Jv(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function ly(e,t,n){return qv(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var uy={tokenize:my,previous:py},dy={tokenize:hy,partial:!0},fy={tokenize:gy,partial:!0};function py(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function my(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),Yv.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(dy,o,o)(t):o(t)}function o(t){return t===123?e.attempt(fy,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function hy(e,t,n){return Jv(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function gy(e,t,n){return qv(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function _y(){return{text:{58:uy},flow:{58:[Xv,iy]}}}function vy(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(_y()),n.push(Ov()),r.push(kv())}function yy({markdown:e}){return(0,f.jsx)(`div`,{className:`report-artifact`,children:(0,f.jsx)($m,{remarkPlugins:[vy,()=>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)},rv],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)(Cc,{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 by({title:e,reportContent:t}){let n=Oc(),r=()=>{n.setTitle(e),n.setContent((0,f.jsx)(yy,{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 xy({path:e,title:t}){let n=e.split(`/`),r=n[5],i=n[6],{data:a,isLoading:o}=Rt({queryKey:[`artifact`,r,e],queryFn:()=>Ys.get(r,i),enabled:!!r&&!!e});return o?(0,f.jsx)(`div`,{className:`report-loader-loading`,children:`loading report...`}):a?(0,f.jsx)(by,{title:t,reportContent:a}):(0,f.jsx)(`div`,{className:`report-loader-no-data`,children:`No report data available`})}function Sy({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`})]})]})}var Cy=e=>e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e);function wy({rows:e}){let t=e.length>0?Object.keys(e[0]):[];return e.length===0?(0,f.jsx)(`span`,{className:`template-approval-empty`,children:`[]`}):(0,f.jsxs)(`div`,{className:`template-approval-table-wrapper`,children:[(0,f.jsxs)(`table`,{className:`template-approval-table`,children:[(0,f.jsx)(`thead`,{className:`template-approval-thead`,children:(0,f.jsx)(`tr`,{children:t.map(e=>(0,f.jsx)(`th`,{className:`template-approval-th`,children:e},e))})}),(0,f.jsx)(`tbody`,{children:e.slice(0,5).map((e,n)=>(0,f.jsx)(`tr`,{className:`template-approval-tr`,children:t.map(t=>(0,f.jsx)(`td`,{className:`template-approval-td`,children:Cy(e[t])},t))},n))})]}),e.length>5&&(0,f.jsxs)(`p`,{className:`template-approval-hidden-count`,children:[`... and `,e.length-5,` more row`,e.length-5==1?``:`s`]})]})}function Ty({message:e,templateName:t,outputFilename:n,data:r,onApprove:i,onReject:a}){let[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(``),[d,p]=(0,u.useState)(null),m=()=>{p(`approved`),i()},h=()=>{if(!o){s(!0);return}p(`rejected`),a(c.trim()||void 0)},g=Object.entries(r);return(0,f.jsxs)(`div`,{className:`template-approval-card`,children:[(0,f.jsxs)(`div`,{className:`template-approval-header`,children:[(0,f.jsx)(`div`,{className:`template-approval-icon`,"aria-hidden":`true`,children:`📄`}),(0,f.jsxs)(`div`,{className:`template-approval-heading`,children:[(0,f.jsx)(`h3`,{className:`template-approval-title`,children:`Fill Template`}),t&&(0,f.jsx)(`p`,{className:`template-approval-meta`,children:t})]})]}),(0,f.jsx)(`p`,{className:`template-approval-message`,children:e}),n&&(0,f.jsxs)(`p`,{className:`template-approval-output`,children:[`Output: `,(0,f.jsx)(`strong`,{children:n})]}),g.length>0&&(0,f.jsx)(`div`,{className:`template-approval-data`,children:g.map(([e,t])=>{let n=Array.isArray(t)&&t.length>0&&typeof t[0]==`object`&&t[0]!==null;return(0,f.jsxs)(`div`,{className:`template-approval-field`,children:[(0,f.jsx)(`span`,{className:`template-approval-field-key`,children:e}),(0,f.jsx)(`div`,{className:`template-approval-field-value`,children:n?(0,f.jsx)(wy,{rows:t}):Cy(t)})]},e)})}),o&&!d&&(0,f.jsxs)(`div`,{className:`template-approval-reject-section`,children:[(0,f.jsx)(`label`,{className:`template-approval-reject-label`,children:`Rejection reason (optional):`}),(0,f.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),className:`template-approval-reject-input`,placeholder:`Enter reason...`})]}),d?(0,f.jsx)(`div`,{className:`template-approval-resolved template-approval-resolved-${d}`,children:d===`approved`?`Approved`:`Rejected${c.trim()?` — ${c.trim()}`:``}`}):(0,f.jsxs)(`div`,{className:`template-approval-buttons`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:m,className:`template-approval-btn template-approval-btn-approve`,children:`Approve`}),(0,f.jsx)(`button`,{type:`button`,onClick:h,className:`template-approval-btn template-approval-btn-reject`,children:o?`Confirm Reject`:`Reject`}),o&&(0,f.jsx)(`button`,{type:`button`,onClick:()=>{s(!1),l(``)},className:`template-approval-btn-cancel`,children:`Cancel`})]})]})}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(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Ry=Fy(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),zy=Fy(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),By=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`}]]),Vy=Fy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Hy={downloadGenerated:async(e,t)=>{let{data:n}=await he.get({url:`/templates/generated/${encodeURIComponent(e)}/download`,parseAs:`blob`,throwOnError:!0}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}};function Uy({templateName:e,outputFilename:t,s3Path:n}){let[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(null),s=(0,u.useMemo)(()=>n.split(`/`).pop()?.replace(/\.docx$/i,``)??``,[n]),c=async()=>{if(!s){o(`Generated file id is missing`);return}i(!0),o(null);try{await Hy.downloadGenerated(s,t||`${s}.docx`)}catch(e){o(e instanceof Error?e.message:`Download failed`)}finally{i(!1)}};return(0,f.jsxs)(`div`,{className:`filled-template-card`,children:[(0,f.jsx)(`div`,{className:`filled-template-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ly,{size:24})}),(0,f.jsxs)(`div`,{className:`filled-template-content`,children:[(0,f.jsx)(`div`,{className:`filled-template-filename`,children:t}),(0,f.jsxs)(`div`,{className:`filled-template-meta`,children:[`Filled from `,e]}),a&&(0,f.jsx)(`div`,{className:`filled-template-error`,children:a})]}),(0,f.jsx)(`button`,{type:`button`,onClick:c,disabled:r||!s,className:`filled-template-download-btn`,children:r?`Downloading...`:`Download`})]})}function Wy({name:e}){let t=(0,u.useContext)(en);return(0,u.useEffect)(()=>{t&&t.setStep(e)},[e,t]),null}function Gy(){return(0,d.useRenderTool)({name:`show_chart`,parameters:Ks,render:({parameters:e})=>e.compiled_chart?.path?(0,f.jsx)(Tc,{path:e.compiled_chart.path}):(0,f.jsx)(`div`,{children:`No chart path provided`})},[]),(0,d.useRenderTool)({name:`show_report`,parameters:qs,render:({parameters:e})=>e.compiled_report?.path?(0,f.jsx)(xy,{path:e.compiled_report.path,title:e.compiled_report.title}):(0,f.jsx)(`div`,{children:`No report path provided`})},[]),(0,d.useRenderTool)({name:`show_template`,parameters:Js,render:({parameters:e})=>{let{filled_template:t}=e;return t?.s3_path?(0,f.jsx)(Uy,{templateName:t.template_name,outputFilename:t.output_filename,s3Path:t.s3_path}):(0,f.jsx)(`div`,{children:`No template path provided`})}},[]),(0,d.useDefaultRenderTool)({render:({name:e})=>(0,f.jsx)(Wy,{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===`fill_template`){let{message:e,action:r}=n;return(0,f.jsx)(Ty,{message:e??`Approve this action?`,templateName:r?.template_name??``,outputFilename:r?.output_filename,data:r?.data??{},onApprove:()=>t({approved:!0}),onReject:e=>t({approved:!1,...e?{reason:e}:{}})})}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)(Sy,{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 Ky={search:async(e,t=Qt)=>{let{data:n}=await he.get({security:[{scheme:`bearer`,type:`http`}],url:`/chat/resources/search`,query:{query:e,agent:t},throwOnError:!0});return n.data??[]}},qy={dataset:`dataset`,document:`document`,template:`template`},Jy=(0,u.forwardRef)(({items:e,command:t,isLoading:n=!1},r)=>{let[i,a]=(0,u.useState)(0),o=(0,u.useRef)(null);return(0,u.useEffect)(()=>{a(0)},[e]),(0,u.useEffect)(()=>{o.current?.scrollIntoView({block:`nearest`})},[i]),(0,u.useImperativeHandle)(r,()=>({onKeyDown:n=>n.key===`ArrowUp`?(e.length===0||a(t=>(t-1+e.length)%e.length),!0):n.key===`ArrowDown`?(e.length===0||a(t=>(t+1)%e.length),!0):n.key===`Enter`||n.key===`Tab`?(e[i]&&t(e[i]),!0):!1})),!n&&e.length===0?null:(0,f.jsxs)(`div`,{className:`erica-mention-list`,children:[(0,f.jsxs)(`div`,{className:`erica-mention-list-header`,children:[(0,f.jsx)(`span`,{className:`erica-mention-at`,children:`@`}),(0,f.jsx)(`span`,{children:`Mention`}),n&&(0,f.jsx)(`span`,{className:`erica-mention-spinner`})]}),(0,f.jsx)(`div`,{className:`erica-mention-list-body`,children:n&&e.length===0?(0,f.jsx)(`div`,{className:`erica-mention-empty`,children:`Searching…`}):e.map((e,n)=>(0,f.jsxs)(`button`,{ref:n===i?o:void 0,type:`button`,className:[`erica-mention-item`,n===i?`erica-mention-item-selected`:``].filter(Boolean).join(` `),onMouseEnter:()=>a(n),onMouseDown:n=>{n.preventDefault(),t(e)},children:[(0,f.jsx)(`span`,{className:`erica-mention-label`,children:e.label}),e.description&&(0,f.jsx)(`span`,{className:[`erica-mention-badge`,`erica-mention-badge-${e.description}`].join(` `),children:qy[e.description]??e.description})]},e.id))})]})});Jy.displayName=`MentionSuggestionList`;function Yy(e){return e.nodeType===Node.TEXT_NODE?e.textContent??``:e instanceof HTMLElement?e.dataset.resourceUid&&e.dataset.resourceType?`:resource[${e.dataset.resourceLabel??e.textContent?.replace(/^@/,``)??``}]{uid="${e.dataset.resourceUid}" type="${e.dataset.resourceType}"}`:e.tagName===`BR`?`
77
- `:Array.from(e.childNodes).map(Yy).join(``):Array.from(e.childNodes).map(Yy).join(``)}function Xy(e){return Array.from(e.childNodes).map(Yy).join(``)}function Zy(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);if(!t.collapsed||t.startContainer.nodeType!==Node.TEXT_NODE)return null;let n=t.startContainer,r=n.data.slice(0,t.startOffset),i=/(?:^|\s)@([^@\s]*)$/.exec(r);return i?{node:n,start:r.length-i[1].length-1,end:t.startOffset,query:i[1]}:null}function Qy(e,t){let n=document.createRange();n.setStart(e,Math.min(t,e.data.length)),n.collapse(!0);let r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)}function $y({value:e,onChange:t,onSubmit:n,agentIdentifier:r,placeholder:i=`Ketik pertanyaan Anda di sini...`}){let a=(0,u.useRef)(null),o=(0,u.useRef)(null),s=(0,u.useRef)(null),c=(0,u.useRef)(null),l=(0,u.useRef)(null),d=(0,u.useRef)(null),p=(0,u.useRef)(0),h=(0,u.useRef)(n),g=(0,u.useRef)(t),_=(0,u.useRef)(r),[v,y]=(0,u.useState)(!0);(0,u.useEffect)(()=>{h.current=n},[n]),(0,u.useEffect)(()=>{g.current=t},[t]),(0,u.useEffect)(()=>{_.current=r},[r]),(0,u.useEffect)(()=>{e===``&&a.current&&a.current.textContent&&(a.current.innerHTML=``,y(!0))},[e]),(0,u.useEffect)(()=>()=>b(),[]);function b(){d.current&&=(clearTimeout(d.current),null),s.current?.unmount(),s.current=null,o.current?.remove(),o.current=null,l.current=null}function x(){let e=a.current;if(!e)return;let t=Xy(e);y(t.trim().length===0),g.current(t)}function S(e,t){let n=l.current;if(!n)return;o.current||(o.current=document.createElement(`div`),o.current.className=`erica-mention-popup`,o.current.setAttribute(`data-mention-suggestion`,``),document.body.appendChild(o.current),s.current=(0,m.createRoot)(o.current)),s.current.render((0,f.jsx)(Jy,{ref:c,items:e,isLoading:t,command:T}));let r=document.createRange();r.setStart(n.node,n.start),r.setEnd(n.node,n.end);let i=r.getBoundingClientRect();o.current.style.left=`${i.left}px`,o.current.style.bottom=`${window.innerHeight-i.top+6}px`}function C(e){let t=++p.current;S([],!0),d.current&&clearTimeout(d.current),d.current=setTimeout(async()=>{d.current=null;try{let n=await Ky.search(e.query,_.current);if(t!==p.current)return;S(n.filter(e=>[`dataset`,`document`,`template`].includes(e.type)).map(e=>({id:`${e.type}:${e.uid}`,label:e.name,description:e.type})),!1)}catch{if(t!==p.current)return;S([],!1)}},300)}function w(){let e=Zy();if(l.current=e,!e){b();return}C(e)}function T(e){let t=l.current;if(!t)return;let[n,r]=e.id.split(`:`),i=t.node,a=i.data.slice(0,t.start),o=i.data.slice(t.end),s=i.parentNode;if(!s)return;let c=document.createElement(`span`);c.className=`erica-resource-tag erica-editor-resource-tag`,c.contentEditable=`false`,c.dataset.resourceType=n,c.dataset.resourceUid=r,c.dataset.resourceLabel=e.label,c.textContent=`@${e.label}`;let u=document.createTextNode(a),d=document.createTextNode(` ${o}`);s.insertBefore(u,i),s.insertBefore(c,i),s.insertBefore(d,i),s.removeChild(i),b(),Qy(d,1),x()}return(0,f.jsxs)(`div`,{className:`erica-editor-wrap`,children:[v&&(0,f.jsx)(`div`,{className:`erica-editor-placeholder`,children:i}),(0,f.jsx)(`div`,{ref:a,className:`erica-chat-editor`,contentEditable:!0,role:`textbox`,"aria-multiline":`true`,"data-testid":`chat-editor`,onInput:()=>{x(),w()},onKeyDown:e=>{if(o.current){if(e.key===`Escape`){e.preventDefault(),b();return}if(c.current?.onKeyDown(e.nativeEvent)){e.preventDefault();return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),h.current())},onKeyUp:w,onBlur:()=>{window.setTimeout(()=>{document.querySelector(`[data-mention-suggestion]:hover`)||b()},150)}})]})}function eb({hasAttachments:e,disabled:t,onFilesSelected:n}){let r=(0,u.useRef)(null);function i(e){let t=Array.from(e.target.files??[]);t.length>0&&n(t),e.target.value=``}return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`input`,{ref:r,type:`file`,multiple:!0,className:`erica-attachment-input`,onChange:i,disabled:t}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`Attach files`,className:[`erica-attachment-button`,e?`erica-attachment-button-active`:``].filter(Boolean).join(` `),disabled:t,onClick:()=>r.current?.click(),children:(0,f.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`})})})]})}function tb(e){let t=(0,u.useContext)(en),[n,r]=(0,u.useState)(!1),i=(0,u.useRef)(0);if(!t)return(0,f.jsx)(d.CopilotChatInput,{...e});let{attachedFiles:a,addFiles:o,removeFile:s,inputValue:c,setInputValue:l,handleSubmit:p,threadId:m}=t,h=Qt;function g(e){e.preventDefault(),i.current+=1,e.dataTransfer.types.includes(`Files`)&&r(!0)}function _(e){e.preventDefault(),--i.current,i.current===0&&r(!1)}function v(e){e.preventDefault()}function y(e){e.preventDefault(),i.current=0,r(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&o(t)}function b(){p(c)}return(0,f.jsx)(d.CopilotChatInput,{...e,value:c,onChange:l,onSubmitMessage:p,children:({sendButton:e,startTranscribeButton:t,cancelTranscribeButton:r,finishTranscribeButton:i,audioRecorder:u,disclaimer:d,mode:p,positioning:x,keyboardHeight:S,containerRef:C,showDisclaimer:w,onCancelTranscribe:T,onFinishTranscribe:E,onStartTranscribe:ee})=>(0,f.jsxs)(`div`,{"data-copilotkit":!0,ref:C,className:[`erica-aware-input-shell`,x===`absolute`?`erica-aware-input-absolute`:``].filter(Boolean).join(` `),style:{transform:S>0?`translateY(-${S}px)`:void 0,transition:`transform 0.2s ease-out`},children:[(0,f.jsxs)(`div`,{className:[`erica-aware-input-card`,n?`erica-aware-input-dragging`:``].filter(Boolean).join(` `),onDragEnter:g,onDragLeave:_,onDragOver:v,onDrop:y,children:[n&&(0,f.jsx)(`div`,{className:`erica-aware-input-drop-overlay`,children:`Drop files to attach`}),a.length>0&&(0,f.jsx)(`div`,{className:`erica-attachment-chip-row`,children:a.map(e=>(0,f.jsxs)(`span`,{className:[`erica-attachment-chip`,`erica-attachment-chip-${e.status}`].join(` `),title:e.errorMessage??e.name,children:[e.status===`uploading`&&(0,f.jsx)(`span`,{className:`erica-attachment-chip-spinner`}),(0,f.jsx)(`span`,{className:`erica-attachment-chip-name`,children:e.name}),e.status!==`uploading`&&(0,f.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,className:`erica-attachment-chip-remove`,onClick:()=>s(e.id),children:`×`})]},e.id))}),(0,f.jsx)(`div`,{className:`erica-aware-input-main`,children:p===`transcribe`?u:(0,f.jsx)($y,{value:c,onChange:l,onSubmit:b,agentIdentifier:h,placeholder:`Ketik pertanyaan Anda di sini...`})}),(0,f.jsxs)(`div`,{className:`erica-aware-input-toolbar`,children:[(0,f.jsx)(eb,{hasAttachments:a.length>0,disabled:!m,onFilesSelected:o}),(0,f.jsx)(`div`,{className:`erica-aware-input-spacer`}),p===`transcribe`?(0,f.jsxs)(f.Fragment,{children:[T&&r,E&&i]}):(0,f.jsxs)(f.Fragment,{children:[ee&&t,e]})]})]}),w&&d]})})}var nb=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 rb(){let e=(0,u.useContext)(en),t=`digesting`;return e?.step&&(t=e.step===`ls`?`listing files`:nb(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 ib({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:`.`})]})]})]})}function ab(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 ob(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 sb({onNewChat:e,onThreadSelect:t,isMaximized:n=!1,onToggleMaximize:r}){let[i,a]=(0,u.useState)(!1),o=(0,u.useRef)(null),s=(0,d.useCopilotChatConfiguration)(),{data:c=[],isLoading:l}=Yt();(0,u.useEffect)(()=>{function e(e){o.current&&!o.current.contains(e.target)&&a(!1)}if(i)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[i]);function p(e){a(!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:o,children:[(0,f.jsx)(`button`,{onClick:e,className:`erica-new-chat-button`,title:`Start new chat`,children:(0,f.jsx)(By,{className:`erica-icon-sm`})}),(0,f.jsxs)(`button`,{onClick:()=>a(!i),className:`erica-threads-toggle`,title:`Recent threads`,children:[(0,f.jsxs)(`span`,{className:`erica-threads-toggle-text`,children:[`Riwayat `,c.length>0&&`(${c.length})`]}),(0,f.jsx)(Iy,{className:`erica-threads-toggle-icon ${i?`erica-threads-toggle-icon--open`:``}`})]}),r&&(0,f.jsx)(`button`,{onClick:r,className:`erica-maximize-button`,title:n?`Restore chat`:`Maximize chat`,children:n?(0,f.jsx)(zy,{className:`erica-icon-sm`}):(0,f.jsx)(Ry,{className:`erica-icon-sm`})}),s?.setModalOpen&&(0,f.jsx)(`button`,{onClick:()=>s.setModalOpen(!1),className:`erica-close-button`,title:`Close sidebar`,children:(0,f.jsx)(Vy,{className:`erica-icon-sm`})}),i&&(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`}),l&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`Loading threads...`}),!l&&c.length===0&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`No conversations yet`}),!l&&c.map(e=>{let t=ab(e.agent),n=ob(e.last_run_at??e.created_at);return(0,f.jsx)(`button`,{onClick:()=>p(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)})]})})]})]})}function cb({attachment:e}){let[t,n]=(0,u.useState)(!1);async function r(){n(!0);try{await $t.download(e.file_path,e.original_name)}finally{n(!1)}}return(0,f.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},title:e.original_name,className:`attachment-item`,children:[t?(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 lb({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)(cb,{attachment:e},t))})}function ub({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)(Vy,{})})]})})}function db(e){oh(e,[/\r?\n|\r/g,fb])}function fb(){return{type:`break`}}function pb(){return function(e){db(e)}}var mb=()=>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)},hb=()=>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 gb({threadId:e,isLoadingThreadId:t,isLoadingSandbox:n,isSandboxReady:r,isNewThread:i,handleNewChat:a,handleThreadSelect:o,requiresSandbox:s,isModalOpen:c,isMaximized:l,setIsMaximized:p}){let m=`Halo! Saya asisten AI SPP, ada yg bisa saya bantu?`;t?m=(0,f.jsx)(ib,{message:`Initializing conversation`}):s&&i&&n?m=(0,f.jsx)(ib,{message:`Preparing workspace`}):s&&i&&!r&&(m=(0,f.jsx)(ib,{message:`Setting up environment`}));let h=(0,u.useCallback)(()=>(0,f.jsx)(sb,{onNewChat:a,onThreadSelect:o,isMaximized:l,onToggleMaximize:()=>p(e=>!e)}),[a,o,l,p]);return(0,f.jsxs)(`div`,{className:`erica-chat-container${l?` erica-chat-maximized`:``}`,children:[(0,f.jsx)(Gy,{}),(0,f.jsx)(ub,{message:`Hai! Saya SPP AI, siap membantu Anda!`,isOpen:c,initialDelay:1e4}),(0,f.jsx)(d.CopilotSidebar,{welcomeScreen:!0,header:h,labels:{chatInputPlaceholder:`Ketik pertanyaan Anda di sini...`,welcomeMessageText:m,chatDisclaimerText:`AI dapat membuat kesalahan. Harap verifikasi informasi penting.`},threadId:e,input:tb,messageView:{cursor:rb,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)($m,{remarkPlugins:[pb,rv,vy,hb],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)(lb,{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]}),table:({children:e})=>(0,f.jsx)(`div`,{className:`markdown-table-wrapper`,children:(0,f.jsx)(`table`,{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)($m,{remarkPlugins:[pb,rv,vy,mb],components:{tool_call_content:({children:e,...t})=>(0,f.jsx)(`div`,{className:`tool-call-content`,...t,children:e}),table:({children:e})=>(0,f.jsx)(`div`,{className:`markdown-table-wrapper`,children:(0,f.jsx)(`table`,{children:e})})},children:e})}},defaultOpen:c})]})}function _b({runtimeUrl:e,widgetToken:t,requiresSandbox:n=!1}){let[r,i]=(0,u.useState)(void 0),[a,o]=(0,u.useState)(!0),[s,c]=(0,u.useState)(!1),[l,p]=(0,u.useState)(0),[m,h]=(0,u.useState)(!0),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(!1),b=(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)(()=>{ge(b,t)},[b,t]);let{data:x,isLoading:S}=Xt(a,l),{isLoading:C,isSuccess:w}=Zt(r||``,s);(0,u.useEffect)(()=>{w&&m&&g&&_(!0)},[w,m,g]),(0,u.useEffect)(()=>{x&&(i(x),o(!1),c(n),h(!0))},[x,n]),(0,u.useEffect)(()=>()=>{r&&m&&qt.deleteSandbox(r).catch(()=>{})},[r,m]);let T=(0,u.useCallback)(()=>{i(void 0),o(!0),c(!1),p(e=>e+1),h(!0),_(!0)},[]),E=(0,u.useCallback)(e=>{i(e),o(!1),c(!1),h(!1),_(!0)},[]);return(0,f.jsx)(d.CopilotChatConfigurationProvider,{children:(0,f.jsx)(d.CopilotKit,{runtimeUrl:e,headers:{Authorization:`Bearer ${t}`},properties:{agent:Qt},threadId:r,enableInspector:!1,children:(0,f.jsx)(nn,{threadId:r,agentIdentifier:Qt,children:(0,f.jsx)(gb,{threadId:r,isLoadingThreadId:S,isLoadingSandbox:C,isSandboxReady:w,isNewThread:m,handleNewChat:T,handleThreadSelect:E,requiresSandbox:n,isModalOpen:g,isMaximized:v,setIsMaximized:y})})})})}var vb=(0,u.createContext)(void 0);function yb({accountUid:e,children:t}){return(0,f.jsx)(vb.Provider,{value:{accountUid:e},children:t})}var bb=new xt({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});function xb({accountUid:e,children:t}){return(0,f.jsx)(wt,{client:bb,children:(0,f.jsx)(yb,{accountUid:e,children:(0,f.jsx)(Dc,{children:t})})})}function Sb(){let{isOpen:e,onClose:t,content:n,title:r}=Oc(),[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)(Vy,{className:`erica-icon-md`})})]}),(0,f.jsx)(`div`,{className:`erica-artifact-body`,children:n})]})]}):null}exports.ArtifactProvider=Dc,exports.EricaChat=_b,exports.EricaDrawer=Sb,exports.EricaProvider=xb;
76
+ `,`\r`];return e+`=`+s+Cv(n,{subset:c})+s}}function Av(e){Nv.call(this,`containerDirective`,e)}function jv(e){Nv.call(this,`leafDirective`,e)}function Mv(e){Nv.call(this,`textDirective`,e)}function Nv(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function Pv(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function Fv(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function Iv(e){this.exit(e)}function Lv(){this.data.directiveAttributes=[],this.buffer()}function Rv(e){this.data.directiveAttributes.push([`id`,dv(this.sliceSerialize(e),{attribute:!0})])}function zv(e){this.data.directiveAttributes.push([`class`,dv(this.sliceSerialize(e),{attribute:!0})])}function Bv(e){let t=this.data.directiveAttributes;t[t.length-1][1]=dv(this.sliceSerialize(e),{attribute:!0})}function Vv(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Hv(){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 Uv(e){this.exit(e)}function Wv(){return`:`}function Gv(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function Kv(e){let t=0;return e.type===`containerDirective`?($p(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 qv(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)?yd(e,v)(t):t===null||Y(t)||Su(t)||xu(t)&&t!==45&&t!==95?te(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)||Su(t)||xu(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Z(t)?Q(e,C,`whitespace`)(t):!m&&X(t)?yd(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)?yd(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),ee):(e.enter(d),D(t))}function D(t){return t===g?(e.exit(d),E(t)):t===null?n(t):Y(t)?m?n(t):yd(e,D)(t):(e.enter(p),e.consume(t),O)}function O(t){return t===g||t===null||Y(t)?(e.exit(p),D(t)):(e.consume(t),O)}function ee(e){return e===125||X(e)?v(e):te(e)}function te(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function Jv(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 Yv(e,t,n,r){let i=this;return a;function a(t){return t===null||Y(t)||xu(t)||Su(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Y(a)||Su(a)||xu(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var Xv={tokenize:ey,concrete:!0},Zv={tokenize:ty,partial:!0},Qv={tokenize:ny,partial:!0},$v={tokenize:ry,partial:!0};function ey(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`),Yv.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(Zv,d,d)(t):d(t)}function d(t){return t===123?e.attempt(Qv,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($v,m,C)(i):n(i)}function m(t){return t===null?C(t):Y(t)?e.check($v,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($v,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($v,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 ty(e,t,n){return Jv(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function ny(e,t,n){return qv(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function ry(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 iy={tokenize:sy},ay={tokenize:cy,partial:!0},oy={tokenize:ly,partial:!0};function sy(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`),Yv.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(ay,s,s)(t):s(t)}function s(t){return t===123?e.attempt(oy,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 cy(e,t,n){return Jv(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function ly(e,t,n){return qv(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var uy={tokenize:my,previous:py},dy={tokenize:hy,partial:!0},fy={tokenize:gy,partial:!0};function py(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function my(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),Yv.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(dy,o,o)(t):o(t)}function o(t){return t===123?e.attempt(fy,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function hy(e,t,n){return Jv(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function gy(e,t,n){return qv(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function _y(){return{text:{58:uy},flow:{58:[Xv,iy]}}}function vy(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(_y()),n.push(Ov()),r.push(kv())}function yy({markdown:e}){return(0,f.jsx)(`div`,{className:`report-artifact`,children:(0,f.jsx)($m,{remarkPlugins:[vy,()=>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)},rv],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 by({title:e,reportContent:t}){let n=Dc(),r=()=>{n.setTitle(e),n.setContent((0,f.jsx)(yy,{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 xy({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)(by,{title:t,reportContent:a}):(0,f.jsx)(`div`,{className:`report-loader-no-data`,children:`No report data available`})}function Sy({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`})]})]})}var Cy=e=>e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e);function wy({rows:e}){let t=e.length>0?Object.keys(e[0]):[];return e.length===0?(0,f.jsx)(`span`,{className:`template-approval-empty`,children:`[]`}):(0,f.jsxs)(`div`,{className:`template-approval-table-wrapper`,children:[(0,f.jsxs)(`table`,{className:`template-approval-table`,children:[(0,f.jsx)(`thead`,{className:`template-approval-thead`,children:(0,f.jsx)(`tr`,{children:t.map(e=>(0,f.jsx)(`th`,{className:`template-approval-th`,children:e},e))})}),(0,f.jsx)(`tbody`,{children:e.slice(0,5).map((e,n)=>(0,f.jsx)(`tr`,{className:`template-approval-tr`,children:t.map(t=>(0,f.jsx)(`td`,{className:`template-approval-td`,children:Cy(e[t])},t))},n))})]}),e.length>5&&(0,f.jsxs)(`p`,{className:`template-approval-hidden-count`,children:[`... and `,e.length-5,` more row`,e.length-5==1?``:`s`]})]})}function Ty({message:e,templateName:t,outputFilename:n,data:r,onApprove:i,onReject:a}){let[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(``),[d,p]=(0,u.useState)(null),m=()=>{p(`approved`),i()},h=()=>{if(!o){s(!0);return}p(`rejected`),a(c.trim()||void 0)},g=Object.entries(r);return(0,f.jsxs)(`div`,{className:`template-approval-card`,children:[(0,f.jsxs)(`div`,{className:`template-approval-header`,children:[(0,f.jsx)(`div`,{className:`template-approval-icon`,"aria-hidden":`true`,children:`📄`}),(0,f.jsxs)(`div`,{className:`template-approval-heading`,children:[(0,f.jsx)(`h3`,{className:`template-approval-title`,children:`Fill Template`}),t&&(0,f.jsx)(`p`,{className:`template-approval-meta`,children:t})]})]}),(0,f.jsx)(`p`,{className:`template-approval-message`,children:e}),n&&(0,f.jsxs)(`p`,{className:`template-approval-output`,children:[`Output: `,(0,f.jsx)(`strong`,{children:n})]}),g.length>0&&(0,f.jsx)(`div`,{className:`template-approval-data`,children:g.map(([e,t])=>{let n=Array.isArray(t)&&t.length>0&&typeof t[0]==`object`&&t[0]!==null;return(0,f.jsxs)(`div`,{className:`template-approval-field`,children:[(0,f.jsx)(`span`,{className:`template-approval-field-key`,children:e}),(0,f.jsx)(`div`,{className:`template-approval-field-value`,children:n?(0,f.jsx)(wy,{rows:t}):Cy(t)})]},e)})}),o&&!d&&(0,f.jsxs)(`div`,{className:`template-approval-reject-section`,children:[(0,f.jsx)(`label`,{className:`template-approval-reject-label`,children:`Rejection reason (optional):`}),(0,f.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),className:`template-approval-reject-input`,placeholder:`Enter reason...`})]}),d?(0,f.jsx)(`div`,{className:`template-approval-resolved template-approval-resolved-${d}`,children:d===`approved`?`Approved`:`Rejected${c.trim()?` — ${c.trim()}`:``}`}):(0,f.jsxs)(`div`,{className:`template-approval-buttons`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:m,className:`template-approval-btn template-approval-btn-approve`,children:`Approve`}),(0,f.jsx)(`button`,{type:`button`,onClick:h,className:`template-approval-btn template-approval-btn-reject`,children:o?`Confirm Reject`:`Reject`}),o&&(0,f.jsx)(`button`,{type:`button`,onClick:()=>{s(!1),l(``)},className:`template-approval-btn-cancel`,children:`Cancel`})]})]})}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(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Ry=Fy(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),zy=Fy(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),By=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`}]]),Vy=Fy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Hy={downloadGenerated:async(e,t)=>{let{data:n}=await me.get({url:`/templates/generated/${encodeURIComponent(e)}/download`,parseAs:`blob`,throwOnError:!0}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}};function Uy({templateName:e,outputFilename:t,s3Path:n}){let[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(null),s=(0,u.useMemo)(()=>n.split(`/`).pop()?.replace(/\.docx$/i,``)??``,[n]),c=async()=>{if(!s){o(`Generated file id is missing`);return}i(!0),o(null);try{await Hy.downloadGenerated(s,t||`${s}.docx`)}catch(e){o(e instanceof Error?e.message:`Download failed`)}finally{i(!1)}};return(0,f.jsxs)(`div`,{className:`filled-template-card`,children:[(0,f.jsx)(`div`,{className:`filled-template-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ly,{size:24})}),(0,f.jsxs)(`div`,{className:`filled-template-content`,children:[(0,f.jsx)(`div`,{className:`filled-template-filename`,children:t}),(0,f.jsxs)(`div`,{className:`filled-template-meta`,children:[`Filled from `,e]}),a&&(0,f.jsx)(`div`,{className:`filled-template-error`,children:a})]}),(0,f.jsx)(`button`,{type:`button`,onClick:c,disabled:r||!s,className:`filled-template-download-btn`,children:r?`Downloading...`:`Download`})]})}function Wy({name:e}){let t=(0,u.useContext)($t);return(0,u.useEffect)(()=>{t&&t.setStep(e)},[e,t]),null}function Gy(){return(0,d.useRenderTool)({name:`show_chart`,parameters:Gs,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:`show_report`,parameters:Ks,render:({parameters:e})=>e.compiled_report?.path?(0,f.jsx)(xy,{path:e.compiled_report.path,title:e.compiled_report.title}):(0,f.jsx)(`div`,{children:`No report path provided`})},[]),(0,d.useRenderTool)({name:`show_template`,parameters:qs,render:({parameters:e})=>{let{filled_template:t}=e;return t?.s3_path?(0,f.jsx)(Uy,{templateName:t.template_name,outputFilename:t.output_filename,s3Path:t.s3_path}):(0,f.jsx)(`div`,{children:`No template path provided`})}},[]),(0,d.useDefaultRenderTool)({render:({name:e})=>(0,f.jsx)(Wy,{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===`fill_template`){let{message:e,action:r}=n;return(0,f.jsx)(Ty,{message:e??`Approve this action?`,templateName:r?.template_name??``,outputFilename:r?.output_filename,data:r?.data??{},onApprove:()=>t({approved:!0}),onReject:e=>t({approved:!1,...e?{reason:e}:{}})})}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)(Sy,{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 Ky={search:async(e,t=Zt)=>{let{data:n}=await me.get({security:[{scheme:`bearer`,type:`http`}],url:`/chat/resources/search`,query:{query:e,agent:t},throwOnError:!0});return n.data??[]}},qy={dataset:`dataset`,document:`document`,template:`template`},Jy=(0,u.forwardRef)(({items:e,command:t,isLoading:n=!1},r)=>{let[i,a]=(0,u.useState)(0),o=(0,u.useRef)(null);return(0,u.useEffect)(()=>{a(0)},[e]),(0,u.useEffect)(()=>{o.current?.scrollIntoView({block:`nearest`})},[i]),(0,u.useImperativeHandle)(r,()=>({onKeyDown:n=>n.key===`ArrowUp`?(e.length===0||a(t=>(t-1+e.length)%e.length),!0):n.key===`ArrowDown`?(e.length===0||a(t=>(t+1)%e.length),!0):n.key===`Enter`||n.key===`Tab`?(e[i]&&t(e[i]),!0):!1})),!n&&e.length===0?null:(0,f.jsxs)(`div`,{className:`erica-mention-list`,children:[(0,f.jsxs)(`div`,{className:`erica-mention-list-header`,children:[(0,f.jsx)(`span`,{className:`erica-mention-at`,children:`@`}),(0,f.jsx)(`span`,{children:`Mention`}),n&&(0,f.jsx)(`span`,{className:`erica-mention-spinner`})]}),(0,f.jsx)(`div`,{className:`erica-mention-list-body`,children:n&&e.length===0?(0,f.jsx)(`div`,{className:`erica-mention-empty`,children:`Searching…`}):e.map((e,n)=>(0,f.jsxs)(`button`,{ref:n===i?o:void 0,type:`button`,className:[`erica-mention-item`,n===i?`erica-mention-item-selected`:``].filter(Boolean).join(` `),onMouseEnter:()=>a(n),onMouseDown:n=>{n.preventDefault(),t(e)},children:[(0,f.jsx)(`span`,{className:`erica-mention-label`,children:e.label}),e.description&&(0,f.jsx)(`span`,{className:[`erica-mention-badge`,`erica-mention-badge-${e.description}`].join(` `),children:qy[e.description]??e.description})]},e.id))})]})});Jy.displayName=`MentionSuggestionList`;function Yy(e){return e.nodeType===Node.TEXT_NODE?e.textContent??``:e instanceof HTMLElement?e.dataset.resourceUid&&e.dataset.resourceType?`:resource[${e.dataset.resourceLabel??e.textContent?.replace(/^@/,``)??``}]{uid="${e.dataset.resourceUid}" type="${e.dataset.resourceType}"}`:e.tagName===`BR`?`
77
+ `:Array.from(e.childNodes).map(Yy).join(``):Array.from(e.childNodes).map(Yy).join(``)}function Xy(e){return Array.from(e.childNodes).map(Yy).join(``)}function Zy(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);if(!t.collapsed||t.startContainer.nodeType!==Node.TEXT_NODE)return null;let n=t.startContainer,r=n.data.slice(0,t.startOffset),i=/(?:^|\s)@([^@\s]*)$/.exec(r);return i?{node:n,start:r.length-i[1].length-1,end:t.startOffset,query:i[1]}:null}function Qy(e,t){let n=document.createRange();n.setStart(e,Math.min(t,e.data.length)),n.collapse(!0);let r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)}function $y({value:e,onChange:t,onSubmit:n,agentIdentifier:r,placeholder:i=`Ketik pertanyaan Anda di sini...`}){let a=(0,u.useRef)(null),o=(0,u.useRef)(null),s=(0,u.useRef)(null),c=(0,u.useRef)(null),l=(0,u.useRef)(null),d=(0,u.useRef)(null),p=(0,u.useRef)(0),h=(0,u.useRef)(n),g=(0,u.useRef)(t),_=(0,u.useRef)(r),[v,y]=(0,u.useState)(!0);(0,u.useEffect)(()=>{h.current=n},[n]),(0,u.useEffect)(()=>{g.current=t},[t]),(0,u.useEffect)(()=>{_.current=r},[r]),(0,u.useEffect)(()=>{e===``&&a.current&&a.current.textContent&&(a.current.innerHTML=``,y(!0))},[e]),(0,u.useEffect)(()=>()=>b(),[]);function b(){d.current&&=(clearTimeout(d.current),null),s.current?.unmount(),s.current=null,o.current?.remove(),o.current=null,l.current=null}function x(){let e=a.current;if(!e)return;let t=Xy(e);y(t.trim().length===0),g.current(t)}function S(e,t){let n=l.current;if(!n)return;o.current||(o.current=document.createElement(`div`),o.current.className=`erica-mention-popup`,o.current.setAttribute(`data-mention-suggestion`,``),document.body.appendChild(o.current),s.current=(0,m.createRoot)(o.current)),s.current.render((0,f.jsx)(Jy,{ref:c,items:e,isLoading:t,command:T}));let r=document.createRange();r.setStart(n.node,n.start),r.setEnd(n.node,n.end);let i=r.getBoundingClientRect();o.current.style.left=`${i.left}px`,o.current.style.bottom=`${window.innerHeight-i.top+6}px`}function C(e){let t=++p.current;S([],!0),d.current&&clearTimeout(d.current),d.current=setTimeout(async()=>{d.current=null;try{let n=await Ky.search(e.query,_.current);if(t!==p.current)return;S(n.filter(e=>[`dataset`,`document`,`template`].includes(e.type)).map(e=>({id:`${e.type}:${e.uid}`,label:e.name,description:e.type})),!1)}catch{if(t!==p.current)return;S([],!1)}},300)}function w(){let e=Zy();if(l.current=e,!e){b();return}C(e)}function T(e){let t=l.current;if(!t)return;let[n,r]=e.id.split(`:`),i=t.node,a=i.data.slice(0,t.start),o=i.data.slice(t.end),s=i.parentNode;if(!s)return;let c=document.createElement(`span`);c.className=`erica-resource-tag erica-editor-resource-tag`,c.contentEditable=`false`,c.dataset.resourceType=n,c.dataset.resourceUid=r,c.dataset.resourceLabel=e.label,c.textContent=`@${e.label}`;let u=document.createTextNode(a),d=document.createTextNode(` ${o}`);s.insertBefore(u,i),s.insertBefore(c,i),s.insertBefore(d,i),s.removeChild(i),b(),Qy(d,1),x()}return(0,f.jsxs)(`div`,{className:`erica-editor-wrap`,children:[v&&(0,f.jsx)(`div`,{className:`erica-editor-placeholder`,children:i}),(0,f.jsx)(`div`,{ref:a,className:`erica-chat-editor`,contentEditable:!0,role:`textbox`,"aria-multiline":`true`,"data-testid":`chat-editor`,onInput:()=>{x(),w()},onKeyDown:e=>{if(o.current){if(e.key===`Escape`){e.preventDefault(),b();return}if(c.current?.onKeyDown(e.nativeEvent)){e.preventDefault();return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),h.current())},onKeyUp:w,onBlur:()=>{window.setTimeout(()=>{document.querySelector(`[data-mention-suggestion]:hover`)||b()},150)}})]})}function eb({hasAttachments:e,disabled:t,onFilesSelected:n}){let r=(0,u.useRef)(null);function i(e){let t=Array.from(e.target.files??[]);t.length>0&&n(t),e.target.value=``}return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`input`,{ref:r,type:`file`,multiple:!0,className:`erica-attachment-input`,onChange:i,disabled:t}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`Attach files`,className:[`erica-attachment-button`,e?`erica-attachment-button-active`:``].filter(Boolean).join(` `),disabled:t,onClick:()=>r.current?.click(),children:(0,f.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`})})})]})}function tb(e){let t=(0,u.useContext)($t),[n,r]=(0,u.useState)(!1),i=(0,u.useRef)(0);if(!t)return(0,f.jsx)(d.CopilotChatInput,{...e});let{attachedFiles:a,addFiles:o,removeFile:s,inputValue:c,setInputValue:l,handleSubmit:p,threadId:m}=t,h=Zt;function g(e){e.preventDefault(),i.current+=1,e.dataTransfer.types.includes(`Files`)&&r(!0)}function _(e){e.preventDefault(),--i.current,i.current===0&&r(!1)}function v(e){e.preventDefault()}function y(e){e.preventDefault(),i.current=0,r(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&o(t)}function b(){p(c)}return(0,f.jsx)(d.CopilotChatInput,{...e,value:c,onChange:l,onSubmitMessage:p,children:({sendButton:e,startTranscribeButton:t,cancelTranscribeButton:r,finishTranscribeButton:i,audioRecorder:u,disclaimer:d,mode:p,positioning:x,keyboardHeight:S,containerRef:C,showDisclaimer:w,onCancelTranscribe:T,onFinishTranscribe:E,onStartTranscribe:D})=>(0,f.jsxs)(`div`,{"data-copilotkit":!0,ref:C,className:[`erica-aware-input-shell`,x===`absolute`?`erica-aware-input-absolute`:``].filter(Boolean).join(` `),style:{transform:S>0?`translateY(-${S}px)`:void 0,transition:`transform 0.2s ease-out`},children:[(0,f.jsxs)(`div`,{className:[`erica-aware-input-card`,n?`erica-aware-input-dragging`:``].filter(Boolean).join(` `),onDragEnter:g,onDragLeave:_,onDragOver:v,onDrop:y,children:[n&&(0,f.jsx)(`div`,{className:`erica-aware-input-drop-overlay`,children:`Drop files to attach`}),a.length>0&&(0,f.jsx)(`div`,{className:`erica-attachment-chip-row`,children:a.map(e=>(0,f.jsxs)(`span`,{className:[`erica-attachment-chip`,`erica-attachment-chip-${e.status}`].join(` `),title:e.errorMessage??e.name,children:[e.status===`uploading`&&(0,f.jsx)(`span`,{className:`erica-attachment-chip-spinner`}),(0,f.jsx)(`span`,{className:`erica-attachment-chip-name`,children:e.name}),e.status!==`uploading`&&(0,f.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,className:`erica-attachment-chip-remove`,onClick:()=>s(e.id),children:`×`})]},e.id))}),(0,f.jsx)(`div`,{className:`erica-aware-input-main`,children:p===`transcribe`?u:(0,f.jsx)($y,{value:c,onChange:l,onSubmit:b,agentIdentifier:h,placeholder:`Ketik pertanyaan Anda di sini...`})}),(0,f.jsxs)(`div`,{className:`erica-aware-input-toolbar`,children:[(0,f.jsx)(eb,{hasAttachments:a.length>0,disabled:!m,onFilesSelected:o}),(0,f.jsx)(`div`,{className:`erica-aware-input-spacer`}),p===`transcribe`?(0,f.jsxs)(f.Fragment,{children:[T&&r,E&&i]}):(0,f.jsxs)(f.Fragment,{children:[D&&t,e]})]})]}),w&&d]})})}var nb=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 rb(){let e=(0,u.useContext)($t),t=`digesting`;return e?.step&&(t=e.step===`ls`?`listing files`:nb(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 ib({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:`.`})]})]})]})}function ab(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 ob(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 sb({onNewChat:e,onThreadSelect:t,isMaximized:n=!1,onToggleMaximize:r}){let[i,a]=(0,u.useState)(!1),o=(0,u.useRef)(null),s=(0,d.useCopilotChatConfiguration)(),{data:c=[],isLoading:l}=Jt();(0,u.useEffect)(()=>{function e(e){o.current&&!o.current.contains(e.target)&&a(!1)}if(i)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[i]);function p(e){a(!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.jsxs)(`span`,{className:`erica-header-version`,children:[`v`,`1.2.5`]})]}),(0,f.jsxs)(`div`,{className:`erica-header-controls`,ref:o,children:[(0,f.jsx)(`button`,{onClick:e,className:`erica-new-chat-button`,title:`Start new chat`,children:(0,f.jsx)(By,{className:`erica-icon-sm`})}),(0,f.jsxs)(`button`,{onClick:()=>a(!i),className:`erica-threads-toggle`,title:`Recent threads`,children:[(0,f.jsxs)(`span`,{className:`erica-threads-toggle-text`,children:[`Riwayat `,c.length>0&&`(${c.length})`]}),(0,f.jsx)(Iy,{className:`erica-threads-toggle-icon ${i?`erica-threads-toggle-icon--open`:``}`})]}),r&&(0,f.jsx)(`button`,{onClick:e=>{e.stopPropagation(),e.preventDefault(),r()},className:`erica-maximize-button`,title:n?`Restore chat`:`Maximize chat`,children:n?(0,f.jsx)(zy,{className:`erica-icon-sm`}):(0,f.jsx)(Ry,{className:`erica-icon-sm`})}),s?.setModalOpen&&(0,f.jsx)(`button`,{onClick:()=>s.setModalOpen(!1),className:`erica-close-button`,title:`Close sidebar`,children:(0,f.jsx)(Vy,{className:`erica-icon-sm`})}),i&&(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`}),l&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`Loading threads...`}),!l&&c.length===0&&(0,f.jsx)(`div`,{className:`erica-threads-empty`,children:`No conversations yet`}),!l&&c.map(e=>{let t=ab(e.agent),n=ob(e.last_run_at??e.created_at);return(0,f.jsx)(`button`,{onClick:()=>p(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)})]})})]})]})}function cb({attachment:e}){let[t,n]=(0,u.useState)(!1);async function r(){n(!0);try{await Qt.download(e.file_path,e.original_name)}finally{n(!1)}}return(0,f.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},title:e.original_name,className:`attachment-item`,children:[t?(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 lb({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)(cb,{attachment:e},t))})}function ub({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)(Vy,{})})]})})}function db(e){oh(e,[/\r?\n|\r/g,fb])}function fb(){return{type:`break`}}function pb(){return function(e){db(e)}}var mb=u.default.createContext(null);function hb(){let e=u.default.useContext(mb);return e?(0,f.jsx)(sb,{onNewChat:e.onNewChat,onThreadSelect:e.onThreadSelect,isMaximized:e.isMaximized,onToggleMaximize:e.toggleMaximize}):null}var gb=()=>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)},_b=()=>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 vb({threadId:e,isLoadingThreadId:t,isLoadingSandbox:n,isSandboxReady:r,isNewThread:i,requiresSandbox:a,isModalOpen:o}){let s=`Halo! Saya asisten AI SPP, ada yang bisa saya bantu?`;return t?s=(0,f.jsx)(ib,{message:`Initializing conversation`}):a&&i&&n?s=(0,f.jsx)(ib,{message:`Preparing workspace`}):a&&i&&!r&&(s=(0,f.jsx)(ib,{message:`Setting up environment`})),(0,f.jsxs)(`div`,{className:`erica-chat-container${u.default.useContext(mb)?.isMaximized?` erica-chat-maximized`:``}`,children:[(0,f.jsx)(Gy,{}),(0,f.jsx)(ub,{message:`Hai! Saya SPP AI, siap membantu Anda!`,isOpen:o,initialDelay:1e4}),(0,f.jsx)(d.CopilotSidebar,{welcomeScreen:!0,header:hb,labels:{chatInputPlaceholder:`Ketik pertanyaan Anda di sini...`,welcomeMessageText:s,chatDisclaimerText:`AI dapat membuat kesalahan. Harap verifikasi informasi penting.`},threadId:e,input:tb,messageView:{cursor:rb,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)($m,{remarkPlugins:[pb,rv,vy,_b],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)(lb,{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]}),table:({children:e})=>(0,f.jsx)(`div`,{className:`markdown-table-wrapper`,children:(0,f.jsx)(`table`,{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)($m,{remarkPlugins:[pb,rv,vy,gb],components:{tool_call_content:({children:e,...t})=>(0,f.jsx)(`div`,{className:`tool-call-content`,...t,children:e}),table:({children:e})=>(0,f.jsx)(`div`,{className:`markdown-table-wrapper`,children:(0,f.jsx)(`table`,{children:e})})},children:e})}},defaultOpen:o})]})}function yb({runtimeUrl:e,widgetToken:t,requiresSandbox:n=!1}){let[r,i]=(0,u.useState)(void 0),[a,o]=(0,u.useState)(!0),[s,c]=(0,u.useState)(!1),[l,p]=(0,u.useState)(0),[m,h]=(0,u.useState)(!0),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(!1);console.log(`EricaChat Render:`,{threadId:r,shouldFetchNewId:a,isModalOpen:g,isMaximized:v});let b=(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(b,t)},[b,t]);let{data:x,isLoading:S}=Yt(a,l),{isLoading:C,isSuccess:w}=Xt(r||``,s);(0,u.useEffect)(()=>{w&&m&&g&&_(!0)},[w,m,g]),(0,u.useEffect)(()=>{x&&(i(x),o(!1),c(n),h(!0))},[x,n]),(0,u.useEffect)(()=>()=>{r&&m&&Kt.deleteSandbox(r).catch(()=>{})},[r,m]);let T=(0,u.useCallback)(()=>{i(void 0),o(!0),c(!1),p(e=>e+1),h(!0),_(!0)},[]),E=(0,u.useCallback)(e=>{i(e),o(!1),c(!1),h(!1),_(!0)},[]),D=(0,u.useCallback)(()=>{_(!0),y(e=>!e)},[]),O=(0,u.useMemo)(()=>({isMaximized:v,toggleMaximize:D,onNewChat:T,onThreadSelect:E}),[v,D,T,E]);return(0,f.jsx)(mb.Provider,{value:O,children:(0,f.jsx)(d.CopilotChatConfigurationProvider,{children:(0,f.jsx)(d.CopilotKit,{runtimeUrl:e,headers:{Authorization:`Bearer ${t}`},properties:{agent:Zt},threadId:r,enableInspector:!1,children:(0,f.jsx)(tn,{threadId:r,agentIdentifier:Zt,children:(0,f.jsx)(vb,{threadId:r,isLoadingThreadId:S,isLoadingSandbox:C,isSandboxReady:w,isNewThread:m,requiresSandbox:n,isModalOpen:g})})})})})}var bb=(0,u.createContext)(void 0);function xb({accountUid:e,children:t}){return(0,f.jsx)(bb.Provider,{value:{accountUid:e},children:t})}var Sb=new bt({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});function Cb({accountUid:e,children:t}){return(0,f.jsx)(Ct,{client:Sb,children:(0,f.jsx)(xb,{accountUid:e,children:(0,f.jsx)(Ec,{children:t})})})}function wb(){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)(Vy,{className:`erica-icon-md`})})]}),(0,f.jsx)(`div`,{className:`erica-artifact-body`,children:n})]})]}):null}exports.ArtifactProvider=Ec,exports.EricaChat=yb,exports.EricaDrawer=wb,exports.EricaProvider=Cb;
78
78
  //# sourceMappingURL=index.cjs.map