offsite 0.0.21 → 0.0.22
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/apps/web/dist/assets/{dist-BtDwoA_O.js → dist-M_vc7ku0.js} +1 -1
- package/apps/web/dist/assets/{index-EdBnhSVl.css → index-C8YDbF3a.css} +1 -1
- package/apps/web/dist/assets/{index-B9Y6tnXx.js → index-DntmK9pY.js} +3 -3
- package/apps/web/dist/index.html +2 -2
- package/apps/web/dist/sw.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/image-viewer-DnE3hPpr.js","assets/jsx-runtime-D3jfb0Ew.js","assets/preview-dialog-CApdSumg.js","assets/HugeiconsIcon-B46TDTdz.js","assets/zoomable-image-CjNpa0bY.js","assets/tooltip-DZsSQhD8.js","assets/dist-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/image-viewer-DnE3hPpr.js","assets/jsx-runtime-D3jfb0Ew.js","assets/preview-dialog-CApdSumg.js","assets/HugeiconsIcon-B46TDTdz.js","assets/zoomable-image-CjNpa0bY.js","assets/tooltip-DZsSQhD8.js","assets/dist-M_vc7ku0.js","assets/dist-BJ6NAVkJ.js","assets/video-viewer-B404MUMw.js","assets/video-player-05lO0mz3.js","assets/video-player-DGtpeSpK.js","assets/zoomable-image-CzRbnhdc.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{a as e,i as t,n,r,t as i}from"./jsx-runtime-D3jfb0Ew.js";import{C as a,D as o,E as s,S as c,T as l,_ as u,a as d,c as f,d as p,f as m,g as h,h as g,i as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,w as D,x as O,y as k}from"./HugeiconsIcon-B46TDTdz.js";import{a as A,c as ee,i as j,l as te,n as ne,o as re,r as ie,s as ae,t as M}from"./tooltip-DZsSQhD8.js";import{C as oe,S as se,T as ce,_ as le,a as ue,b as de,c as fe,d as pe,f as me,g as he,h as ge,i as N,l as _e,m as ve,n as ye,o as be,p as xe,r as Se,s as Ce,t as we,u as Te,v as Ee,w as De,x as Oe,y as ke}from"./preview-dialog-CApdSumg.js";import{$ as Ae,A as je,B as Me,C as Ne,D as Pe,E as Fe,F as Ie,G as Le,H as Re,I as ze,J as Be,K as Ve,L as He,M as Ue,N as We,O as Ge,P as Ke,Q as qe,R as Je,S as Ye,T as Xe,U as Ze,V as Qe,W as $e,X as et,Y as tt,Z as nt,g as rt,h as it,j as at,k as ot,l as st,n as ct,o as lt,p as ut,q as dt,t as ft,w as pt,x as mt,z as ht}from"./dist-BJ6NAVkJ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var gt=r((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),_t=r(((e,t)=>{t.exports=gt()})),vt=r((e=>{var t=_t(),r=n(),i=o();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(a(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return d(i),e;if(o===r)return d(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s){for(l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function m(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&m(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function h(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function g(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function _(e){var t=[null,null],n=h(e);return n===null||v(t,e,n.child,{foundSelf:!1}),t}function v(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&v(e,t,n.child,r))return!0;n=n.sibling}return!1}function y(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var b=null,x=null;function S(e,t,n){return e===n||e===t&&(b=e,!0)}function C(e,t,n){return e===n?(x=e,!1):e===t&&(x!==null&&(b=e),!0)}function w(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function T(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var E=Object.assign,D=Symbol.for(`react.element`),O=Symbol.for(`react.transitional.element`),k=Symbol.for(`react.portal`),A=Symbol.for(`react.fragment`),ee=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),te=Symbol.for(`react.consumer`),ne=Symbol.for(`react.context`),re=Symbol.for(`react.forward_ref`),ie=Symbol.for(`react.suspense`),ae=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.legacy_hidden`),le=Symbol.for(`react.memo_cache_sentinel`),ue=Symbol.for(`react.view_transition`),de=Symbol.for(`react.recoverable`),fe=Symbol.iterator;function pe(e){return typeof e!=`object`||!e?null:(e=fe&&e[fe]||e[`@@iterator`],typeof e==`function`?e:null)}var me=Symbol.for(`react.client.reference`);function he(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case A:return`Fragment`;case j:return`Profiler`;case ee:return`StrictMode`;case ie:return`Suspense`;case ae:return`SuspenseList`;case se:return`Activity`;case ue:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case k:return`Portal`;case ne:return e.displayName||`Context`;case te:return(e._context.displayName||`Context`)+`.Consumer`;case re:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?he(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}var ge=Array.isArray,N=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve={pending:!1,data:null,method:null,action:null},ye=[],be=-1;function xe(e){return{current:e}}function Se(e){0>be||(e.current=ye[be],ye[be]=null,be--)}function Ce(e,t){be++,ye[be]=e.current,e.current=t}var we=xe(null),Te=xe(null),Ee=xe(null),De=xe(null);function Oe(e,t){switch(Ce(Ee,t),Ce(Te,e),Ce(we,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Sp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Sp(t),e=Cp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Se(we),Ce(we,e)}function ke(){Se(we),Se(Te),Se(Ee)}function Ae(e){var t=e.memoizedState;t!==null&&(vh._currentValue=t.memoizedState,Ce(De,e)),t=we.current;var n=Cp(t,e.type);t!==n&&(Ce(Te,e),Ce(we,n))}function je(e){Te.current===e&&(Se(we),Se(Te)),De.current===e&&(Se(De),vh._currentValue=ve)}var Me,Ne;function Pe(e){if(Me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Me=t&&t[1]||``,Ne=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Me+e+Ne}var Fe=!1;function Ie(e,t){if(!e||Fe)return``;Fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -62,7 +62,7 @@ Error generating stack: `+e.message+`
|
|
|
62
62
|
|
|
63
63
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ti,c=!Qi.jitless,l=c&&ni.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Ms([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Fs(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=>!xi(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=>Di(e,r,$i())))}),t)}var Is=L(`$ZodUnion`,(e,t)=>{Ao.init(e,t),Hi(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),Hi(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Hi(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),Hi(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Hr(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Fs(t,r,e,i)):Fs(o,r,e,i)}}),Ls=L(`$ZodIntersection`,(e,t)=>{Ao.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])=>zs(e,t,n)):zs(e,i,a)}});function Rs(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ri(e)&&ri(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Rs(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=Rs(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 zs(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Rs(t.value,n.value);if(!c.valid){if(xi(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Bs=L(`$ZodEnum`,(e,t)=>{Ao.init(e,t);let n=Ir(t.entries),r=new Set(n);e._zod.values=r,Hi(e,`pattern`,e=>{let t=Ir(e.def.entries).filter(e=>ai.has(typeof e));return RegExp(t.length?`^(${t.map(e=>oi(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Vs=L(`$ZodTransform`,(e,t)=>{Ao.init(e,t),e._zod.optin=`optional`,Qi.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zi(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 Xi;return n.value=i,n}});function Hs(e,t){return e.value=t.issues.length?void 0:t.value,e}var Us=L(`$ZodOptional`,(e,t)=>{Ao.init(e,t),Hi(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,Hi(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),Hi(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Hr(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Hs(e,t)):Hs(e,r)}return t.innerType._zod.run(e,n)}}),Ws=L(`$ZodExactOptional`,(e,t)=>{Us.init(e,t),Hi(e,`values`,e=>e.def.innerType._zod.values),Hi(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Gs=L(`$ZodNullable`,(e,t)=>{Ao.init(e,t),Hi(e,`optin`,e=>e.def.innerType._zod.optin),Hi(e,`optout`,e=>e.def.innerType._zod.optout),Hi(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Hr(t.source)}|null)$`):void 0}),Hi(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ks=L(`$ZodDefault`,(e,t)=>{Ao.init(e,t),e._zod.optin=`defaulted`,Hi(e,`values`,e=>e.def.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=>qs(e,t)):qs(r,t)}});function qs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Js=L(`$ZodPrefault`,(e,t)=>{Ao.init(e,t),e._zod.optin=`defaulted`,Hi(e,`values`,e=>e.def.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))}),Ys=L(`$ZodNonOptional`,(e,t)=>{Ao.init(e,t),Hi(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>Xs(t,e)):Xs(i,e)}});function Xs(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Zs(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Di(e,r,$i()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Qs=L(`$ZodCatch`,(e,t)=>{Ao.init(e,t),Hi(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),Hi(e,`optout`,e=>e.def.innerType._zod.optout),Hi(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Zs(e,r,t,n)):Zs(e,r,t,n)}}),$s=L(`$ZodPipe`,(e,t)=>{Ao.init(e,t),Hi(e,`values`,e=>e.def.in._zod.values),Hi(e,`optin`,e=>e.def.in._zod.optin),Hi(e,`optout`,e=>e.def.out._zod.optout),Hi(e,`propValues`,e=>e.def.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=>ec(e,t.in,n)):ec(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ec(e,t.out,n)):ec(r,t.out,n)}});function ec(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var tc=L(`$ZodReadonly`,(e,t)=>{Ao.init(e,t),Hi(e,`propValues`,e=>e.def.innerType._zod.propValues),Hi(e,`values`,e=>e.def.innerType._zod.values),Hi(e,`optin`,e=>e.def.innerType?._zod?.optin),Hi(e,`optout`,e=>e.def.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(nc):nc(r)}});function nc(e){return e.memo||(e.value=Object.freeze(e.value)),e}var rc=L(`$ZodCustom`,(e,t)=>{lo.init(e,t),Ao.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=>ic(t,n,r,e));ic(i,n,r,e)}});function ic(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(Mi(e))}}var ac=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},oc=`~memo`,sc=[];function cc(e){return typeof e==`object`&&!!e}function lc(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var uc=new WeakMap,dc=0,fc=1,pc=2;function mc(e,t,n){let r=uc.get(e);if(r!==void 0)return r?pc:dc;if(t.has(e))return pc;t.add(e);let i=dc,a=e=>{if(i!==pc&&e?._zod){let r=mc(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=dc;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?fc:o.value?._zod?mc(o.value,t,n):dc;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Gr(c);s(e?o(e,!0):fc),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?mc(r,t,!1):fc);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),hc(e,i)}function hc(e,t){return t!==fc&&uc.set(e,t===pc),t}function gc(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var _c,vc=[],yc={alloc(e,t,n){let r=_c;if(!r)return n;_c=void 0;let i={value:n,issues:null};return r.set(t.value,i),vc.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&xc(n,e.value))throw new ac;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=mc(e,new Set,!1);if(i===dc)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===pc||r?n=!0:r=!0}let l=s.value;if(!cc(l))return t(s,c);let u=c[oc];u||(u={buckets:new WeakMap,backEdges:void 0},c[oc]=u);let d;i===c?d=a:(d=gc(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...lc(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;_c=d;let p=vc.length,m=t(s,c);_c=void 0;let h=vc.length>p?vc.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?lc(e.issues):sc),e)):(h&&(h.issues=m.issues.length?lc(m.issues):sc),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function bc(){return yc}function xc(e,t){let n=e[oc]?.backEdges;return n!==void 0&&cc(t)&&n.has(t)}var Sc=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(ji(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ci(e.values[0])}`:`Invalid option: expected one of ${Lr(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Lr(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Cc(){return{localeError:Sc()}}var wc,Tc=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 Ec(){return new Tc}(wc=globalThis).__zod_globalRegistry??(wc.__zod_globalRegistry=Ec());var Dc=globalThis.__zod_globalRegistry;function Oc(e){return e.checks&&=[...e.checks],e}function kc(e,t){return new e(Oc({type:`string`,...I(t)}))}function Ac(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...I(t)})}function jc(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...I(t)})}function Mc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...I(t)})}function Nc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...I(t)})}function Pc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...I(t)})}function Fc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...I(t)})}function Ic(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...I(t)})}function Lc(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...I(t)})}function Rc(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...I(t)})}function zc(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...I(t)})}function Bc(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...I(t)})}function Vc(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...I(t)})}function Hc(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...I(t)})}function Uc(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...I(t)})}function Wc(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...I(t)})}function Gc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...I(t)})}function Kc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...I(t)})}function qc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...I(t)})}function Jc(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...I(t)})}function Yc(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...I(t)})}function Xc(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...I(t)})}function Zc(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...I(t)})}function Qc(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...I(t)})}function $c(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...I(t)})}function el(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...I(t)})}function tl(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...I(t)})}function nl(e,t){return new e(Oc({type:`number`,checks:[],...I(t)}))}function rl(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...I(t)})}function il(e,t){return new e({type:`boolean`,...I(t)})}function al(e){return new e({type:`unknown`})}function ol(e,t){return new e({type:`never`,...I(t)})}function sl(e,t){return new po({check:`less_than`,...I(t),value:e,inclusive:!1})}function cl(e,t){return new po({check:`less_than`,...I(t),value:e,inclusive:!0})}function ll(e,t){return new mo({check:`greater_than`,...I(t),value:e,inclusive:!1})}function ul(e,t){return new mo({check:`greater_than`,...I(t),value:e,inclusive:!0})}function dl(e,t){return new ho({check:`multiple_of`,...I(t),value:e})}function fl(e,t){return new _o({check:`max_length`,...I(t),maximum:e})}function pl(e,t){return new vo({check:`min_length`,...I(t),minimum:e})}function ml(e,t){return new yo({check:`length_equals`,...I(t),length:e})}function hl(e,t){return new xo({check:`string_format`,format:`regex`,...I(t),pattern:e})}function gl(e){return new So({check:`string_format`,format:`lowercase`,...I(e)})}function _l(e){return new Co({check:`string_format`,format:`uppercase`,...I(e)})}function vl(e,t){return new wo({check:`string_format`,format:`includes`,...I(t),includes:e})}function yl(e,t){return new To({check:`string_format`,format:`starts_with`,...I(t),prefix:e})}function bl(e,t){return new Eo({check:`string_format`,format:`ends_with`,...I(t),suffix:e})}function xl(e){return new Do({check:`overwrite`,tx:e})}function Sl(e){return xl(t=>t.normalize(e))}function Cl(){return xl(e=>e.trim())}function wl(){return xl(e=>e.toLowerCase())}function Tl(){return xl(e=>e.toUpperCase())}function El(){return xl(e=>$r(e))}function Dl(e,t,n){return new e({type:`array`,element:t,...I(n)})}function Ol(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...I(n)})}function kl(e,t){let n=Al(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Mi(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Mi(r))}},e(t.value,t)),t);return n}function Al(e,t){let n=new lo({check:`custom`,...I(t)});return n._zod.check=e,n}function jl(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Wr(e,t,n[t]);return e}function Ml(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??Dc,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Nl(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Pl(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,Pl(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&jl(o.schema,c),t.io===`input`&&Wl(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Fl(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Il(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${Fl(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Fl(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>
|
|
64
64
|
|
|
65
|
-
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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ll(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ll(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Rl=new Set([`type`,`properties`,`required`,`additionalProperties`]),zl=[`oneOf`,`anyOf`];function Bl(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Vl(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Rl.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Bl(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Wr(n,r,e.length===1?e[0]:Vl(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Bl(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Hl(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Rl)if(t in e)return;let n=t.filter(e=>zl.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Vl(t);else{let e=n[0],i=zl.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Vl([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,jl(e,r))}function Ul(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)):jl(i,s),jl(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ll(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Hl(e)}}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)}jl(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Wr(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Kl(t,`input`,e.processors),output:Kl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Wl(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 Wl(r.element,n);if(r.type===`set`)return Wl(r.valueType,n);if(r.type===`lazy`)return Wl(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`||r.type===`catch`)return Wl(r.innerType,n);if(r.type===`intersection`)return Wl(r.left,n)||Wl(r.right,n);if(r.type===`record`||r.type===`map`)return Wl(r.keyType,n)||Wl(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Wl(r.in,n)||Wl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Wl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Wl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Wl(e,n))return!0;return!!(r.rest&&Wl(r.rest,n))}return!1}var Gl=(e,t={})=>n=>{let r=Ml({...n,processors:t});return Pl(e,r),Il(r,e),Ul(r,e)},Kl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ml({...i??{},target:a,io:t,processors:n});return Pl(e,o),Il(o,e),Ul(o,e)},ql=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Jl=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Yl=(e,t)=>{ql(e,`minimum`,t),Jl(e,`maximum`,t)},Xl=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Zl=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ql=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},$l=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},eu=(e,t)=>ql(e,`minimum`,t.minimum),tu=(e,t)=>Jl(e,`maximum`,t.maximum),nu=e=>(t,n)=>{$l(t,n.format);let[r,i]=e[n.format];ql(t,`minimum`,r),Jl(t,`maximum`,i)},ru={greater_than:(e,t)=>ql(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Jl(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Xl(e,t.value),number_format:nu(ui),bigint_format:nu(di),min_length:eu,max_length:tu,length_equals:(e,t)=>Yl(e,t.length),min_size:eu,max_size:tu,size_equals:(e,t)=>Yl(e,t.size),string_format:(e,t)=>{$l(e,t.format),t.pattern&&Zl(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ql(e,t.mime)};function iu(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ru[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ql(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ql(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Jl(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Jl(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Xl(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ql(t,i.mime);for(let e of i.patterns??[])Zl(t,e);return t}var au={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ou=new Map([[fs,Ja],[ms,Ya]]),su=e=>ou.get(e)??e,cu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=iu(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=au[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(su);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}))])}},lu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=iu(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Nl(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},uu=(e,t,n,r)=>{n.type=`boolean`},du=(e,t,n,r)=>{n.not={}},fu=(e,t,n,r)=>{let i=e._zod.def,a=Ir(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},pu=(e,t,n,r)=>{Nl(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},mu=(e,t,n,r)=>{Nl(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},hu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=iu(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Pl(a.element,t,{...r,path:[...r.path,`items`]})};function gu(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?gu(t.out):t.type===`catch`?gu(t.innerType):e._zod.optin}var _u=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Nl(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Wr(i.properties,e,Pl(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?gu(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Pl(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},vu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Pl(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},yu=(e,t,n,r)=>{let i=e._zod.def,a=Pl(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Pl(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},bu=(e,t,n,r)=>{let i=e._zod.def,a=Pl(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`}]},xu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Su=Symbol();function Cu(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Nl(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Su):JSON.parse(o)}var wu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Cu(i.defaultValue,e,t,n,r);o!==Su&&(n.default=o)},Tu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Cu(i.defaultValue,e,t,n,r);o!==Su&&(n._prefault=o)},Eu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Nl(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Du=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Pl(o,t,r);let s=t.seen.get(e);s.ref=o},Ou=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ku=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Au=new WeakSet([Object.prototype,Error.prototype]);function ju(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Mu=L(`ZodError`,(e,t)=>{oa.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Au.has(n)||(Au.add(n),ju(n,`format`,e=>t=>la(e,t)),ju(n,`flatten`,e=>t=>ca(e,t)),ju(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Rr,2)}),ju(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Rr,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Nu=pa(Mu),Pu=ma(Mu),Fu=ha(Mu),Iu=_a(Mu),Lu=Ca(Mu),Ru=wa(Mu),zu=Ta(Mu),Bu=Ea(Mu),Vu=Da(Mu),Hu=Oa(Mu),Uu=ka(Mu),Wu=Aa(Mu);function Gu(){Qi.localeError||$i(Cc())}function Ku(){Qi.memoizer||$i({memoizer:bc()})}var qu=L(`ZodType`,(e,t)=>(Gu(),Ao.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Zr(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return si(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lf(e,t))},superRefine(e,t){return this.check(uf(e,t))},overwrite(e){return this.check(xl(e))},optional(){return Wd(this)},exactOptional(){return Kd(this)},nullable(){return Jd(this)},nullish(){return Wd(Jd(this))},nonoptional(e){return ef(this,e)},array(){return Md(this)},or(e){return Id([this,e])},and(e){return Rd(this,e)},transform(e){return af(this,Hd(e))},default(e){return Xd(this,e)},prefault(e){return Qd(this,e)},catch(e){return nf(this,e)},pipe(e){return af(this,e)},readonly(){return sf(this)},describe(e){let t=this.clone();return Dc.add(t,{description:e}),t},meta(...e){if(e.length===0)return Dc.get(this);let t=this.clone();return Dc.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Fi(this,`~standard`,{...No(this),jsonSchema:{input:Kl(this,`input`),output:Kl(this,`output`)}})},set"~standard"(e){Pi(this,`~standard`,e)},parse:function e(t,n){return Nu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Pu(this,t,n,{callee:e})},safeParse(e,t){return Fu(this,e,t)},async safeParseAsync(e,t){return Iu(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Pi(this,`spa`,e)},validate(e,t){return ba(this,e,t)},validateAsync(e,t){return Sa(this,e,t)},encode:function e(t,n){return Lu(this,t,n,{callee:e})},decode:function e(t,n){return Ru(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await zu(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Bu(this,t,n,{callee:e})},safeEncode(e,t){return Vu(this,e,t)},safeDecode(e,t){return Hu(this,e,t)},async safeEncodeAsync(e,t){return Uu(this,e,t)},async safeDecodeAsync(e,t){return Wu(this,e,t)},toJSONSchema(e){return Gl(this,{})(e)},get description(){return Dc.get(this)?.description},get _def(){return this._zod.def}}),Ju=L(`_ZodString`,(e,t)=>{Po.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cu(e,t,n,r)},Ii({format:e=>iu(e).format??null,minLength:e=>iu(e).minimum??null,maxLength:e=>iu(e).maximum??null},{regex(...e){return this.check(hl(...e))},includes(...e){return this.check(vl(...e))},startsWith(...e){return this.check(yl(...e))},endsWith(...e){return this.check(bl(...e))},min(...e){return this.check(pl(...e))},max(...e){return this.check(fl(...e))},length(...e){return this.check(ml(...e))},nonempty(...e){return this.check(pl(1,...e))},lowercase(e){return this.check(gl(e))},uppercase(e){return this.check(_l(e))},trim(){return this.check(Cl())},normalize(...e){return this.check(Sl(...e))},toLowerCase(){return this.check(wl())},toUpperCase(){return this.check(Tl())},slugify(){return this.check(El())}})),Yu=L(`ZodString`,(e,t)=>{Po.init(e,t),Ju.init(e,t)},{email(e){return this.check(Ac(nd,e))},url(e){return this.check(Ic(ad,e))},jwt(e){return this.check(Zc(bd,e))},emoji(e){return this.check(Lc(od,e))},guid(e){return this.check(jc(rd,e))},uuid(e){return this.check(Mc(id,e))},uuidv4(e){return this.check(Nc(id,e))},uuidv6(e){return this.check(Pc(id,e))},uuidv7(e){return this.check(Fc(id,e))},nanoid(e){return this.check(Rc(sd,e))},cuid(e){return this.check(zc(cd,e))},cuid2(e){return this.check(Bc(ld,e))},ulid(e){return this.check(Vc(ud,e))},base64(e){return this.check(Jc(_d,e))},base64url(e){return this.check(Yc(vd,e))},xid(e){return this.check(Hc(dd,e))},ksuid(e){return this.check(Uc(fd,e))},ipv4(e){return this.check(Wc(pd,e))},ipv6(e){return this.check(Gc(md,e))},cidrv4(e){return this.check(Kc(hd,e))},cidrv6(e){return this.check(qc(gd,e))},e164(e){return this.check(Xc(yd,e))},datetime(e){return this.check(Qc(Qu,e))},date(e){return this.check($c($u,e))},time(e){return this.check(el(ed,e))},duration(e){return this.check(tl(td,e))}});function Xu(e){return kc(Yu,e)}var Zu=L(`ZodStringFormat`,(e,t)=>{Fo.init(e,t),Ju.init(e,t)}),Qu=L(`ZodISODateTime`,(e,t)=>{es.init(e,t),Zu.init(e,t)}),$u=L(`ZodISODate`,(e,t)=>{ts.init(e,t),Zu.init(e,t)}),ed=L(`ZodISOTime`,(e,t)=>{ns.init(e,t),Zu.init(e,t)}),td=L(`ZodISODuration`,(e,t)=>{rs.init(e,t),Zu.init(e,t)}),nd=L(`ZodEmail`,(e,t)=>{Ro.init(e,t),Zu.init(e,t)}),rd=L(`ZodGUID`,(e,t)=>{Io.init(e,t),Zu.init(e,t)}),id=L(`ZodUUID`,(e,t)=>{Lo.init(e,t),Zu.init(e,t)}),ad=L(`ZodURL`,(e,t)=>{Ko.init(e,t),Zu.init(e,t)}),od=L(`ZodEmoji`,(e,t)=>{qo.init(e,t),Zu.init(e,t)}),sd=L(`ZodNanoID`,(e,t)=>{Jo.init(e,t),Zu.init(e,t)}),cd=L(`ZodCUID`,(e,t)=>{Yo.init(e,t),Zu.init(e,t)}),ld=L(`ZodCUID2`,(e,t)=>{Xo.init(e,t),Zu.init(e,t)}),ud=L(`ZodULID`,(e,t)=>{Zo.init(e,t),Zu.init(e,t)}),dd=L(`ZodXID`,(e,t)=>{Qo.init(e,t),Zu.init(e,t)}),fd=L(`ZodKSUID`,(e,t)=>{$o.init(e,t),Zu.init(e,t)}),pd=L(`ZodIPv4`,(e,t)=>{is.init(e,t),Zu.init(e,t)}),md=L(`ZodIPv6`,(e,t)=>{ss.init(e,t),Zu.init(e,t)}),hd=L(`ZodCIDRv4`,(e,t)=>{cs.init(e,t),Zu.init(e,t)}),gd=L(`ZodCIDRv6`,(e,t)=>{us.init(e,t),Zu.init(e,t)}),_d=L(`ZodBase64`,(e,t)=>{ps.init(e,t),Zu.init(e,t)}),vd=L(`ZodBase64URL`,(e,t)=>{gs.init(e,t),Zu.init(e,t)}),yd=L(`ZodE164`,(e,t)=>{_s.init(e,t),Zu.init(e,t)}),bd=L(`ZodJWT`,(e,t)=>{ys.init(e,t),Zu.init(e,t)}),xd=L(`ZodNumber`,(e,t)=>{bs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lu(e,t,n,r),e.isFinite=!0},Ii({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=iu(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=iu(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=iu(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>iu(e).format??null},{gt(e,t){return this.check(ll(e,t))},gte(e,t){return this.check(ul(e,t))},min(e,t){return this.check(ul(e,t))},lt(e,t){return this.check(sl(e,t))},lte(e,t){return this.check(cl(e,t))},max(e,t){return this.check(cl(e,t))},int(e){return this.check(wd(e))},safe(e){return this.check(wd(e))},positive(e){return this.check(ll(0,e))},nonnegative(e){return this.check(ul(0,e))},negative(e){return this.check(sl(0,e))},nonpositive(e){return this.check(cl(0,e))},multipleOf(e,t){return this.check(dl(e,t))},step(e,t){return this.check(dl(e,t))},finite(){return this}}));function Sd(e){return nl(xd,e)}var Cd=L(`ZodNumberFormat`,(e,t)=>{xs.init(e,t),xd.init(e,t)});function wd(e){return rl(Cd,e)}var Td=L(`ZodBoolean`,(e,t)=>{Ss.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uu(e,t,n,r)});function Ed(e){return il(Td,e)}var Dd=L(`ZodUnknown`,(e,t)=>{Cs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Od(){return al(Dd)}var kd=L(`ZodNever`,(e,t)=>{ws.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>du(e,t,n,r)});function Ad(e){return ol(kd,e)}var jd=L(`ZodArray`,(e,t)=>{Ku(),Os.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hu(e,t,n,r),e.element=t.element},{min(e,t){return this.check(pl(e,t))},nonempty(e){return this.check(pl(1,e))},max(e,t){return this.check(fl(e,t))},length(e,t){return this.check(ml(e,t))},unwrap(){return this.element}});function Md(e,t){return Dl(jd,e,t)}var Nd=L(`ZodObject`,(e,t)=>{Ku(),Ps.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_u(e,t,n,r),Ui(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Bd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Zr(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Zr(this._zod.def,{catchall:Od()}))},loose(){return this.clone(Zr(this._zod.def,{catchall:Od()}))},strict(){return this.clone(Zr(this._zod.def,{catchall:Ad()}))},strip(){return this.clone(Zr(this._zod.def,{catchall:void 0}))},extend(e){return hi(this,e)},safeExtend(e){return _i(this,e)},merge(e){return vi(this,e)},pick(e){return fi(this,e)},omit(e){return mi(this,e)},partial(...e){return yi(Ud,this,e[0])},exactPartial(...e){return yi(Gd,this,e[0],`exactPartial`)},required(...e){return bi($d,this,e[0])}});function Pd(e,t){return new Nd({type:`object`,shape:e,catchall:Ad(),...I(t)})}var Fd=L(`ZodUnion`,(e,t)=>{Is.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vu(e,t,n,r),e.options=t.options});function Id(e,t){return new Fd({type:`union`,options:e,...I(t)})}var Ld=L(`ZodIntersection`,(e,t)=>{Ls.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yu(e,t,n,r)});function Rd(e,t){return new Ld({type:`intersection`,left:e,right:t})}var zd=L(`ZodEnum`,(e,t)=>{Bs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fu(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 zd({...t,checks:[],...I(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 zd({...t,checks:[],...I(r),entries:i})}});function Bd(e,t){return new zd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...I(t)})}var Vd=L(`ZodTransform`,(e,t)=>{Ku(),Vs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Mi(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Mi(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Hd(e){return new Vd({type:`transform`,transform:e})}var Ud=L(`ZodOptional`,(e,t)=>{Us.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wd(e){return new Ud({type:`optional`,innerType:e})}var Gd=L(`ZodExactOptional`,(e,t)=>{Ws.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kd(e){return new Gd({type:`optional`,innerType:e})}var qd=L(`ZodNullable`,(e,t)=>{Gs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jd(e){return new qd({type:`nullable`,innerType:e})}var Yd=L(`ZodDefault`,(e,t)=>{Ks.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Xd(e,t){return new Yd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ii(t)}})}var Zd=L(`ZodPrefault`,(e,t)=>{Js.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qd(e,t){return new Zd({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ii(t)}})}var $d=L(`ZodNonOptional`,(e,t)=>{Ys.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ef(e,t){return new $d({type:`nonoptional`,innerType:e,...I(t)})}var tf=L(`ZodCatch`,(e,t)=>{Qs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function nf(e,t){return new tf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Gi(t)})}var rf=L(`ZodPipe`,(e,t)=>{$s.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.in=t.in,e.out=t.out});function af(e,t){return new rf({type:`pipe`,in:e,out:t})}var of=L(`ZodReadonly`,(e,t)=>{tc.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sf(e){return new of({type:`readonly`,innerType:e})}var cf=L(`ZodCustom`,(e,t)=>{rc.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pu(e,t,n,r)});function lf(e,t={}){return Ol(cf,e,t)}function uf(e,t){return kl(e,t)}var df=Pd({theme:Xu().refine(e=>Fr.some(t=>t.id===e)).default(Fr[0].id),terminal:Pd({font:Pd({family:Xu().default(`FiraCode Nerd Font`),size:Sd().default(14),lineHeight:Sd().default(1.35),ligatures:Ed().default(!0)}).prefault({}),cursor:Pd({style:Bd([`block`,`bar`,`underline`]).default(`bar`),blink:Ed().default(!0)}).prefault({}),padding:Pd({top:Sd().default(4),right:Sd().default(4),bottom:Sd().default(0),left:Sd().default(4)}).prefault({}),scrollback:Sd().default(1e3),boldIsBright:Ed().default(!0),behavior:Pd({modernizeShiftEnter:Ed().default(!0),pasteBrowserImages:Ed().default(!0),captureShortcuts:Ed().default(!0),bellFlash:Ed().default(!0),bellSound:Ed().default(!0),clickToMoveCursor:Ed().default(!0),optionAsMeta:Bd([`off`,`left`,`right`,`both`]).default(`off`),confirmCloseBusyTab:Ed().default(!0)}).prefault({})}).prefault({}),diff:Pd({split:Ed().default(!1),wrap:Ed().default(!0)}).prefault({})}),ff=`prefs`,pf=df.parse({});function mf(){let e=localStorage.getItem(ff);if(e===null)return structuredClone(pf);let t=df.safeParse(JSON.parse(e));return t.success?t.data:(console.warn(`invalid stored prefs, using the defaults:\n${da(t.error)}`),structuredClone(pf))}function hf(e){localStorage.setItem(ff,JSON.stringify(e))}function gf(){let e=R().prefs.theme,t=Fr.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t}function _f(){let e=z(e=>e.prefs.theme),t=Fr.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t.codeTheme}function vf(){let e=gf(),t=document.documentElement.style;t.setProperty(`--bg`,e.background),t.setProperty(`--text`,e.foreground),t.setProperty(`--brand`,e.palette[4]),t.setProperty(`--danger`,e.palette[1]),t.setProperty(`--green`,e.palette[2]),t.setProperty(`--yellow`,e.palette[3]),document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e.background)}var yf={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`},bf;function xf(e){bf=Jn()(()=>e)}function Sf(e){return bf.subscribe(e)}function R(){return bf.getState()}function z(e){return Xn(bf,e)}function B(e){bf.setState(e)}function Cf(e,t){let n=e.machines.find(e=>e.id===t);if(n===void 0)throw Error(`unknown machine ${t}`);return n}function wf(e,t,n){return e.projects.find(e=>e.machine===t&&e.id===n)}function Tf(e){return e.selection?.machine??e.machines.at(0)?.id??null}function Ef(e,t){B({machines:R().machines.map(n=>n.id===e?{...n,...t}:n)})}function Df(e,t,n){if(n!==null)return e.find(e=>e.id===t)?.activity[n]}function Of(e){let t=e.selection;if(t!==null)return Df(e.machines,t.machine,t.sessionId)}function kf(e){return Of(e)?.running===!0}function Af(e){return Sr(e.machine,e.sessionId??e.projectId)}function jf(e){B({draft:e})}function Mf(e){B({paletteOpen:e})}function Nf(e){B({settingsOpen:e,paletteOpen:!1,...e&&{settingsMachine:Tf(R()),settingsAccount:null,settingsEditedMachine:null}})}function Pf(e){B({settingsOpen:!0,settingsPage:e,settingsAccount:null,settingsEditedMachine:null,paletteOpen:!1,...!R().settingsOpen&&{settingsMachine:Tf(R())}})}function Ff(e){B({prefs:e}),hf(e),vf()}function V(e){B({error:D(e)})}function If(){B({error:null})}function Lf(e){let t=new Map;function n(t,n){R().machines.some(e=>e.id===t)&&e.apply(t,n)}async function r(r,a){let o=await e.save(r,a),s=t.get(r);s!==void 0&&(--s.writes,!(s.writes>0)&&(o===null?await i(r):n(r,o)))}async function i(r){let i=t.get(r)?.version;try{let a=await e.load(r),o=t.get(r);o!==void 0&&o.writes===0&&o.version===i&&n(r,a)}catch(e){V(e)}}return{update(n,i){e.set(n,i);let a=t.get(n)??{writes:0,version:0,timer:void 0};t.set(n,a),a.timer===void 0&&(a.writes+=1),a.version+=1,window.clearTimeout(a.timer),a.timer=window.setTimeout(()=>{a.timer=void 0,r(n,i)},300)},receive(e,r){(t.get(e)?.writes??0)===0&&n(e,r)}}}var Rf=Lf({set:(e,t)=>Ef(e,{config:t}),save:async(e,t)=>{try{let n=await F(e,`config.save`,t);return Ef(e,{configError:null}),n}catch(t){return Ef(e,{configError:D(t)}),null}},load:async e=>(await F(e,`config.get`,void 0)).config,apply:(e,t)=>Ef(e,{config:t})}),zf=Lf({set:(e,t)=>Ef(e,{composer:t}),save:async(e,t)=>{try{return await F(e,`composer.save`,t)}catch(e){return V(e),null}},load:e=>F(e,`composer.get`,void 0),apply:Wf}),Bf=Rf.update,Vf=Rf.receive,Hf=zf.update,Uf=zf.receive;function Wf(e,t){Ef(e,{composer:t});let n=R().selection;if(n===null||n.machine!==e||Df(R().machines,e,n.sessionId)!==void 0)return;let r=(n.sessionId===null?null:fr(Af(n)))??Kf(t,n.sessionId===null?t.provider:R().settings.provider),i=r.provider!==R().settings.provider||r.accountId!==R().settings.accountId;B({settings:r}),i&&Xf()}var Gf={provider:`claude`,accountId:null,model:null,effort:null,mode:null,plan:!1};function Kf(e,t){return e===null?{...Gf,provider:t}:{provider:t,...e[t]}}function qf(e){let t={...R().settings,...e};B({settings:t});let n=R().selection;if(n===null)return;n.sessionId!==null&&pr(Af(n),t);let r=Cf(R(),n.machine).composer;r!==null&&Hf(n.machine,{...r,provider:t.provider,[t.provider]:{accountId:t.accountId,model:t.model,effort:t.effort,mode:t.mode,plan:t.plan}}),e.accountId!==void 0&&Xf(),n.sessionId!==null&&Df(R().machines,n.machine,n.sessionId)!==void 0&&e.accountId===void 0&&F(n.machine,`sessions.configure`,{sessionId:n.sessionId,settings:t}).catch(V)}function Jf(e,t){if(Ef(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),R().selection?.machine!==e)return;let n=R().settings,r=[...[...t.claudeAccounts,...t.codexAccounts].filter(e=>e.valid).map(e=>({provider:e.provider,accountId:e.id})),...t.openCode.available?[{provider:`opencode`,accountId:null}]:[]];if(r.some(e=>e.provider===n.provider&&e.accountId===n.accountId))return;let i=r.find(e=>e.provider===n.provider),a=R().selection?.sessionId===null?r.at(0):void 0;i===void 0?a===void 0?n.accountId!==null&&qf({accountId:null}):qf({...Kf(Cf(R(),e).composer,a.provider),accountId:a.accountId}):qf({accountId:i.accountId})}async function Yf(e){try{Jf(e,await F(e,`accounts.list`,void 0))}catch(e){V(e)}}async function Xf(){let e=R().selection;if(e===null)return;let{provider:t,accountId:n}=R().settings;if(t!==`opencode`&&n===null)B({capabilities:null});else try{let r=await F(e.machine,`capabilities`,{provider:t,accountId:n,projectId:e.projectId});if(R().selection?.machine!==e.machine||R().selection?.projectId!==e.projectId||R().settings.provider!==t||R().settings.accountId!==n)return;B({capabilities:r});let i=R().settings;if(i.model!==null){let e=r.models.find(e=>e.value===i.model)?.effort;i.provider!==`opencode`&&i.effort===null&&e!=null&&qf({effort:e});return}let a=r.models.find(e=>!e.hidden&&e.value===r.defaultModel)??r.models.find(e=>!e.hidden);if(a===void 0)return;qf({model:a.value,...a.effort===null?{}:{effort:a.effort}})}catch(e){V(e)}}var Zf={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`};function Qf(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function $f(e){let t=Math.round((Date.now()-e)/1e3);return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function ep(e){let t=new Date(e),n=t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`}),r=new Date,i=Math.round((new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime()-new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime())/864e5);return i<=0?n:i===1?`yesterday at ${n}`:`${t.toLocaleDateString(void 0,t.getFullYear()===r.getFullYear()?{month:`numeric`,day:`numeric`}:{month:`numeric`,day:`numeric`,year:`numeric`})} ${n}`}function tp(e){let t=new Date(e),n=t.getDate(),r=n%100>=11&&n%100<=13?`th`:n%10==1?`st`:n%10==2?`nd`:n%10==3?`rd`:`th`;return`${t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`})}, ${n}${r} ${t.toLocaleDateString(`en-US`,{month:`long`})} ${t.getFullYear()}`}function np(e){return new Intl.NumberFormat(void 0,{notation:`compact`}).format(e)}function rp(e){let t=Math.round(e),n=Math.floor(t/60),r=String(t%60).padStart(2,`0`);return n<60?`${n}:${r}`:`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}:${r}`}var ip=`notifications`,ap=Promise.resolve(),op=new Set;function sp(){return window.isSecureContext?!(`Notification`in window)||!(`serviceWorker`in navigator)?`unsupported`:Notification.permission:`insecure`}function cp(){let e=localStorage.getItem(ip);if(e===null||e===`on`)return!0;if(e===`off`)return!1;throw Error(`unknown notification setting ${e}`)}async function lp(e){e&&Notification.permission==="default"&&await Notification.requestPermission(),localStorage.setItem(ip,e?`on`:`off`)}async function up(e,t){(await navigator.permissions.query({name:`notifications`})).addEventListener(`change`,t,{signal:e})}function dp(e,t,n){if(document.hidden)for(let r of t){let t=pp(e,r);mp(e,r,`${t===void 0?`Agent`:Zf[t.provider]} ${n}`,t?.title??`Session`,Sr(e,r)).catch(e=>console.error(`could not show a notification`,e))}}function fp(e,t,n){mp(e,t,pp(e,t)?.title??`Session`,n,`push:${Sr(e,t)}`).catch(e=>console.error(`could not show a notification`,e))}function pp(e,t){return R().sessions.find(n=>n.machine===e&&n.id===t)}async function mp(e,t,n,r,i){if(sp()!==`granted`||!cp()||!Cf(R(),e).notifier)return;let a=pp(e,t);await(await navigator.serviceWorker.ready).showNotification(n,{body:r,tag:i,data:a===void 0?null:{kind:`session`,machine:e,project:a.projectId,sessionId:t}})}async function hp(e,t,n){sp()===`granted`&&cp()&&Cf(R(),n.machine).notifier&&await(await navigator.serviceWorker.ready).showNotification(e,{body:t,data:{kind:`terminal`,...n}})}function gp(){let e=R().machines.filter(e=>Xt(e.id)&&!e.notifier&&!op.has(e.id)).map(e=>e.id);if(e.length!==0){for(let t of e)op.add(t);_p().then(t=>Promise.all(e.map(e=>F(e,`notifications.claim`,{endpoint:t})))).catch(e=>console.error(`could not claim notifications`,e)).finally(()=>{for(let t of e)op.delete(t)})}}async function _p(){if(vp()!==`supported`)return null;let e=await navigator.serviceWorker.getRegistration();if(e===void 0)return null;let t=await e.pushManager.getSubscription();return t===null?null:t.endpoint}function vp(){return window.isSecureContext?!(`Notification`in window)||!(`serviceWorker`in navigator)||!(`PushManager`in window)?yp()?`install`:`unsupported`:Notification.permission===`denied`?`denied`:`supported`:`insecure`}function yp(){return/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.userAgent.includes(`Mac`)&&navigator.maxTouchPoints>1}async function bp(){return await(await navigator.serviceWorker.ready).pushManager.getSubscription()!==null}async function xp(){return Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission===`granted`&&(await wp(Tp),!0)}function Sp(){return wp(Ep)}function Cp(e){return wp(async()=>{if(vp()!==`supported`)return;let t=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!t)return;let n=await Dp(),r=t.options.applicationServerKey;r!==null&&kp(r)===n.publicKey?await Ap(e,t,n):await Tp()})}function wp(e){let t=ap.then(e);return ap=t.catch(()=>void 0),t}async function Tp(){await Ep();let e=await Dp(),t=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e.publicKey});await Promise.all(Op().map(n=>Ap(n,t,e)))}async function Ep(){let e=await(await navigator.serviceWorker.ready).pushManager.getSubscription();e&&(await Promise.all(Op().map(t=>F(t,`push.unsubscribe`,{endpoint:e.endpoint}))),await e.unsubscribe())}async function Dp(){let e=await caches.open(`offsite-worker`),t=await e.match(`/push-keys`);if(t!==void 0)return await t.json();let n=await crypto.subtle.generateKey({name:`ECDSA`,namedCurve:`P-256`},!0,[`sign`,`verify`]),r=(await crypto.subtle.exportKey(`jwk`,n.privateKey)).d;if(r===void 0)throw Error(`the browser did not export the push key`);let i={publicKey:kp(await crypto.subtle.exportKey(`raw`,n.publicKey)),privateKey:r};return await e.put(`/push-keys`,new Response(JSON.stringify(i))),i}function Op(){return R().machines.filter(e=>Xt(e.id)).map(e=>e.id)}function kp(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}async function Ap(e,t,n){await F(e,`push.subscribe`,{subscription:t.toJSON(),...n,machine:e})}function jp(){let e=_r(),t=mr(e.map(e=>e.id));xf({machines:e.map(Cr),sessions:[],projects:e.flatMap(wr),prefs:mf(),paletteOpen:!1,settingsOpen:!1,settingsPage:`General`,settingsAccount:null,settingsEditedMachine:null,settingsMachine:e.at(0)?.id??null,unseen:[],selection:t,loaded:t?.sessionId===null,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],settings:(t===null||t.sessionId===null?null:fr(Af(t)))??Gf,draft:null,context:null,capabilities:null,error:null,sentAt:0}),vf(),Yt({open:(e,t)=>{Ef(e,{via:t}),Np(e)},close:e=>{let t=R().machines.find(t=>t.id===e);t!==void 0&&t.status!==`offline`&&Ef(e,{status:`offline`,via:null,notifier:!1})},unpaired:e=>Ef(e,{status:`unpaired`,via:null,notifier:!1}),event:Lp}),addEventListener(`keydown`,gp,{capture:!0}),addEventListener(`pointerdown`,gp,{capture:!0}),addEventListener(`storage`,e=>{e.key===`machines`&&Tr()});for(let t of e)qt(t.id,t.addresses);Ar(e),Mp()}async function Mp(){try{let e=br();e!==null&&await Er(e.address,e.code)}catch(e){V(e)}}async function Np(e){try{let t=await F(e,`sync`,void 0),n=R().machines.find(t=>t.id===e);if(n===void 0)return;Ef(e,{status:`online`,name:n.label??t.hostname,hostname:t.hostname,system:{defaults:t.defaults,platform:t.platform,defaultShell:t.defaultShell,defaultClaudeBaseDir:t.defaultClaudeBaseDir},activity:t.activity,providers:t.providers}),Pp(e,t.projects),Fp(e,t.sessions),Vf(e,t.config),Uf(e,t.composer),Ip(e),Yf(e),R().selection?.machine===e&&Xf()}catch(e){V(e)}}function Pp(e,t){B({projects:[...R().projects.filter(t=>t.machine!==e),...t.map(t=>({...t,machine:e}))]}),Pr()}function Fp(e,t){B({sessions:[...R().sessions.filter(t=>t.machine!==e),...t.map(t=>({...t,machine:e}))]})}function Ip(e){let t=R().selection;t?.machine===e&&t.sessionId!==null&&F(e,`sessions.open`,{projectId:t.projectId,sessionId:t.sessionId}).catch(V)}function Lp(e,t){let n=R(),r=n.machines.find(t=>t.id===e);if(r===void 0)return;let i=n.selection?.machine===e,a=i?n.selection?.sessionId??null:null;switch(t.type){case`activity`:{let o=r.activity,s=a!==null&&t.activity[a]?.running===!0,c=Object.keys(o).filter(e=>o[e].running&&t.activity[e]?.running!==!0),l=Object.keys(t.activity).filter(e=>t.activity[e].waiting&&o[e]?.waiting!==!0);dp(e,c.filter(e=>o[e].prompted),`finished`),dp(e,l,`needs your input`),Ef(e,{activity:t.activity}),B({partial:s||!i?n.partial:``,unseen:[...n.unseen,...c.filter(e=>e!==a).map(t=>Sr(e,t)).filter(e=>!n.unseen.includes(e))]});return}case`limits`:Ef(e,{claudeAccounts:r.claudeAccounts.map(e=>e.id===t.accountId?{...e,limits:t.limits}:e),codexAccounts:r.codexAccounts.map(e=>e.id===t.accountId?{...e,limits:t.limits}:e)});return;case`config`:Vf(e,t.config);return;case`composer`:Uf(e,t.composer);return;case`projects`:Pp(e,t.projects);return;case`sessions`:Fp(e,t.sessions);return;case`accounts`:Jf(e,t);return;case`providers`:Ef(e,{providers:t.providers});return;case`started`:if(n.selection===null||!i||n.selection.projectId!==t.projectId||n.selection.sessionId!==null)return;B({selection:{machine:e,projectId:t.projectId,sessionId:t.sessionId},loaded:!0,items:[],earlier:[],before:null,partial:``,requests:[],queue:[]}),hr();return;case`notification`:fp(e,t.sessionId,t.message);return;case`notifier`:Ef(e,{notifier:t.active});return}if(a!==null&&t.sessionId===a)switch(t.type){case`history`:B({loaded:!0,items:t.items,earlier:[],before:t.before,requests:t.requests,queue:t.queue,settings:t.settings??(n.settings.provider===t.provider?n.settings:Kf(Cf(n,e).composer,t.provider)),context:t.context,partial:t.partial}),t.settings!==null&&pr(Sr(e,t.sessionId),t.settings);return;case`context`:B({context:t.context});return;case`items`:{let e=new Map(t.items.map(e=>[e.id,e]));B({items:[...n.items.map(t=>e.get(t.id)??t),...t.items.filter(e=>!n.items.some(t=>t.id===e.id))],partial:t.items.some(e=>e.kind===`assistant`&&e.parent===null)?``:n.partial});return}case`delta`:B({partial:n.partial+t.text});return;case`request`:B({requests:[...n.requests,t.request]});return;case`requestDone`:B({requests:n.requests.filter(e=>e.id!==t.requestId)});return;case`queue`:B({queue:t.queue});return;case`settings`:{let r={...t.settings,accountId:n.settings.accountId};B({settings:r}),pr(Sr(e,t.sessionId),r)}}}var H=i(),Rp=Object.defineProperty,zp=(e,t)=>Rp(e,`name`,{value:t,configurable:!0});function Bp(e){let t=e+`CollectionProvider`,[n,r]=h(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=zp(e=>{let{scope:t,children:n}=e,r=P.useRef(null),a=P.useRef(new Map).current;return(0,H.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=k(s),l=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(s,n),o=O(t,i.collectionRef);return(0,H.jsx)(c,{ref:o,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=k(u),p=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),s=O(t,o),c=a(u,n);return P.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,H.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return P.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return zp(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}zp(Bp,`createCollection`);var Vp=new WeakMap,Hp=class e extends Map{static{zp(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],Vp.set(this,!0)}set(e,t){return Vp.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=Gp(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=Up(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Up(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Up(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function Up(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=Wp(e,t);return n===-1?void 0:e[n]}zp(Up,`at`);function Wp(e,t){let n=e.length,r=Gp(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}zp(Wp,`toSafeIndex`);function Gp(e){return e!==e||e===0?0:Math.trunc(e)}zp(Gp,`toSafeInteger`);function Kp(e){let t=e+`CollectionProvider`,[n,r]=h(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,s]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let c=zp(({state:e,...t})=>e?(0,H.jsx)(u,{...t,state:e}):(0,H.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=zp(e=>{let t=y();return(0,H.jsx)(u,{...e,state:t})},`CollectionInit`);l.displayName=e+`CollectionInit`;let u=zp(e=>{let{scope:t,children:n,state:r}=e,a=P.useRef(null),[s,c]=P.useState(null),l=O(a,c),[u,d]=r,f=P.useRef(new Hp),p=P.useCallback(()=>{let e=f.current;return Yp(e)||e.sort(Xp),e},[]);return P.useEffect(()=>{if(!s)return;let e=Zp(()=>{d(e=>{let t=e.toSorted(Xp);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s,d]),(0,H.jsx)(i,{scope:t,collectionElementRef:l,collectionElementRefObject:a,getCollection:p,setCollection:d,registryRef:f,children:(0,H.jsx)(o,{scope:t,collectionElement:s,collection:u,children:n})})},`CollectionProviderImpl`);u.displayName=e+`CollectionProviderImpl`;let d=e+`CollectionSlot`,f=k(d),p=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(d,n),o=O(t,i.collectionElementRef);return(0,H.jsx)(f,{ref:o,children:r})});p.displayName=d;let m=e+`CollectionItemSlot`,_=k(m),v=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),{setCollection:s,registryRef:c}=a(m,n),l=P.useRef(i);qp(l.current,i)||(l.current=i);let u=l.current,d=P.useCallback(e=>{let t=c.current;e?t.set(e,{...l.current,element:e}):o.current&&t.delete(o.current)},[c]),f=O(t,d,o);g(()=>{let e=o.current,t=c.current;e&&t.has(e)&&t.set(e,{...u,element:e})},[u,c]);let p=P.useRef(null);return P.useEffect(()=>{let e=o.current,t=p.current;((t?.element??null)!==e||e&&t?.itemData!==u)&&(p.current=e?{element:e,itemData:u}:null,s(n=>{let r=new Hp(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...u,element:e}),r.sort(Xp)}))}),P.useEffect(()=>()=>{let e=p.current;p.current=null,e&&s(t=>{if(!t.has(e.element))return t;let n=new Hp(t);return n.delete(e.element),n})},[s]),(0,H.jsx)(_,{"data-radix-collection-item":``,ref:f,children:r})});v.displayName=m;function y(){return P.useState(new Hp)}zp(y,`useInitCollection`);function b(t){let{collection:n}=s(e+`CollectionConsumer`,t);return n}zp(b,`useCollection`);function x(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return zp(x,`useGetCollection`),[{Provider:c,Slot:p,ItemSlot:v},{createCollectionScope:r,useCollection:b,useGetCollection:x,useInitCollection:y}]}zp(Kp,`createCollection`);function qp(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}zp(qp,`shallowEqual`);function Jp(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}zp(Jp,`isElementPreceding`);function Yp(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}zp(Yp,`isInDocumentOrder`);function Xp(e,t){return!e[1].element||!t[1].element?0:Jp(e[1].element,t[1].element)?-1:1}zp(Xp,`sortByDocumentPosition`);function Zp(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}zp(Zp,`getChildListObserver`);var Qp=Object.defineProperty,$p=(e,t)=>Qp(e,`name`,{value:t,configurable:!0}),em={LTR:`ltr`,RTL:`rtl`},tm=P.createContext(void 0);function nm(e){let t=P.useContext(tm);return e||t||em.LTR}$p(nm,`useDirection`);var rm=Object.defineProperty,im=(e,t)=>rm(e,`name`,{value:t,configurable:!0}),[am,om]=h(`AlertDialog`,[se]),sm=se(),cm=im(e=>{let{__scopeAlertDialog:t,...n}=e,r=sm(t);return(0,H.jsx)(ve,{...r,...n,modal:!0})},`AlertDialog`),lm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(Oe,{...i,...r,ref:t})},`AlertDialogTrigger`)),um=im(e=>{let{__scopeAlertDialog:t,...n}=e,r=sm(t);return(0,H.jsx)(ke,{...r,...n})},`AlertDialogPortal`),dm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(Ee,{...i,...r,ref:t})},`AlertDialogOverlay`)),[fm,pm]=am(`AlertDialogContent`),mm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=sm(n),o=P.useRef(null),s=O(t,o),c=P.useRef(null);return(0,H.jsx)(fm,{scope:n,cancelRef:c,children:(0,H.jsx)(he,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:v(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),hm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(de,{...i,...r,ref:t})},`AlertDialogTitle`)),gm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(le,{...i,...r,ref:t})},`AlertDialogDescription`)),_m=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(ge,{...i,...r,ref:t})},`AlertDialogAction`)),vm=`AlertDialogCancel`,ym=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=pm(vm,n),a=sm(n),o=O(t,i);return(0,H.jsx)(ge,{...a,...r,ref:o})},`AlertDialogCancel`)),bm=Object.defineProperty,xm=(e,t)=>bm(e,`name`,{value:t,configurable:!0}),Sm=!1;function Cm(){let[e,t]=P.useState(Sm);return P.useEffect(()=>{Sm||(Sm=!0,t(!0))},[]),e}xm(Cm,`useIsHydrated`);var wm=P.useSyncExternalStore;function Tm(){return()=>{}}xm(Tm,`subscribe`);function Em(){return wm(Tm,()=>!0,()=>!1)}xm(Em,`useIsHydratedModern`);var Dm=typeof wm==`function`?Em:Cm,Om=Object.defineProperty,km=(e,t)=>Om(e,`name`,{value:t,configurable:!0}),Am=`rovingFocusGroup.onEntryFocus`,jm={bubbles:!1,cancelable:!0},Mm=`RovingFocusGroup`,[Nm,Pm,Fm]=Bp(Mm),[Im,Lm]=h(Mm,[Fm]),Rm={Vertical:`vertical`,Horizontal:`horizontal`},zm={LTR:`ltr`,RTL:`rtl`},[Bm,Vm]=Im(Mm),Hm=P.forwardRef(km(function(e,t){return(0,H.jsx)(Nm.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(Nm.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(Um,{...e,ref:t})})})},`RovingFocusGroup`)),Um=P.forwardRef(km(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...f}=e,p=P.useRef(null),m=O(t,p),h=nm(a),[g,_]=x({prop:o,defaultProp:s??null,onChange:c,caller:Mm}),[y,b]=P.useState(!1),S=T(l),C=Pm(n),w=P.useRef(!1),[E,D]=P.useState(0);return P.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(Am,S),()=>e.removeEventListener(Am,S)},[S]),(0,H.jsx)(Bm,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:P.useCallback(e=>_(e),[_]),onItemShiftTab:P.useCallback(()=>b(!0),[]),onFocusableItemAdd:P.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:P.useCallback(()=>D(e=>e-1),[]),children:(0,H.jsx)(u.div,{tabIndex:y||E===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:`none`,...e.style},onMouseDown:v(e.onMouseDown,()=>{w.current=!0}),onFocus:v(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(Am,jm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=C().filter(e=>e.focusable);Ym([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),d)}}w.current=!1}),onBlur:v(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Wm=`RovingFocusGroupItem`,Gm=P.forwardRef(km(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=p(),l=a||c,d=Vm(Wm,n),f=d.currentTabStopId===l,m=Pm(n),{onFocusableItemAdd:h,onFocusableItemRemove:_,currentTabStopId:y}=d,b=Dm();return g(()=>{if(b&&r)return h(),()=>_()},[b,r,h,_]),P.useEffect(()=>{if(!b&&r)return h(),()=>_()},[b,r,h,_]),(0,H.jsx)(Nm.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(u.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:v(e.onMouseDown,e=>{r?d.onItemFocus(l):e.preventDefault()}),onFocus:v(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:v(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Jm(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?Xm(n,r+1):n.slice(r+1)}setTimeout(()=>Ym(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:y!=null}):o})})},`RovingFocusGroupItem`)),Km={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function qm(e,t){return t===zm.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}km(qm,`getDirectionAwareKey`);function Jm(e,t,n){let r=qm(e.key,n);if(!(t===Rm.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Rm.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return Km[r]}km(Jm,`getFocusIntent`);function Ym(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}km(Ym,`focusFirst`);function Xm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}km(Xm,`wrapArray`);var Zm=Object.defineProperty,Qm=(e,t)=>Zm(e,`name`,{value:t,configurable:!0}),$m={LTR:`ltr`,RTL:`rtl`},eh=[`Enter`,` `],th=[`ArrowDown`,`PageUp`,`Home`],nh=[`ArrowUp`,`PageDown`,`End`],rh=[...th,...nh],ih={ltr:[...eh,`ArrowRight`],rtl:[...eh,`ArrowLeft`]},ah={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},oh=`Menu`,[sh,ch,lh]=Bp(oh),[uh,dh]=h(oh,[lh,ae,Lm]),fh=ae(),ph=Lm(),[mh,hh]=uh(oh),[gh,_h]=uh(oh),vh=Qm(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=fh(t),[c,l]=P.useState(null),u=P.useRef(!1),d=T(a),f=nm(i);return P.useEffect(()=>{let e=Qm(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Qm(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),P.useEffect(()=>{if(!n)return;let e=Qm(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,H.jsx)(j,{...s,children:(0,H.jsx)(mh,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,H.jsx)(gh,{scope:t,onClose:P.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),yh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e,i=fh(n);return(0,H.jsx)(A,{...i,...r,ref:t})},`MenuAnchor`)),bh=`MenuPortal`,[xh,Sh]=uh(bh,{forceMount:void 0}),Ch=Qm(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=hh(bh,t);return(0,H.jsx)(xh,{scope:t,forceMount:n,children:(0,H.jsx)(m,{present:n||a.open,children:(0,H.jsx)(S,{asChild:!0,container:i,children:r})})})},`MenuPortal`),wh=`MenuContent`,[Th,Eh]=uh(wh),Dh=P.forwardRef(Qm(function(e,t){let n=Sh(wh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=hh(wh,e.__scopeMenu),o=_h(wh,e.__scopeMenu);return(0,H.jsx)(sh.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(m,{present:r||a.open,children:(0,H.jsx)(sh.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(Oh,{...i,ref:t}):(0,H.jsx)(kh,{...i,ref:t})})})})},`MenuContent`)),Oh=P.forwardRef(Qm(function(e,t){let n=hh(wh,e.__scopeMenu),r=P.useRef(null),i=O(t,r);return P.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,H.jsx)(jh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:v(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),kh=P.forwardRef(Qm(function(e,t){let n=hh(wh,e.__scopeMenu);return(0,H.jsx)(jh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Ah=k(`MenuContent.ScrollLock`),jh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,...y}=e,x=hh(wh,n),S=_h(wh,n),w=fh(n),T=ph(n),E=ch(n),[D,k]=P.useState(null),A=P.useRef(null),[ee,j]=P.useState(null);b(ee);let{nodes:te,registry:ne}=C(),ie=!!(i||g),ae=O(t,A,x.onContentChange,j),M=P.useRef(0),oe=P.useRef(``),se=P.useRef(0),le=P.useRef(null),ue=P.useRef(`right`),de=P.useRef(0),fe=P.useMemo(()=>g?[A,...te.map(e=>({current:e}))]:[],[A,te,g]),pe=g?De:P.Fragment,me=g?{as:Ah,allowPinchZoom:!0,shards:fe}:void 0,he=Qm(e=>{let t=oe.current+e,n=E().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=cg(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){oe.current=e,window.clearTimeout(M.current),e!==``&&(M.current=window.setTimeout(()=>s(``),1e3))}Qm(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);P.useEffect(()=>()=>window.clearTimeout(M.current),[]),ce();let ge=P.useCallback(e=>ue.current===le.current?.side&&ug(e,le.current?.area),[]);return(0,H.jsx)(Th,{scope:n,searchRef:oe,onItemEnter:P.useCallback(e=>{ge(e)&&e.preventDefault()},[ge]),onItemLeave:P.useCallback(e=>{ge(e)||(A.current?.focus(),k(null))},[ge]),onTriggerLeave:P.useCallback(e=>{ge(e)&&e.preventDefault()},[ge]),pointerGraceTimerRef:se,onPointerGraceIntentChange:P.useCallback(e=>{le.current=e},[]),children:(0,H.jsx)(d,{registry:ie?ne:null,children:(0,H.jsx)(pe,{...me,children:(0,H.jsx)(_,{asChild:!0,trapped:i,branches:te,onMountAutoFocus:v(a,e=>{e.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(f,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,H.jsx)(Hm,{asChild:!0,...T,dir:S.dir,orientation:`vertical`,loop:r,currentTabStopId:D,onCurrentTabStopIdChange:k,onEntryFocus:v(c,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(re,{role:`menu`,"aria-orientation":`vertical`,"data-state":rg(x.open),"data-radix-menu-content":``,dir:S.dir,...w,...y,ref:ae,style:{outline:`none`,...y.style},onKeyDown:v(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&he(e.key));let i=A.current;if(e.target!==i||!rh.includes(e.key))return;e.preventDefault();let a=E().filter(e=>!e.disabled).map(e=>e.ref.current);nh.includes(e.key)&&a.reverse(),og(a)}),onBlur:v(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(M.current),oe.current=``)}),onPointerMove:v(e.onPointerMove,dg(e=>{let t=e.target,n=de.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>de.current?`right`:`left`;ue.current=t,de.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Mh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(u.div,{role:`group`,...r,ref:t})},`MenuGroup`)),Nh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(u.div,{...r,ref:t})},`MenuLabel`)),Ph=`MenuItem`,Fh=`menu.itemSelect`,Ih=P.forwardRef(Qm(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=P.useRef(null),o=_h(Ph,e.__scopeMenu),s=Eh(Ph,e.__scopeMenu),c=O(t,a),l=P.useRef(!1),u=Qm(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Fh,{bubbles:!0,cancelable:!0});e.addEventListener(Fh,e=>r?.(e),{once:!0}),E(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,H.jsx)(Lh,{...i,ref:c,disabled:n,onClick:v(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:v(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:v(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&eh.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Lh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Eh(Ph,n),s=ph(n),c=P.useRef(null),l=O(t,c),[d,f]=P.useState(!1),[p,m]=P.useState(``);return P.useEffect(()=>{let e=c.current;e&&m((e.textContent??``).trim())},[a.children]),(0,H.jsx)(sh.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,H.jsx)(Gm,{asChild:!0,...s,focusable:!r,children:(0,H.jsx)(u.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:v(e.onPointerMove,dg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:v(e.onPointerLeave,dg(e=>o.onItemLeave(e))),onFocus:v(e.onFocus,()=>f(!0)),onBlur:v(e.onBlur,()=>f(!1))})})})},`MenuItemImpl`)),Rh=P.forwardRef(Qm(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(Gh,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(Ih,{role:`menuitemcheckbox`,"aria-checked":ig(n)?`mixed`:n,...i,ref:t,"data-state":ag(n),onSelect:v(i.onSelect,()=>r?.(ig(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[zh,Bh]=uh(`MenuRadioGroup`,{value:void 0,onValueChange:Qm(()=>{},`onValueChange`)}),Vh=P.forwardRef(Qm(function(e,t){let{value:n,onValueChange:r,...i}=e,a=T(r);return(0,H.jsx)(zh,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,H.jsx)(Mh,{...i,ref:t})})},`MenuRadioGroup`)),Hh=`MenuRadioItem`,Uh=P.forwardRef(Qm(function(e,t){let{value:n,...r}=e,i=Bh(Hh,e.__scopeMenu),a=n===i.value;return(0,H.jsx)(Gh,{scope:e.__scopeMenu,checked:a,children:(0,H.jsx)(Ih,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ag(a),onSelect:v(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),Wh=`MenuItemIndicator`,[Gh,Kh]=uh(Wh,{checked:!1}),qh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=Kh(Wh,n);return(0,H.jsx)(m,{present:r||ig(a.checked)||a.checked===!0,children:(0,H.jsx)(u.span,{...i,ref:t,"data-state":ag(a.checked)})})},`MenuItemIndicator`)),Jh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(u.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),Yh=`MenuSub`,[Xh,Zh]=uh(Yh),Qh=Qm(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=hh(Yh,t),o=fh(t),[s,c]=P.useState(null),[l,u]=P.useState(null),d=T(i);return P.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,H.jsx)(j,{...o,children:(0,H.jsx)(mh,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,H.jsx)(Xh,{scope:t,contentId:p(),triggerId:p(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),$h=`MenuSubTrigger`,eg=P.forwardRef(Qm(function(e,t){let n=hh($h,e.__scopeMenu),r=_h($h,e.__scopeMenu),i=Zh($h,e.__scopeMenu),a=Eh($h,e.__scopeMenu),o=P.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=P.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);P.useEffect(()=>u,[u]),P.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=O(t,i.onTriggerChange);return(0,H.jsx)(yh,{asChild:!0,...l,children:(0,H.jsx)(Lh,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":rg(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:v(e.onPointerMove,dg(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:v(e.onPointerLeave,dg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:v(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(a.searchRef.current===``||t.key!==` `)&&ih[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),tg=`MenuSubContent`,ng=P.forwardRef(Qm(function(e,t){let n=Sh(wh,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=hh(wh,e.__scopeMenu),s=_h(wh,e.__scopeMenu),c=Zh(tg,e.__scopeMenu),l=P.useRef(null),u=O(t,l);return(0,H.jsx)(sh.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(m,{present:r||o.open,children:(0,H.jsx)(sh.Slot,{scope:e.__scopeMenu,children:(0,H.jsx)(jh,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===$m.RTL?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:v(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:v(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:v(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ah[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function rg(e){return e?`open`:`closed`}Qm(rg,`getOpenState`);function ig(e){return e===`indeterminate`}Qm(ig,`isIndeterminate`);function ag(e){return ig(e)?`indeterminate`:e?`checked`:`unchecked`}Qm(ag,`getCheckedState`);function og(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Qm(og,`focusFirst`);function sg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Qm(sg,`wrapArray`);function cg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=sg(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Qm(cg,`getNextMatch`);function lg(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Qm(lg,`isPointInPolygon`);function ug(e,t){return t?lg({x:e.clientX,y:e.clientY},t):!1}Qm(ug,`isPointerInGraceArea`);function dg(e){return t=>t.pointerType===`mouse`?e(t):void 0}Qm(dg,`whenMouse`);var fg=Object.defineProperty,pg=(e,t)=>fg(e,`name`,{value:t,configurable:!0}),mg=`ContextMenu`,[hg,eee]=h(mg,[dh]),gg=dh(),[_g,vg]=hg(mg),yg=pg(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=P.useRef(!1),[c,l]=x({prop:i,defaultProp:!1,onChange:r,caller:mg}),u=gg(t);return(0,H.jsx)(_g,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,H.jsx)(vh,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),bg=`ContextMenuTrigger`,xg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=vg(bg,n),o=gg(n),[s,c]=P.useState({x:0,y:0}),l=P.useMemo(()=>({current:{getBoundingClientRect:pg(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),d=P.useRef(0),f=P.useCallback(()=>window.clearTimeout(d.current),[]),p=pg(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return P.useEffect(()=>f,[f]),P.useEffect(()=>void(r&&f()),[r,f]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(yh,{...o,virtualRef:l}),(0,H.jsx)(u.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:v(e.onContextMenu,e=>{f(),p(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:v(e.onPointerDown,Og(e=>{f(),a.open&&a.onOpenChange(!1),d.current=window.setTimeout(()=>p(e),700)})),onPointerMove:r?e.onPointerMove:v(e.onPointerMove,Og(f)),onPointerCancel:r?e.onPointerCancel:v(e.onPointerCancel,Og(f)),onPointerUp:r?e.onPointerUp:v(e.onPointerUp,Og(f))})]})},`ContextMenuTrigger`)),Sg=pg(e=>{let{__scopeContextMenu:t,...n}=e,r=gg(t);return(0,H.jsx)(Ch,{...r,...n})},`ContextMenuPortal`),Cg=`ContextMenuContent`,wg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=vg(Cg,n),a=gg(n),o=P.useRef(!1);return(0,H.jsx)(Dh,{...a,side:`right`,sideOffset:2,align:`start`,...r,ref:t,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),Tg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=gg(n);return(0,H.jsx)(Ih,{...i,...r,ref:t})},`ContextMenuItem`)),Eg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=gg(n);return(0,H.jsx)(Rh,{...i,...r,ref:t})},`ContextMenuCheckboxItem`)),Dg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=gg(n);return(0,H.jsx)(qh,{...i,...r,ref:t})},`ContextMenuItemIndicator`));function Og(e){return t=>t.pointerType===`mouse`?void 0:e(t)}pg(Og,`whenTouchOrPen`);var kg=Object.defineProperty,Ag=(e,t)=>kg(e,`name`,{value:t,configurable:!0}),jg=`DropdownMenu`,[Mg,tee]=h(jg,[dh]),Ng=dh(),[Pg,Fg]=Mg(jg),Ig=Ag(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Ng(t),l=P.useRef(null),[u,d]=x({prop:i,defaultProp:a??!1,onChange:o,caller:jg});return(0,H.jsx)(Pg,{scope:t,triggerId:p(),triggerRef:l,contentId:p(),open:u,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,H.jsx)(vh,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Lg=`DropdownMenuTrigger`,Rg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Fg(Lg,n),o=Ng(n),s=O(t,a.triggerRef);return(0,H.jsx)(yh,{asChild:!0,...o,children:(0,H.jsx)(u.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:v(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:v(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),zg=Ag(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Ng(t);return(0,H.jsx)(Ch,{...r,...n})},`DropdownMenuPortal`),Bg=`DropdownMenuContent`,Vg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Fg(Bg,n),a=Ng(n),o=P.useRef(!1);return(0,H.jsx)(Dh,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:v(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:v(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Hg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Nh,{...i,...r,ref:t})},`DropdownMenuLabel`)),Ug=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Ih,{...i,...r,ref:t})},`DropdownMenuItem`)),Wg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Rh,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),Gg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Vh,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),Kg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Uh,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),qg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(qh,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Jg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Jh,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Yg=Ag(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Ng(t),[s,c]=x({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,H.jsx)(Qh,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),Xg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(eg,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),Zg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(ng,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),Qg=Object.defineProperty,$g=P.forwardRef(((e,t)=>Qg(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,H.jsx)(u.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),e_=Object.defineProperty,t_=(e,t)=>e_(e,`name`,{value:t,configurable:!0});function n_(e,[t,n]){return Math.min(n,Math.max(t,e))}t_(n_,`clamp`);var r_=Object.defineProperty,i_=(e,t)=>r_(e,`name`,{value:t,configurable:!0}),a_=`Popover`,[o_,nee]=h(a_,[ae]),s_=ae(),[c_,l_]=o_(a_),u_=i_(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=s_(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=P.useState(0),[m,h]=P.useState(0),[g,_]=x({prop:r,defaultProp:i??!1,onChange:a,caller:a_});return(0,H.jsx)(j,{...s,children:(0,H.jsx)(c_,{scope:t,contentId:p(),titleId:p(),descriptionId:p(),titlePresent:d>0,descriptionPresent:m>0,setTitleCount:f,setDescriptionCount:h,triggerRef:c,open:g,onOpenChange:_,onOpenToggle:P.useCallback(()=>_(e=>!e),[_]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),d_=`PopoverTrigger`,f_=P.forwardRef(i_(function(e,t){let{__scopePopover:n,...r}=e,i=l_(d_,n),a=s_(n),o=O(t,i.triggerRef),s=(0,H.jsx)(u.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":C_(i.open),...r,ref:o,onClick:v(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,H.jsx)(A,{asChild:!0,...a,children:s})},`PopoverTrigger`)),p_=`PopoverPortal`,[m_,h_]=o_(p_,{forceMount:void 0}),g_=i_(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=l_(p_,t);return(0,H.jsx)(m_,{scope:t,forceMount:n,children:(0,H.jsx)(m,{present:n||a.open,children:(0,H.jsx)(S,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),__=`PopoverContent`,v_=P.forwardRef(i_(function(e,t){let n=h_(__,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=l_(__,e.__scopePopover);return(0,H.jsx)(m,{present:r||a.open,children:a.modal?(0,H.jsx)(b_,{...i,ref:t}):(0,H.jsx)(x_,{...i,ref:t})})},`PopoverContent`)),y_=k(`PopoverContent.RemoveScroll`),b_=P.forwardRef(i_(function(e,t){let n=l_(__,e.__scopePopover),r=P.useRef(null),i=O(t,r),a=P.useRef(!1),{nodes:o,registry:s}=C();return P.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,H.jsx)(De,{as:y_,allowPinchZoom:!0,shards:P.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,H.jsx)(S_,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:v(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:v(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:v(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),x_=P.forwardRef(i_(function(e,t){let n=l_(__,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,H.jsx)(S_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),S_=P.forwardRef(i_(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":p,branchNodes:m,branchRegistry:h,...g}=e,v=l_(__,n),y=s_(n),[x,S]=P.useState(null),C=O(t,S);return b(x),ce(),(0,H.jsx)(d,{registry:h,children:(0,H.jsx)(_,{asChild:!0,loop:!0,trapped:r,branches:m,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(f,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>v.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,H.jsx)(re,{"data-state":C_(v.open),role:`dialog`,id:v.contentId,"aria-labelledby":v.titlePresent?v.titleId:void 0,"aria-describedby":v.descriptionPresent?w_(p,v.descriptionId):p,...y,...g,ref:C,style:{...g.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function C_(e){return e?`open`:`closed`}i_(C_,`getState`);function w_(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}i_(w_,`concatAriaDescribedby`);var T_=e(o(),1),E_=Object.defineProperty,D_=(e,t)=>E_(e,`name`,{value:t,configurable:!0}),O_={ItemAligned:`item-aligned`,Popper:`popper`},k_={LTR:`ltr`,RTL:`rtl`},A_=[` `,`Enter`,`ArrowUp`,`ArrowDown`],j_=[` `,`Enter`],M_=`Select`,[N_,P_,F_]=Bp(M_),[I_,ree]=h(M_,[F_,ae]),L_=ae(),[R_,z_]=I_(M_),[B_,V_]=I_(M_);function H_(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:m,form:h,internal_do_not_use_render:g}=e,_=L_(t),[v,y]=P.useState(null),[b,S]=P.useState(null),[C,w]=P.useState(!1),T=nm(l),[E,D]=x({prop:r,defaultProp:i??!1,onChange:a,caller:M_}),[O,k]=x({prop:o,defaultProp:s,onChange:c,caller:M_}),A=P.useRef(null),ee=P.useRef(!1),[te,ne]=P.useState(null),re=D_(e=>{ne({value:e,hasConsumerStoppedPropagation:ee.current}),k(e)},`handleUserSelect`),ie=P.useRef(O);P.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=D_(()=>k(ie.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,k]);let ae=!v||!!h||!!v.closest(`form`),[M,oe]=P.useState(new Set),se=p(),ce=Array.from(M).map(e=>e.props.value).join(`;`),le=P.useCallback(e=>{oe(t=>new Set(t).add(e))},[]),ue=P.useCallback(e=>{oe(t=>{let n=new Set(t);return n.delete(e),n})},[]),de={required:m,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:se,value:O,onValueChange:k,hasConsumerStoppedPropagationRef:ee,userSelection:te,onUserSelect:re,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:M,nativeSelectKey:ce,isFormControl:ae};return(0,H.jsx)(j,{..._,children:(0,H.jsx)(R_,{scope:t,...de,children:(0,H.jsx)(N_.Provider,{scope:t,children:(0,H.jsx)(B_,{scope:t,onNativeOptionAdd:le,onNativeOptionRemove:ue,children:yv(g)?g(de):n})})})})}D_(H_,`SelectProvider`);var U_=D_(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,H.jsx)(H_,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[n,e?(0,H.jsx)(vv,{__scopeSelect:t}):null]})})},`Select`),iee=`SelectTrigger`,aee=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=L_(n),o=z_(iee,n),s=o.disabled||r,c=O(t,o.onTriggerChange),l=P_(n),d=P.useRef(`touch`),[f,p,m]=xv(e=>{let t=l().filter(e=>!e.disabled),n=Sv(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),h=D_(e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,H.jsx)(A,{asChild:!0,...a,children:(0,H.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":bv(o.value)?``:void 0,...i,ref:c,onClick:v(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:v(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:v(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),p(e.key)),!(t&&e.key===` `)&&A_.includes(e.key)&&(h(),e.preventDefault())})})})},`SelectTrigger`)),oee=`SelectValue`,see=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=z_(oee,n),{onValueNodeHasChildrenChange:l}=c,d=a!==void 0,f=O(t,c.onValueNodeChange);g(()=>{l(d)},[l,d]);let p=bv(c.value);return(0,H.jsx)(u.span,{...s,asChild:!p&&s.asChild,ref:f,style:{pointerEvents:`none`},children:(0,H.jsx)(P.Fragment,{children:p?o:a},p?`placeholder`:`value`)})},`SelectValue`)),cee=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[lee,uee]=I_(`SelectPortal`,{forceMount:void 0}),dee=D_(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,H.jsx)(lee,{scope:e.__scopeSelect,forceMount:n,children:(0,H.jsx)(S,{asChild:!0,...r})})},`SelectPortal`),W_=`SelectContent`,G_=P.forwardRef(D_(function(e,t){let n=uee(W_,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=z_(W_,e.__scopeSelect),[o,s]=P.useState();return g(()=>{s(new DocumentFragment)},[]),(0,H.jsx)(m,{present:r||a.open,children:({present:e})=>e?(0,H.jsx)(Z_,{...i,ref:t}):(0,H.jsx)(K_,{...i,fragment:o})})},`SelectContent`)),K_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?T_.createPortal((0,H.jsx)(J_,{scope:n,children:(0,H.jsx)(N_.Slot,{scope:n,children:(0,H.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),q_=10,[J_,Y_]=I_(W_),X_=k(`SelectContent.RemoveScroll`),Z_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n}=e,{position:r=O_.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:y,...b}=e,x=z_(W_,n),[S,C]=P.useState(null),[w,T]=P.useState(null),E=O(t,C),[D,k]=P.useState(null),[A,ee]=P.useState(null),j=P_(n),[te,ne]=P.useState(!1),re=P.useRef(!1),ie=P.useRef(!1),ae=P.useRef(!1);P.useEffect(()=>{if(S)return oe(S)},[S]),ce();let M=P.useCallback(e=>{let[t,...n]=j().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[j,w]),se=P.useCallback(()=>M([D,S]),[M,D,S]);P.useEffect(()=>{te&&se()},[te,se]);let{onOpenChange:le,triggerPointerDownPosRef:ue}=x;P.useEffect(()=>{if(S){let e={x:0,y:0},t=D_(t=>{e={x:Math.abs(Math.round(t.pageX)-(ue.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ue.current?.y??0))}},`handlePointerMove`),n=D_(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(S)||le(!1),document.removeEventListener(`pointermove`,t),ue.current=null},`handlePointerUp`);return ue.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[S,le,ue]),P.useEffect(()=>{let e=D_(()=>le(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[le]);let[de,fe]=xv(e=>{let t=j().filter(e=>!e.disabled),n=Sv(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),pe=P.useCallback((e,t,n)=>{let r=!ie.current;r&&(ie.current=!0);let i=!re.current&&!n;x.value!==void 0&&x.value===t||i?(k(e),i&&(re.current=!0)):r&&k(e)},[x.value]),me=P.useCallback(()=>S?.focus(),[S]),he=P.useCallback((e,t,n)=>{if(!e)return;let r=!ae.current;r&&(ae.current=!0);let i=!re.current&&!n;(x.value!==void 0&&x.value===t||i||r)&&ee(e)},[x.value]),ge=r===O_.Popper?$_:Q_,N=ge===$_?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:y}:{};return(0,H.jsx)(J_,{scope:n,content:S,viewport:w,onViewportChange:T,itemRefCallback:pe,selectedItem:D,onItemLeave:me,itemTextRefCallback:he,focusSelectedItem:se,selectedItemText:A,position:r,isPositioned:te,searchRef:de,children:(0,H.jsx)(De,{as:X_,allowPinchZoom:!0,children:(0,H.jsx)(_,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:v(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(f,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,H.jsx)(ge,{role:`listbox`,id:x.contentId,"data-state":x.open?`open`:`closed`,dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...N,onPlaced:()=>ne(!0),ref:E,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:v(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&fe(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=j().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Q_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=z_(W_,n),o=Y_(W_,n),[s,c]=P.useState(null),[l,d]=P.useState(null),f=O(t,d),p=P_(n),m=P.useRef(!1),h=P.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=P.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==k_.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q_,d=n_(a,[q_,Math.max(q_,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q_,d=n_(a,[q_,Math.max(q_,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=p(),c=window.innerHeight-q_*2,u=_.scrollHeight,d=window.getComputedStyle(l),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-q_,D=c-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+h+k,ee=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}s.style.margin=`${q_}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);g(()=>x(),[x]);let[S,C]=P.useState();g(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let w=P.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]);return(0,H.jsx)(ev,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:w,children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,H.jsx)(u.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),$_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=q_,...a}=e,o=L_(n);return(0,H.jsx)(re,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[ev,tv]=I_(W_,{}),nv=`SelectViewport`,rv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Y_(nv,n),o=tv(nv,n),s=O(t,a.onViewportChange),c=P.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,H.jsx)(N_.Slot,{scope:n,children:(0,H.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:v(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-q_*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[fee,pee]=I_(`SelectGroup`),iv=`SelectItem`,[av,ov]=I_(iv),sv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=z_(iv,n),c=Y_(iv,n),l=s.value===r,[d,f]=P.useState(a??``),[m,h]=P.useState(!1),g=T(e=>c.itemRefCallback?.(e,r,i)),_=O(t,g),y=p(),b=P.useRef(`touch`);function x(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return D_(x,`handleSelect`),(0,H.jsx)(av,{scope:n,value:r,disabled:i,textId:y,isSelected:l,onItemTextChange:P.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(N_.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,H.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":m?``:void 0,"aria-selected":l&&m,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:v(o.onFocus,()=>h(!0)),onBlur:v(o.onBlur,()=>h(!1)),onClick:v(o.onClick,e=>{i||b.current!==`mouse`&&x(e)}),onPointerUp:v(o.onPointerUp,e=>{i||b.current===`mouse`&&x(e)}),onPointerDown:v(o.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:v(o.onPointerMove,e=>{b.current=e.pointerType,i?c.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:v(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:v(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(j_.includes(e.key)&&x(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),cv=`SelectItemText`,lv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=z_(cv,n),s=Y_(cv,n),c=ov(cv,n),l=V_(cv,n),[d,f]=P.useState(null),p=T(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=O(t,f,c.onItemTextChange,p),h=d?.textContent,_=P.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=l;return g(()=>(v(_),()=>y(_)),[v,y,_]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!bv(o.value)?T_.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),uv=`SelectItemIndicator`,dv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,...r}=e;return ov(uv,n).isSelected?(0,H.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),fv=`SelectScrollUpButton`,pv=P.forwardRef(D_(function(e,t){let n=Y_(fv,e.__scopeSelect),r=tv(fv,e.__scopeSelect),[i,a]=P.useState(!1),o=O(t,r.onScrollButtonChange);return g(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};D_(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(gv,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),mv=`SelectScrollDownButton`,hv=P.forwardRef(D_(function(e,t){let n=Y_(mv,e.__scopeSelect),r=tv(mv,e.__scopeSelect),[i,a]=P.useState(!1),o=O(t,r.onScrollButtonChange);return g(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};D_(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(gv,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),gv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y_(`SelectScrollButton`,n),o=P.useRef(null),s=P_(n),c=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>c(),[c]),g(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:v(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:v(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:v(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),_v=`SelectBubbleInput`,vv=P.forwardRef(D_(function({__scopeSelect:e,...t},n){let r=z_(_v,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:d,userSelection:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=P.useRef(null),g=O(n,h),_=i??``,v=P.useRef(_),y=P.useRef(f),b=P.useRef(!1),x=Array.from(p).some(e=>(e.props.value??``)===``);return P.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=f!==null&&f!==y.current;y.current=f;let i=v.current!==_;v.current=_;let a=r&&i;if(r&&!i&&f.value!==_&&!f.hasConsumerStoppedPropagation&&n){b.current=!0;try{n.call(e,f.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{b.current=!1,n.call(e,_)}return}let o=a&&!f.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,_),e.dispatchEvent(t)}},[_,f]),(0,H.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:d,onChange:e=>{b.current||a(e.target.value)},...t,style:{...te,...t.style},ref:g,defaultValue:_,children:[bv(i)&&!x?(0,H.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function yv(e){return typeof e==`function`}D_(yv,`isFunction`);function bv(e){return e===``||e===void 0}D_(bv,`shouldShowPlaceholder`);function xv(e){let t=T(e),n=P.useRef(``),r=P.useRef(0),i=P.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}D_(a,`updateSearch`),a(i)},[t]),a=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}D_(xv,`useTypeaheadSearch`);function Sv(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Cv(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}D_(Sv,`findNextItem`);function Cv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}D_(Cv,`wrapArray`);var wv=Object.defineProperty,Tv=(e,t)=>wv(e,`name`,{value:t,configurable:!0}),Ev=`Switch`,[Dv,mee]=h(Ev),[Ov,kv]=Dv(Ev);function Av(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=x({prop:n,defaultProp:i??!1,onChange:c,caller:Ev}),[m,h]=P.useState(null),[g,_]=P.useState(null),[v,y]=P.useState(null),b={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,H.jsx)(Ov,{scope:t,...b,children:Rv(d)?d(b):r})}Tv(Av,`SwitchProvider`);var jv=`SwitchTrigger`,Mv=P.forwardRef(Tv(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=kv(jv,e),g=O(r,d),_=P.useRef(c);return P.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=Tv(()=>f(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,f]),(0,H.jsx)(u.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":zv(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:v(t,e=>{let t=e.isPropagationStopped();p({requestedChecked:!c,hasConsumerStoppedPropagation:t}),f(e=>!e),h&&m&&(t||e.stopPropagation())})})},`SwitchTrigger`)),Nv=P.forwardRef(Tv(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,H.jsx)(Av,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Mv,{...d,ref:t,__scopeSwitch:n}),e&&(0,H.jsx)(Lv,{__scopeSwitch:n})]})})},`Switch`)),Pv=`SwitchThumb`,Fv=P.forwardRef(Tv(function(e,t){let{__scopeSwitch:n,...r}=e,i=kv(Pv,n);return(0,H.jsx)(u.span,{"data-state":zv(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),Iv=`SwitchBubbleInput`,Lv=P.forwardRef(Tv(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=kv(Iv,e),g=O(r,h),_=ee(i),y=P.useRef(!1),b=P.useRef(o),x=P.useRef(a),S=P.useRef(null);P.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=b.current!==o;b.current=o;let i=a!==null&&a!==x.current;if(x.current=a,i)S.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=S.current;S.current=null;let r=t?.requestedChecked===o;y.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),y.current=!1}},[m,o,a]);let C=P.useRef(o);return(0,H.jsx)(u.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??C.current,required:c,disabled:l,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:v(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function Rv(e){return typeof e==`function`}Tv(Rv,`isFunction`);function zv(e){return e?`checked`:`unchecked`}Tv(zv,`getState`);var Bv=class extends P.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(e,t.componentStack)}render(){let e=this.state.error;return e===null?this.props.children:(0,H.jsxs)(`div`,{className:`flex h-dvh flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:`Something went wrong`}),(0,H.jsx)(`p`,{className:`text-muted-foreground max-w-xl text-sm whitespace-pre-wrap`,children:e.message}),(0,H.jsx)(y,{onClick:()=>location.reload(),children:`Reload`})]})}},Vv=`/assets/ghostty-vt-CQAu1Gs5.wasm`,Hv=Uint8Array,Uv=Uint16Array,Wv=Int32Array,Gv=new Hv([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Kv=new Hv([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qv=new Hv([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jv=function(e,t){for(var n=new Uv(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Wv(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Yv=Jv(Gv,2),Xv=Yv.b,Zv=Yv.r;Xv[28]=258,Zv[258]=28;var Qv=Jv(Kv,0),$v=Qv.b;Qv.r;for(var ey=new Uv(32768),ty=0;ty<32768;++ty){var ny=(ty&43690)>>1|(ty&21845)<<1;ny=(ny&52428)>>2|(ny&13107)<<2,ny=(ny&61680)>>4|(ny&3855)<<4,ey[ty]=((ny&65280)>>8|(ny&255)<<8)>>1}for(var ry=(function(e,t,n){for(var r=e.length,i=0,a=new Uv(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Uv(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Uv(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ey[d]>>c]=l}else for(s=new Uv(r),i=0;i<r;++i)e[i]&&(s[i]=ey[o[e[i]-1]++]>>15-e[i]);return s}),iy=new Hv(288),ty=0;ty<144;++ty)iy[ty]=8;for(var ty=144;ty<256;++ty)iy[ty]=9;for(var ty=256;ty<280;++ty)iy[ty]=7;for(var ty=280;ty<288;++ty)iy[ty]=8;for(var ay=new Hv(32),ty=0;ty<32;++ty)ay[ty]=5;var oy=ry(iy,9,1),sy=ry(ay,5,1),cy=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ly=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},uy=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},dy=function(e){return(e+7)/8|0},fy=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Hv(e.subarray(t,n))},py=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],my=function(e,t,n){var r=Error(t||py[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,my),!n)throw r;return r},hy=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Hv(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Hv(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Hv(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=ly(e,d,1);var v=ly(e,d+1,3);if(d+=3,!v){var y=dy(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&my(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=oy,m=sy,h=9,g=5;else if(v==2){var S=ly(e,d,31)+257,C=ly(e,d+10,15)+4,w=S+ly(e,d+5,31)+1;d+=14;for(var T=new Hv(w),E=new Hv(19),D=0;D<C;++D)E[qv[D]]=ly(e,d+D*3,7);d+=C*3;for(var O=cy(E),k=(1<<O)-1,A=ry(E,O,1),D=0;D<w;){var ee=A[ly(e,d,k)];d+=ee&15;var y=ee>>4;if(y<16)T[D++]=y;else{var j=0,te=0;for(y==16?(te=3+ly(e,d,3),d+=2,j=T[D-1]):y==17?(te=3+ly(e,d,7),d+=3):y==18&&(te=11+ly(e,d,127),d+=7);te--;)T[D++]=j}}var ne=T.subarray(0,S),re=T.subarray(S);h=cy(ne),g=cy(re),p=ry(ne,h,1),m=ry(re,g,1)}else my(1);if(d>_){c&&my(0);break}}s&&l(f+131072);for(var ie=(1<<h)-1,ae=(1<<g)-1,M=d;;M=d){var j=p[uy(e,d)&ie],oe=j>>4;if(d+=j&15,d>_){c&&my(0);break}if(j||my(2),oe<256)n[f++]=oe;else if(oe==256){M=d,p=null;break}else{var se=oe-254;if(oe>264){var D=oe-257,ce=Gv[D];se=ly(e,d,(1<<ce)-1)+Xv[D],d+=ce}var le=m[uy(e,d)&ae],ue=le>>4;le||my(3),d+=le&15;var re=$v[ue];if(ue>3){var ce=Kv[ue];re+=uy(e,d)&(1<<ce)-1,d+=ce}if(d>_){c&&my(0);break}s&&l(f+131072);var de=f+se;if(f<re){var fe=a-re,pe=Math.min(re,de);for(fe+f<0&&my(3);f<pe;++f)n[f]=r[fe+f]}for(;f<de;++f)n[f]=n[f-re]}}t.l=p,t.p=M,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?fy(n,0,f):n.subarray(0,f)},gy=new Hv(0),_y=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&my(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&my(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2},vy=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new Hv(32768),this.p=new Hv(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||my(5),this.d&&my(4),!this.p.length)this.p=e;else if(e.length){var t=new Hv(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=hy(this.p,this.s,this.o);this.ondata(fy(n,t,this.s.b),this.d),this.o=fy(n,this.s.b-32768),this.s.b=this.o.length,this.p=fy(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),yy=function(){function e(e,t){vy.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(vy.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(_y(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&my(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),vy.prototype.c.call(this,t)},e}();function by(e,t){return hy(e.subarray(_y(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var xy=typeof TextDecoder<`u`&&new TextDecoder;try{xy.decode(gy,{stream:!0})}catch{}function Sy(e,t=`utf8`){return new TextDecoder(t).decode(e)}var Cy=new TextEncoder;function wy(e){return Cy.encode(e)}var Ty=8192,Ey=(()=>{let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),Dy={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array},Oy=class e{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=Ty,n={}){let r=!1;typeof t==`number`?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);let i=n.offset?n.offset>>>0:0,a=t.byteLength-i,o=i;(ArrayBuffer.isView(t)||t instanceof e)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+i),t=t.buffer),this.lastWrittenByte=r?a:0,this.buffer=t,this.length=a,this.byteLength=a,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,a),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let e=this._marks.pop();if(e===void 0)throw Error(`Mark stack empty`);return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){let t=(this.offset+e)*2,n=new Uint8Array(t);n.set(new Uint8Array(this.buffer)),this.buffer=n.buffer,this.length=t,this.byteLength=t,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,`uint8`)}readArray(e,t){let n=Dy[t].BYTES_PER_ELEMENT*e,r=this.byteOffset+this.offset,i=this.buffer.slice(r,r+n);if(this.littleEndian===Ey&&t!==`uint8`&&t!==`int8`){let e=new Uint8Array(this.buffer.slice(r,r+n));e.reverse();let i=new Dy[t](e.buffer);return this.offset+=n,i.reverse(),i}let a=new Dy[t](i);return this.offset+=n,a}readInt16(){let e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){let e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){let e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){let e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){let e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){let e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){let e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){let e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t=``;for(let n=0;n<e;n++)t+=this.readChar();return t}readUtf8(e=1){return Sy(this.readBytes(e))}decodeText(e=1,t=`utf8`){return Sy(this.readBytes(e),t)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let t=0;t<e.length;t++)this._data.setUint8(this.offset++,e[t]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let t=0;t<e.length;t++)this.writeUint8(e.charCodeAt(t));return this}writeUtf8(e){return this.writeBytes(wy(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}},ky=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;ky[e]=t}var Ay=4294967295;function jy(e,t,n){let r=e;for(let e=0;e<n;e++)r=ky[(r^t[e])&255]^r>>>8;return r}function My(e,t){return(jy(Ay,e,t)^Ay)>>>0}function Ny(e,t,n){let r=e.readUint32(),i=My(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function Py(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function Fy(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function Iy(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function Ly(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+(t[a-i]>>1)&255}else{for(;a<i;a++)t[a]=e[a]+(n[a]>>1)&255;for(;a<r;a++)t[a]=e[a]+(t[a-i]+n[a]>>1)&255}}function Ry(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+t[a-i]&255}else{for(;a<i;a++)t[a]=e[a]+n[a]&255;for(;a<r;a++)t[a]=e[a]+zy(t[a-i],n[a],n[a-i])&255}}function zy(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}function By(e,t,n,r,i,a){switch(e){case 0:Py(t,n,i);break;case 1:Fy(t,n,i,a);break;case 2:Iy(t,n,r,i);break;case 3:Ly(t,n,r,i,a);break;case 4:Ry(t,n,r,i,a);break;default:throw Error(`Unsupported filter: ${e}`)}}var Vy=new Uint16Array([255]),Hy=new Uint8Array(Vy.buffer)[0]===255;function Uy(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],s=Math.ceil(a/8)*i,c=new Uint8Array(r*n*s),l=0;for(let e=0;e<7;e++){let i=o[e],a=Math.ceil((n-i.x)/i.xStep),u=Math.ceil((r-i.y)/i.yStep);if(a<=0||u<=0)continue;let d=a*s,f=new Uint8Array(d);for(let e=0;e<u;e++){let o=t[l++],u=t.subarray(l,l+d);l+=d;let p=new Uint8Array(d);By(o,u,p,f,d,s),f.set(p);for(let t=0;t<a;t++){let a=i.x+t*i.xStep,o=i.y+e*i.yStep;if(!(a>=n||o>=r))for(let e=0;e<s;e++)c[(o*n+a)*s+e]=p[t*s+e]}}}if(a===16){let e=new Uint16Array(c.buffer);if(Hy)for(let t=0;t<e.length;t++)e[t]=Wy(e[t]);return e}return c}function Wy(e){return(e&255)<<8|e>>8&255}var Gy=new Uint16Array([255]),Ky=new Uint8Array(Gy.buffer)[0]===255,qy=new Uint8Array;function Jy(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=Math.ceil(a/8)*i,s=Math.ceil(a/8*i*n),c=new Uint8Array(r*s),l=qy,u=0,d,f;for(let e=0;e<r;e++){switch(d=t.subarray(u+1,u+1+s),f=c.subarray(e*s,(e+1)*s),t[u]){case 0:Py(d,f,s);break;case 1:Fy(d,f,s,o);break;case 2:Iy(d,f,l,s);break;case 3:Ly(d,f,l,s,o);break;case 4:Ry(d,f,l,s,o);break;default:throw Error(`Unsupported filter: ${t[u]}`)}l=f,u+=s+1}if(a===16){let e=new Uint16Array(c.buffer);if(Ky)for(let t=0;t<e.length;t++)e[t]=Yy(e[t]);return e}return c}function Yy(e){return(e&255)<<8|e>>8&255}var Xy=Uint8Array.of(137,80,78,71,13,10,26,10);function Zy(e){if(!Qy(e.readBytes(Xy.length)))throw Error(`wrong PNG signature`)}function Qy(e){if(e.length<Xy.length)return!1;for(let t=0;t<Xy.length;t++)if(e[t]!==Xy[t])return!1;return!0}var $y=`tEXt`,hee=0,eb=new TextDecoder(`latin1`);function gee(e){if(vee(e),e.length===0||e.length>79)throw Error(`keyword length must be between 1 and 79`)}var _ee=/^[\u0000-\u00FF]*$/;function vee(e){if(!_ee.test(e))throw Error(`invalid latin1 text`)}function yee(e,t,n){let r=tb(t);e[r]=bee(t,n-r.length-1)}function tb(e){for(e.mark();e.readByte()!==hee;);let t=e.offset;e.reset();let n=eb.decode(e.readBytes(t-e.offset-1));return e.skip(1),gee(n),n}function bee(e,t){return eb.decode(e.readBytes(t))}var nb={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},rb={UNKNOWN:-1,DEFLATE:0},ib={UNKNOWN:-1,ADAPTIVE:0},ab={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},ob={NONE:0,BACKGROUND:1,PREVIOUS:2},sb={SOURCE:0,OVER:1},xee=class extends Oy{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;_chunks;_inflatorResult;constructor(e,t={}){super(e);let{checkCrc:n=!1}=t;this._checkCrc=n,this._inflator=new yy((e,t)=>{if(this._chunks.push(e),t){let e=this._chunks.reduce((e,t)=>e+t.length,0);this._inflatorResult=new Uint8Array(e);let t=0;for(let e of this._chunks)this._inflatorResult.set(e,t),t+=e.length;this._chunks=[]}}),this._chunks=[],this._png={width:-1,height:-1,channels:-1,data:new Uint8Array,depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array,this._compressionMethod=rb.UNKNOWN,this._filterMethod=ib.UNKNOWN,this._interlaceMethod=ab.UNKNOWN,this._colorType=nb.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this._inflatorResult=new Uint8Array,this.setBigEndian()}decode(){for(Zy(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeChunk(e,t)}return this._inflator.push(new Uint8Array,!0),this.decodeImage(),this._png}decodeApng(){for(Zy(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeApngChunk(e,t)}return this.decodeApngImage(),this._apng}decodeChunk(e,t){let n=this.offset;switch(t){case`IHDR`:this.decodeIHDR();break;case`PLTE`:this.decodePLTE(e);break;case`IDAT`:this.decodeIDAT(e);break;case`IEND`:this._end=!0;break;case`tRNS`:this.decodetRNS(e);break;case`iCCP`:this.decodeiCCP(e);break;case $y:yee(this._png.text,this,e);break;case`pHYs`:this.decodepHYs();break;default:this.skip(e)}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?Ny(this,e+4,t):this.skip(4)}decodeApngChunk(e,t){let n=this.offset;switch(t!==`fdAT`&&t!==`IDAT`&&this._writingDataChunks&&this.pushDataToFrame(),t){case`acTL`:this.decodeACTL();break;case`fcTL`:this.decodeFCTL();break;case`fdAT`:this.decodeFDAT(e);break;default:this.decodeChunk(e,t),this.offset=n+e}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?Ny(this,e+4,t):this.skip(4)}decodeIHDR(){let e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=See(this.readUint8());let t=this.readUint8();this._colorType=t;let n;switch(t){case nb.GREYSCALE:n=1;break;case nb.TRUECOLOUR:n=3;break;case nb.INDEXED_COLOUR:n=1;break;case nb.GREYSCALE_ALPHA:n=2;break;case nb.TRUECOLOUR_ALPHA:n=4;break;case nb.UNKNOWN:default:throw Error(`Unknown color type: ${t}`)}if(this._png.channels=n,this._compressionMethod=this.readUint8(),this._compressionMethod!==rb.DEFLATE)throw Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let e={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array};this._frames.push(e)}decodePLTE(e){if(e%3!=0)throw RangeError(`PLTE field length must be a multiple of 3. Got ${e}`);let t=e/3;this._hasPalette=!0;let n=[];this._palette=n;for(let e=0;e<t;e++)n.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;try{this._inflator.push(new Uint8Array(this.buffer,n,t),!1)}catch(e){throw Error(`Error while decompressing the data:`,{cause:e})}this.skip(e)}decodeFDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;n+=4,t-=4;try{this._inflator.push(new Uint8Array(this.buffer,n,t),!1)}catch(e){throw Error(`Error while decompressing the data:`,{cause:e})}this.skip(e)}decodetRNS(e){switch(this._colorType){case nb.GREYSCALE:case nb.TRUECOLOUR:if(e%2!=0)throw RangeError(`tRNS chunk length must be a multiple of 2. Got ${e}`);if(e/2>this._png.width*this._png.height)throw Error(`tRNS chunk contains more alpha values than there are pixels (${e/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(e/2);for(let t=0;t<e/2;t++)this._transparency[t]=this.readUint16();break;case nb.INDEXED_COLOUR:{if(e>this._palette.length)throw Error(`tRNS chunk contains more alpha values than there are palette colors (${e} vs ${this._palette.length})`);let t=0;for(;t<e;t++){let e=this.readByte();this._palette[t].push(e)}for(;t<this._palette.length;t++)this._palette[t].push(255);break}case nb.UNKNOWN:case nb.GREYSCALE_ALPHA:case nb.TRUECOLOUR_ALPHA:default:throw Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(e){let t=tb(this),n=this.readUint8();if(n!==rb.DEFLATE)throw Error(`Unsupported iCCP compression method: ${n}`);let r=this.readBytes(e-t.length-2);this._png.iccEmbeddedProfile={name:t,profile:by(r)}}decodepHYs(){let e=this.readUint32(),t=this.readUint32(),n=this.readByte();this._png.resolution={x:e,y:t,unit:n}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let e=0;e<this._numberOfFrames;e++){let t={sequenceNumber:this._frames[e].sequenceNumber,delayNumber:this._frames[e].delayNumber,delayDenominator:this._frames[e].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},n=this._frames.at(e);if(n){if(n.data=Jy({data:n.data,width:n.width,height:n.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),e===0||n.xOffset===0&&n.yOffset===0&&n.width===this._png.width&&n.height===this._png.height)t.data=n.data;else{let r=this._apng.frames.at(e-1);this.disposeFrame(n,r,t),this.addFrameDataToCanvas(t,n)}this._apng.frames.push(t)}}return this._apng}disposeFrame(e,t,n){switch(e.disposeOp){case ob.NONE:break;case ob.BACKGROUND:for(let t=0;t<this._png.height;t++)for(let r=0;r<this._png.width;r++){let i=(t*e.width+r)*this._png.channels;for(let e=0;e<this._png.channels;e++)n.data[i+e]=0}break;case ob.PREVIOUS:n.data.set(t.data);break;default:throw Error(`Unknown disposeOp`)}}addFrameDataToCanvas(e,t){let n=1<<this._png.depth,r=(e,n)=>({index:((e+t.yOffset)*this._png.width+t.xOffset+n)*this._png.channels,frameIndex:(e*t.width+n)*this._png.channels});switch(t.blendOp){case sb.SOURCE:for(let n=0;n<t.height;n++)for(let i=0;i<t.width;i++){let{index:a,frameIndex:o}=r(n,i);for(let n=0;n<this._png.channels;n++)e.data[a+n]=t.data[o+n]}break;case sb.OVER:for(let i=0;i<t.height;i++)for(let a=0;a<t.width;a++){let{index:o,frameIndex:s}=r(i,a);for(let r=0;r<this._png.channels;r++){let i=t.data[s+this._png.channels-1]/n,a=r%(this._png.channels-1)==0?1:t.data[s+r],c=Math.floor(i*a+(1-i)*e.data[o+r]);e.data[o+r]+=c}}break;default:throw Error(`Unknown blendOp`)}}decodeImage(){let e=this._inflatorResult;if(this._filterMethod!==ib.ADAPTIVE)throw Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===ab.NO_INTERLACE)this._png.data=Jy({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===ab.ADAM7)this._png.data=Uy({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){this._inflator.push(new Uint8Array,!0);let e=this._inflatorResult,t=this._frames.at(-1);t?t.data=e:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:ob.NONE,blendOp:sb.SOURCE,data:e}),this._inflator=new yy((e,t)=>{if(this._chunks.push(e),t){let e=this._chunks.reduce((e,t)=>e+t.length,0);this._inflatorResult=new Uint8Array(e);let t=0;for(let e of this._chunks)this._inflatorResult.set(e,t),t+=e.length;this._chunks=[]}}),this._chunks=[],this._writingDataChunks=!1}};function See(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw Error(`invalid bit depth: ${e}`);return e}function Cee(e){let t=e.palette,n=e.depth;if(!t)throw Error(`Color palette is undefined.`);wee(e);let r=e.width*e.height,i=r*t[0].length,a=new Uint8Array(i),o=0,s=0,c=new Uint8Array(r),l=255;switch(n){case 1:l=128;break;case 2:l=192;break;case 4:l=240;break;case 8:l=255;break;default:throw Error(`Incorrect depth value`)}for(let t of e.data){let r=l,i=8;for(;r&&(i-=n,c[o++]=(t&r)>>i,r>>=n,o%e.width!==0););}if(e.palette)for(let t of c){let n=e.palette.at(t);if(!n)throw Error(`Incorrect index of palette color`);a.set(n,s),s+=n.length}return a}function wee(e){let t=e.depth<8?Math.ceil(e.width*e.depth/8)*e.height*e.channels:e.width*e.height*e.channels;if(e.data.length!==t)throw RangeError(`wrong data size. Found ${e.data.length}, expected ${t}`)}function cb(e,t){return new xee(e,t).decode()}var lb=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn(`BE platform detected. This version of node-sixel works only on LE properly.`);function t(e){return e&255}e.red=t;function n(e){return e>>>8&255}e.green=n;function r(e){return e>>>16&255}e.blue=r;function i(e){return e>>>24&255}e.alpha=i;function a(e,t,n,r=255){return((r&255)<<24|(n&255)<<16|(t&255)<<8|e&255)>>>0}e.toRGBA8888=a;function o(e){return[e&255,e>>8&255,e>>16&255,e>>>24]}e.fromRGBA8888=o;function s(e,i){let a=t(e),o=n(e),s=r(e),c=2**53-1,l=-1;for(let e=0;e<i.length;++e){let t=a-i[e][0],n=o-i[e][1],r=s-i[e][2],u=t*t+n*n+r*r;if(!u)return e;u<c&&(c=u,l=e)}return l}e.nearestColorIndex=s;function c(e,t,n){return Math.max(e,Math.min(n,t))}function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n*6<1?t+(e-t)*6*n:n*2<1?e:n*3<2?t+(e-t)*(4-n*6):t}function u(e,t,n){if(!n){let e=Math.round(t*255);return a(e,e,e)}let r=t<.5?t*(1+n):t+n-t*n,i=2*t-r;return a(c(0,255,Math.round(l(r,i,e+1/3)*255)),c(0,255,Math.round(l(r,i,e)*255)),c(0,255,Math.round(l(r,i,e-1/3)*255)))}function d(e,t,n){return(4278190080|Math.round(n/100*255)<<16|Math.round(t/100*255)<<8|Math.round(e/100*255))>>>0}e.normalizeRGB=d;function f(e,t,n){return u((e+240)/360,t/100,n/100)}e.normalizeHLS=f,e.PALETTE_VT340_COLOR=new Uint32Array([d(0,0,0),d(20,20,80),d(80,13,13),d(20,80,20),d(80,20,80),d(20,80,80),d(80,80,20),d(53,53,53),d(26,26,26),d(33,33,60),d(60,26,26),d(33,60,33),d(60,33,60),d(33,60,60),d(60,60,33),d(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([d(0,0,0),d(13,13,13),d(26,26,26),d(40,40,40),d(6,6,6),d(20,20,20),d(33,33,33),d(46,46,46),d(0,0,0),d(13,13,13),d(26,26,26),d(40,40,40),d(6,6,6),d(20,20,20),d(33,33,33),d(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let e=[a(0,0,0),a(205,0,0),a(0,205,0),a(205,205,0),a(0,0,238),a(205,0,205),a(0,250,205),a(229,229,229),a(127,127,127),a(255,0,0),a(0,255,0),a(255,255,0),a(92,92,255),a(255,0,255),a(0,255,255),a(255,255,255)],t=[0,95,135,175,215,255];for(let n=0;n<6;++n)for(let r=0;r<6;++r)for(let i=0;i<6;++i)e.push(a(t[n],t[r],t[i]));for(let t=8;t<=238;t+=10)e.push(a(t,t,t));return new Uint32Array(e)})(),e.DEFAULT_BACKGROUND=a(0,0,0,255),e.DEFAULT_FOREGROUND=a(255,255,255,255)})),ub=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:`AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRBoAgpAwA3AwAgAkGoiQJqQaAIKQMANwMAIAJBsIkCakGgCCkDADcDACACQbiJAmpBoAgpAwA3AwAgAkHAiQJqQaAIKQMANwMAIAJByIkCakGgCCkDADcDACACQdCJAmpBoAgpAwA3AwAgAkHYiQJqQaAIKQMANwMAIAJB4IkCakGgCCkDADcDACACQeiJAmpBoAgpAwA3AwAgAkHwiQJqQaAIKQMANwMAIAJB+IkCakGgCCkDADcDACACQYCKAmpBoAgpAwA3AwAgAkGIigJqQaAIKQMANwMAIAJBkIoCakGgCCkDADcDACACQZiKAmpBoAgpAwA3AwAgAkGgigJqQaAIKQMANwMAIAJBqIoCakGgCCkDADcDACACQbCKAmpBoAgpAwA3AwAgAkG4igJqQaAIKQMANwMAIAJBwIoCakGgCCkDADcDACACQciKAmpBoAgpAwA3AwAgAkHQigJqQaAIKQMANwMAIAJB2IoCakGgCCkDADcDACACQeCKAmpBoAgpAwA3AwAgAkHoigJqQaAIKQMANwMAIAJB8IoCakGgCCkDADcDACACQfiKAmpBoAgpAwA3AwAgAkGAiwJqQaAIKQMANwMAIAJBiIsCakGgCCkDADcDACACQZCLAmpBoAgpAwA3AwAgAkGYiwJqQaAIKQMANwMAIAJBoIsCakGgCCkDADcDACACQaiLAmpBoAgpAwA3AwAgAkGwiwJqQaAIKQMANwMAIAJBuIsCakGgCCkDADcDACACQcCLAmpBoAgpAwA3AwAgAkHIiwJqQaAIKQMANwMAIAJB0IsCakGgCCkDADcDACACQdiLAmpBoAgpAwA3AwAgAkHgiwJqQaAIKQMANwMAIAJB6IsCakGgCCkDADcDACACQfCLAmpBoAgpAwA3AwAgAkH4iwJqQaAIKQMANwMAIAJBgIwCakGgCCkDADcDACACQYiMAmpBoAgpAwA3AwAgAkGQjAJqQaAIKQMANwMAIAJBmIwCakGgCCkDADcDACACQaCMAmpBoAgpAwA3AwAgAkGojAJqQaAIKQMANwMAIAJBsIwCakGgCCkDADcDACACQbiMAmpBoAgpAwA3AwAgAkHAjAJqQaAIKQMANwMAIAJByIwCakGgCCkDADcDACACQdCMAmpBoAgpAwA3AwAgAkHYjAJqQaAIKQMANwMAIAJB4IwCakGgCCkDADcDACACQeiMAmpBoAgpAwA3AwAgAkHwjAJqQaAIKQMANwMAIAJB+IwCakGgCCkDADcDACACQYCNAmpBoAgpAwA3AwAgAkGIjQJqQaAIKQMANwMAIAJBkI0CakGgCCkDADcDACACQZiNAmpBoAgpAwA3AwAgAkGwiQZqIARBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBEGABPwKAABB1AgoAgBBAnRB0IkOaiAEQYAE/AoAAEHUCCgCAEECdEHgiRJqIARBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBEGABPwKAABB1AhB1AgoAgAiAkGAAWoiAzYCACABIANIDQEgAkGA/wBIDQALCwJAIABFDQAgCEH//wBLDQBBgIABIAhrIAcgAUH//wBLGyECAkAgAEEBcUUNACACRQ0AIAhBAnRBoIkCaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBAnFFDQAgAkUNACAIQQJ0QbCJBmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsCQCAAQQRxRQ0AIAJFDQAgCEECdEHAiQpqIQMgAiEEIAJBB3EiBwRAA0AgAyAFNgIAIANBBGohAyAEQQFrIQQgB0EBayIHDQALCyACQQFrQQdJDQADQCADIAU2AhwgAyAFNgIYIAMgBTYCFCADIAU2AhAgAyAFNgIMIAMgBTYCCCADIAU2AgQgAyAFNgIAIANBIGohAyAEQQhrIgQNAAsLAkAgAEEIcUUNACACRQ0AIAhBAnRB0IkOaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBEHFFDQAgAkUNACAIQQJ0QeCJEmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsgAEEgcUUNACACRQ0AIAJBAWshByAIQQJ0QfCJFmohAyACQQdxIgQEQANAIAMgBTYCACADQQRqIQMgAkEBayECIARBAWsiBA0ACwsgB0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgAkEIayICDQALC0HcCEHcCCgCACAAcjYCACAGQQFqIgIgBi0AAEH/AHEiA0E/ayIAQT9LDQQaDAMLAkBB7AgoAgAiBEEBRgRAQfAIKAIAIgNBzAgoAgAiAUkNASADIAFwIQMMAQtB+AgoAgAhAkH0CCgCACEBAkACQCAEQQVHDQAgAUEBRw0AIAJB6QJODQQMAQsgAkHkAEoNA0H8CCgCAEHkAEoNA0GACSgCAEHkAEoNAwsCQCABRQ0AIAFBAkoNACACQfwIKAIAQYAJKAIAIAFBAnRBiAhqKAIAEQIAIQFB8AgoAgAiA0HMCCgCACICTwR/IAMgAnAFIAMLQQJ0QZAJaiABNgIAC0HwCCgCACIDQcwIKAIAIgFJDQAgAyABcCEDCyADQQJ0QZAJaigCACEFDAELIANB/QBxQSFHBEAgCCEBIAYhAgwECyAEQSNHDQQCQEHsCCgCACICQQFGBEBB8AgoAgAiAUHMCCgCACIASQ0BIAEgAHAhAQwBC0H4CCgCACEBQfQIKAIAIQACQAJAIAJBBUcNACAAQQFHDQAgAUHpAkgNAQwHCyABQeQASg0GQfwIKAIAQeQASg0GQYAJKAIAQeQASg0GCwJAIABFDQAgAEECSg0AIAFB/AgoAgBBgAkoAgAgAEECdEGICGooAgARAgAhAEHwCCgCACIBQcwIKAIAIgJPBH8gASACcAUgAQtBAnRBkAlqIAA2AgALQfAIKAIAIgFBzAgoAgAiAEkNACABIABwIQELIAFBAnRBkAlqKAIAIQUMBAsgCCEBIAYhAgtB1AgoAgAhBgNAAkAgASAGSA0AIAZB//8ASg0AIAZBAnQiBEGgiQJqIgZBoAgpAwA3AwAgBEGoiQJqQaAIKQMANwMAIARBsIkCakGgCCkDADcDACAEQbiJAmpBoAgpAwA3AwAgBEHAiQJqQaAIKQMANwMAIARByIkCakGgCCkDADcDACAEQdCJAmpBoAgpAwA3AwAgBEHYiQJqQaAIKQMANwMAIARB4IkCakGgCCkDADcDACAEQeiJAmpBoAgpAwA3AwAgBEHwiQJqQaAIKQMANwMAIARB+IkCakGgCCkDADcDACAEQYCKAmpBoAgpAwA3AwAgBEGIigJqQaAIKQMANwMAIARBkIoCakGgCCkDADcDACAEQZiKAmpBoAgpAwA3AwAgBEGgigJqQaAIKQMANwMAIARBqIoCakGgCCkDADcDACAEQbCKAmpBoAgpAwA3AwAgBEG4igJqQaAIKQMANwMAIARBwIoCakGgCCkDADcDACAEQciKAmpBoAgpAwA3AwAgBEHQigJqQaAIKQMANwMAIARB2IoCakGgCCkDADcDACAEQeCKAmpBoAgpAwA3AwAgBEHoigJqQaAIKQMANwMAIARB8IoCakGgCCkDADcDACAEQfiKAmpBoAgpAwA3AwAgBEGAiwJqQaAIKQMANwMAIARBiIsCakGgCCkDADcDACAEQZCLAmpBoAgpAwA3AwAgBEGYiwJqQaAIKQMANwMAIARBoIsCakGgCCkDADcDACAEQaiLAmpBoAgpAwA3AwAgBEGwiwJqQaAIKQMANwMAIARBuIsCakGgCCkDADcDACAEQcCLAmpBoAgpAwA3AwAgBEHIiwJqQaAIKQMANwMAIARB0IsCakGgCCkDADcDACAEQdiLAmpBoAgpAwA3AwAgBEHgiwJqQaAIKQMANwMAIARB6IsCakGgCCkDADcDACAEQfCLAmpBoAgpAwA3AwAgBEH4iwJqQaAIKQMANwMAIARBgIwCakGgCCkDADcDACAEQYiMAmpBoAgpAwA3AwAgBEGQjAJqQaAIKQMANwMAIARBmIwCakGgCCkDADcDACAEQaCMAmpBoAgpAwA3AwAgBEGojAJqQaAIKQMANwMAIARBsIwCakGgCCkDADcDACAEQbiMAmpBoAgpAwA3AwAgBEHAjAJqQaAIKQMANwMAIARByIwCakGgCCkDADcDACAEQdCMAmpBoAgpAwA3AwAgBEHYjAJqQaAIKQMANwMAIARB4IwCakGgCCkDADcDACAEQeiMAmpBoAgpAwA3AwAgBEHwjAJqQaAIKQMANwMAIARB+IwCakGgCCkDADcDACAEQYCNAmpBoAgpAwA3AwAgBEGIjQJqQaAIKQMANwMAIARBkI0CakGgCCkDADcDACAEQZiNAmpBoAgpAwA3AwAgBEGwiQZqIAZBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBkGABPwKAABB1AgoAgBBAnRB0IkOaiAGQYAE/AoAAEHUCCgCAEECdEHgiRJqIAZBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBkGABPwKAABB1AhB1AgoAgBBgAFqIgY2AgALIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiAFNgIAIABBAXZBAXEgAWxBAnRBsIkGaiAFNgIAIABBAnZBAXEgAWxBAnRBwIkKaiAFNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiAFNgIAIABBBHZBAXEgAWxBAnRB4IkSaiAFNgIAIABBBXYgAWxBAnRB8IkWaiAFNgIAQdQIKAIAIQYLIAFBAWohAUHcCEHcCCgCACAAcjYCACACLQAAIQAgAkEBaiIEIQIgAEH/AHEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHgiQIgADcDAEHYiQIgADcDAEHQiQIgADcDAEHIiQIgADcDAEHAiQIgADcDAEG4iQIgADcDAEGwiQIgADcDAEGoCCgCACIEQf8AakGAAW0hCAJAIARBgQFIDQBBASEBIAhBAiAIQQJKG0EBayICQQFxIQMgBEGBAk4EQCACQX5xIQIDQCABQQl0IgdBEHJBoIkCakGwiQJBgAT8CgAAIAdBsI0CakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsLIANFDQAgAUEJdEEQckGgiQJqQbCJAkGABPwKAAALAkAgBEEBSA0AIAhBASAIQQFKGyIDQQFxIQUCQCADQQFrIgdFBEBBACEBDAELIANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQbCJBmpBsIkCQYAE/AoAACAGQZAEckGwiQZqQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACwsgBQRAIAFBCXRBEHJBsIkGakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEFIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiBkEQckHAiQpqQbCJAkGABPwKAAAgBkGQBHJBwIkKakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAFBEAgAUECdEHAiQpqQbCJAkGABPwKAAALIARBAUgNACADQQFxIQUgBwR/IANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQdCJDmpBsIkCQYAE/AoAACAGQZAEckHQiQ5qQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACyABQQd0QQRyBUEECyEBIAUEQCABQQJ0QdCJDmpBsIkCQYAE/AoAAAsgBEEBSA0AIANBAXEhBSAHBH8gA0H+////B3EhAkEAIQEDQCABQQl0IgZBEHJB4IkSakGwiQJBgAT8CgAAIAZBkARyQeCJEmpBsIkCQYAE/AoAACABQQJqIQEgAkECayICDQALIAFBB3RBBHIFQQQLIQEgBQRAIAFBAnRB4IkSakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEEIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiA0EQckHwiRZqQbCJAkGABPwKAAAgA0GQBHJB8IkWakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAERQ0AIAFBAnRB8IkWakGwiQJBgAT8CgAAC0HUCCAIQQd0QQRyNgIAC58TAgh/AX5B5AgoAgAhA0HgCCgCACECQegIKAIAIQcgAUGQiQFqIglB/wE6AAAgACABSARAIABBkIkBaiEIA0AgAiEEIAhBAWohAQJAIAgtAABB/wBxIgJBMGtBCUsEQCABIQgMAQtB7AgoAgBBAnRB7AhqIgUoAgAhAANAIAUgAiAAQQpsakEwayIANgIAIAEtAAAhAiABQQFqIgghASACQf8AcSICQTBrQQpJDQALCwJAAkACQAJAAkACQAJ/AkAgAkE/ayIAQT9NBEAgBEUNASAEQSFGBEBB8AgoAgAiAUEBIAEbIgQgB2ohAQJAIABFDQAgB0H//wBLDQBBgIABIAdrIAQgAUH//wBLGyEFAkAgAEEBcUUNACAHQQJ0QaCJAmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEECcUUNACAHQQJ0QbCJBmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEEcUUNACAHQQJ0QcCJCmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEIcUUNACAHQQJ0QdCJDmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEQcUUNACAHQQJ0QeCJEmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLIABBIHFFDQAgBUEBayEEIAdBAnRB8IkWaiEAIAVBB3EiAgRAA0AgACADNgIAIABBBGohACAFQQFrIQUgAkEBayICDQALCyAEQQdJDQADQCAAIAM2AhwgACADNgIYIAAgAzYCFCAAIAM2AhAgACADNgIMIAAgAzYCCCAAIAM2AgQgACADNgIAIABBIGohACAFQQhrIgUNAAsLIAhBAWoiBSAILQAAQf8AcSICQT9rIgBBP00NAxoMBAsCQEHsCCgCACIFQQFGBEBB8AgoAgAiAUHMCCgCACIESQ0BIAEgBHAhAQwBC0H4CCgCACEEQfQIKAIAIQECQAJAIAVBBUcNACABQQFHDQAgBEHpAk4NBAwBCyAEQeQASg0DQfwIKAIAQeQASg0DQYAJKAIAQeQASg0DCwJAIAFFDQAgAUECSg0AIARB/AgoAgBBgAkoAgAgAUECdEGICGooAgARAgAhBEHwCCgCACIBQcwIKAIAIgVPBH8gASAFcAUgAQtBAnRBkAlqIAQ2AgALQfAIKAIAIgFBzAgoAgAiBEkNACABIARwIQELIAFBAnRBkAlqKAIAIQMMAQsgAkH9AHFBIUcEQCAHIQEgAiEADAQLIARBI0cNBAJAQewIKAIAIgRBAUYEQEHwCCgCACIBQcwIKAIAIgBJDQEgASAAcCEBDAELQfgIKAIAIQFB9AgoAgAhAAJAAkAgBEEFRw0AIABBAUcNACABQekCSA0BDAcLIAFB5ABKDQZB/AgoAgBB5ABKDQZBgAkoAgBB5ABKDQYLAkAgAEUNACAAQQJKDQAgAUH8CCgCAEGACSgCACAAQQJ0QYgIaigCABECACEAQfAIKAIAIgFBzAgoAgAiBE8EfyABIARwBSABC0ECdEGQCWogADYCAAtB8AgoAgAiAUHMCCgCACIASQ0AIAEgAHAhAQsgAUECdEGQCWooAgAhAwwECyAHIQEgCAshBQNAIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiADNgIAIABBAXZBAXEgAWxBAnRBsIkGaiADNgIAIABBAnZBAXEgAWxBAnRBwIkKaiADNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiADNgIAIABBBHZBAXEgAWxBAnRB4IkSaiADNgIAIABBBXYgAWxBAnRB8IkWaiADNgIACyABQQFqIQEgBS0AACEAIAVBAWoiBCEFIABB/wBxIgJBP2siAEHAAEkNAAsgBCEFC0EAIQQgBSEIIAEhByACIQAgAkH9AHFBIUYNAQtBBCEHIAQhAiAAQSRrDgoDAgICAgICAgIBAgtB7AhCATcCAAwCC0GoCCgCAEEEaxAABEBB0AhBATYCAA8LAkBBqAgoAgAiBkEFSA0AQaAIKQMAIQogBkEDa0EBdiIBQQdxIQJBACEAIAFBAWtBB08EQCABQfj///8HcSEFA0AgAEEDdCIBQbCJAmogCjcDACABQQhyQbCJAmogCjcDACABQRByQbCJAmogCjcDACABQRhyQbCJAmogCjcDACABQSByQbCJAmogCjcDACABQShyQbCJAmogCjcDACABQTByQbCJAmogCjcDACABQThyQbCJAmogCjcDACAAQQhqIQAgBUEIayIFDQALCyACRQ0AA0AgAEEDdEGwiQJqIAo3AwAgAEEBaiEAIAJBAWsiAg0ACwtBwIkGQbCJAiAGQQJ0IgD8CgAAQdCJCkGwiQIgAPwKAABB4IkOQbCJAiAA/AoAAEHwiRJBsIkCIAD8CgAAQYCKFkGwiQIgAPwKAAAgBCECDAELAkAgAEE7Rw0AQewIKAIAIgBBB0oNAEHsCCAAQQFqNgIAIABBAnRB8AhqQQA2AgALIAEhBwsgCCAJSQ0ACwtB5AggAzYCAEHgCCACNgIAQegIIAc2AgAL4gcCBX8BfgJAQdAIAn8CQAJAIAAgAU4NACABQZCJAWohBiAAQZCJAWohBQNAIAUtAAAiA0H/AHEhAgJAAkACQAJAAkACQAJAQeAIKAIAIgRBIkcEQCAEDQcgAkEiRgRAQewIQgE3AgBB4AhBIjYCAAwICyACQT9rQcAASQ0GIANBIWsiAkEMTQ0BDAULAkAgAkEwayIEQQlNBEBB7AgoAgBBAnRB7AhqIgIgBCACKAIAQQpsajYCAAwBC0HsCCgCACEEIAJBO0YEQCAEQQdKDQFB7AggBEEBajYCACAEQQJ0QfAIakEANgIADAELIARBBEYEQEHECEECNgIAQbAIQfAIKQMANwMAQbgIQfgIKAIAIgI2AgBBvAhB/AgoAgAiBDYCAEHICEECQQFBwAgoAgAiAxs2AgBBrAggBEEAIAMbNgIAQagIIAJBgIABIAJBgIABSBtBBGpBACADGzYCAEHgCEEANgIADAoLIAJBP2tBwABJDQQLIANBIWsiAkEMTQ0BDAILQQEgAnRBjSBxRQ0DDAQLQQEgAnRBjSBxDQELIANBoQFrIgJBDEsNA0EBIAJ0QY0gcUUNAwtBxAhCgYCAgBA3AgBBsAhB8AgoAgBBAEHsCCgCACICQQBKGzYCAEG0CEH0CCgCAEEAIAJBAUobNgIAQbgIQfgIKAIAQQAgAkECShs2AgBB4AhBADYCAEG8CEEANgIADAQLIANBoQFrIgJBDEsNAUEBIAJ0QY0gcUUNAQtBxAhCgYCAgBA3AgBBsAhCADcDAEG4CEIANwMADAMLIAVBAWoiBSAGSQ0ACwsCQEHICCgCAA4DAwEAAQsCQEGoCCgCACIFQQVIDQBBoAgpAwAhByAFQQNrQQF2IgNBB3EhBEEAIQIgA0EBa0EHTwRAIANB+P///wdxIQYDQCACQQN0IgNBsIkCaiAHNwMAIANBCHJBsIkCaiAHNwMAIANBEHJBsIkCaiAHNwMAIANBGHJBsIkCaiAHNwMAIANBIHJBsIkCaiAHNwMAIANBKHJBsIkCaiAHNwMAIANBMHJBsIkCaiAHNwMAIANBOHJBsIkCaiAHNwMAIAJBCGohAiAGQQhrIgYNAAsLIARFDQADQCACQQN0QbCJAmogBzcDACACQQFqIQIgBEEBayIEDQALC0HAiQZBsIkCIAVBAnQiA/wKAABB0IkKQbCJAiAD/AoAAEHgiQ5BsIkCIAP8CgAAQfCJEkGwiQIgA/wKAABBgIoWQbCJAiAD/AoAAEECDAELEAhByAgoAgALEAEiAjYCACACDQAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLdABB6AhBBDYCAEHkCCAANgIAQewIQgE3AgBBxAhCADcCAEHACCADNgIAQdwIQgA3AgBBqAhCADcDAEGwCEIANwMAQbgIQgA3AwBBzAggAkGAICACQYAgSRs2AgBBoAggAa1CgYCAgBB+NwMAQdAIQQA2AgALIwBB0AgoAgBFBEAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLWgECfwJAAkACQEHICCgCAEEBaw4CAAECC0HYCEHoCCgCACIAQdgIKAIAIgEgACABShsiAEGAgAEgAEGAgAFIGyIANgIAIABBBGsPC0GoCCgCAEEEayEACyAAC0IBAX8Cf0EGQdwIKAIAIgBBIHENABpBBSAAQRBxDQAaQQQgAEEIcQ0AGkEDIABBBHENABpBAiAAQQFxIABBAnEbCwu9BQEFfQJ/IAJFBEAgAUH/AWxBMmpB5ABtIgBBCHQgAHIgAEEQdHIMAQsgArJDAADIQpUhBiAAQfABarJDAAC0Q5UhBQJ9IAGyQwAAyEKVIgNDAAAAP10EQCADIAZDAACAP5KUDAELIAYgA0MAAIA/IAaTlJILIQcgAyADkiEGAkAgBUOrqqo+kiIEQwAAAABdBEAgBEMAAIA/kiEEDAELIARDAACAP15FDQAgBEMAAIC/kiEECyAGIAeTIQMgBUMAAAAAXSEAAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF`}})),db=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=lb(),n=ub();function r(e){if(typeof Buffer<`u`)return Buffer.from(e,`base64`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<n.length;++e)n[e]=t.charCodeAt(e);return n}var i=r(n.LIMITS.BYTES),a,o=new Uint32Array,s=class{constructor(){this.bandHandler=e=>1,this.modeHandler=e=>1}handle_band(e){return this.bandHandler(e)}mode_parsed(e){return this.modeHandler(e)}},c={memoryLimit:134217728,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:n.LIMITS.PALETTE_SIZE,truncate:!0};function l(e){let t=new s,n={env:{handle_band:t.handle_band.bind(t),mode_parsed:t.mode_parsed.bind(t)}};return WebAssembly.instantiate(a||i,n).then(n=>(a||=n.module,new u(e,n.instance||n,t)))}e.DecoderAsync=l;var u=class{constructor(e,r,s){if(this._PIXEL_OFFSET=n.LIMITS.MAX_WIDTH+4,this._canvas=o,this._bandWidths=[],this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},c,e),this._opts.paletteLimit>n.LIMITS.PALETTE_SIZE)throw Error(`DecoderOptions.paletteLimit must not exceed ${n.LIMITS.PALETTE_SIZE}`);if(r)s.bandHandler=this._handle_band.bind(this),s.modeHandler=this._initCanvas.bind(this);else{let e=a||=new WebAssembly.Module(i);r=new WebAssembly.Instance(e,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=r,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),n.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),n.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(e){if(e===2){let e=this.width*this.height;if(e>this._canvas.length){if(this._opts.memoryLimit&&e*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);this._canvas=new Uint32Array(e)}this._maxWidth=this._width}else if(e===1){if(this._level===2){let e=Math.min(this._rasterWidth,n.LIMITS.MAX_WIDTH)*this._rasterHeight;if(e>this._canvas.length){if(this._opts.memoryLimit&&e*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);this._canvas=new Uint32Array(e)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536))}return 0}_realloc(e,t){let n=e+t;if(n>this._canvas.length){if(this._opts.memoryLimit&&n*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);let e=new Uint32Array(Math.ceil(n/65536)*65536);e.set(this._canvas),this._canvas=e}}_handle_band(e){let t=this._PIXEL_OFFSET,n=this._lastOffset;if(this._mode===2){let r=this.height-this._currentHeight,i=0;for(;i<6&&r>0;)this._canvas.set(this._pSrc.subarray(t*i,t*i+e),n+e*i),i++,r--;this._lastOffset+=e*i,this._currentHeight+=i}else if(this._mode===1){this._realloc(n,e*6),this._maxWidth=Math.max(this._maxWidth,e),this._minWidth=Math.min(this._minWidth,e);for(let r=0;r<6;++r)this._canvas.set(this._pSrc.subarray(t*r,t*r+e),n+e*r);this._bandWidths.push(e),this._lastOffset+=e*6,this._currentHeight+=6}return 0}get width(){return this._mode===1?Math.max(this._maxWidth,this._wasm.current_width()):this._width}get height(){return this._mode===1?this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6:this._height}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(e=this._opts.fillColor,t=this._opts.palette,r=this._opts.paletteLimit,i=this._opts.truncate){this._wasm.init(this._opts.sixelColor,e,r,+!!i),t&&this._palette.set(t.subarray(0,n.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(e,t=0,r=e.length){let i=t;for(;i<r;){let t=Math.min(r-i,n.LIMITS.CHUNK_SIZE);this._chunk.set(e.subarray(i,i+=t)),this._wasm.decode(0,t)}}decodeString(e,t=0,r=e.length){let i=t;for(;i<r;){let t=Math.min(r-i,n.LIMITS.CHUNK_SIZE);for(let n=0,r=i;n<t;++n,++r)this._chunk[n]=e.charCodeAt(r);i+=t,this._wasm.decode(0,t)}}get data32(){if(this._mode===0||!this.width||!this.height)return o;let e=this._wasm.current_width();if(this._mode===2){let t=this.height-this._currentHeight;if(t>0){let n=this._PIXEL_OFFSET,r=this._lastOffset,i=0;for(;i<6&&t>0;)this._canvas.set(this._pSrc.subarray(n*i,n*i+e),r+e*i),i++,t--;t&&this._canvas.fill(this._fillColor,r+e*i)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let t=!1;if(e){if(e!==this._minWidth)t=!0;else{let t=this._PIXEL_OFFSET,n=this._lastOffset;this._realloc(n,e*6);for(let r=0;r<6;++r)this._canvas.set(this._pSrc.subarray(t*r,t*r+e),n+e*r)}}if(!t)return this._canvas.subarray(0,this.width*this.height)}let t=new Uint32Array(this.width*this.height);t.fill(this._fillColor);let n=0,r=0;for(let e=0;e<this._bandWidths.length;++e){let i=this._bandWidths[e];for(let e=0;e<6;++e)t.set(this._canvas.subarray(r,r+=i),n),n+=this.width}if(e){let r=this._PIXEL_OFFSET,i=this._wasm.current_height();for(let a=0;a<i;++a)t.set(this._pSrc.subarray(r*a,r*a+e),n+this.width*a)}return t}return o}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=o,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=u;function d(e,t){let n=new u(t);return n.init(),typeof e==`string`?n.decodeString(e):n.decode(e),{width:n.width,height:n.height,data32:n.data32,data8:n.data8}}e.decode=d;async function f(e,t){let n=await l(t);return n.init(),typeof e==`string`?n.decodeString(e):n.decode(e),{width:n.width,height:n.height,data32:n.data32,data8:n.data8}}e.decodeAsync=f})),fb=lb(),pb=db(),mb=fb.PALETTE_ANSI_256.slice();mb.set(fb.PALETTE_VT340_COLOR);var hb=200,gb=new TextEncoder,_b=`offsite-image:`;async function vb(e){let t=await(0,pb.decodeAsync)(e,{fillColor:0,palette:mb});return!t.width||!t.height?null:createImageBitmap(new ImageData(new Uint8ClampedArray(t.data8),t.width,t.height))}function yb(e,t,n){return e===void 0||e===`auto`?0:e.endsWith(`%`)?parseInt(e.slice(0,-1))*t/100:e.endsWith(`px`)?parseInt(e.slice(0,-2)):parseInt(e)*n}async function bb(e,t){let n=e.indexOf(`:`);if(n===-1)return null;let r=new Map(e.slice(0,n).split(`;`).map(e=>{let t=e.indexOf(`=`);return[e.slice(0,t),e.slice(t+1)]}));if(r.get(`inline`)!==`1`)return null;let i=Uint8Array.from(atob(e.slice(n+1)),e=>e.charCodeAt(0)),a=await createImageBitmap(new Blob([i])),o=yb(r.get(`width`),t.width,t.cellWidth),s=yb(r.get(`height`),t.height,t.cellHeight),c=[a.width,a.height];if(!o&&!s){let e=Math.min(t.width/a.width,(t.height-t.cellHeight)/a.height);e<1&&(c=[a.width*e,a.height*e])}else c=o?r.get(`preserveAspectRatio`)!==`0`||!s?[o,a.height*o/a.width]:[o,s]:[a.width*s/a.height,s];let[l,u]=c.map(e=>Math.max(1,Math.floor(e*t.pixelRatio))),d=await createImageBitmap(a,{resizeWidth:l,resizeHeight:u});return a.close(),d}function xb(e){let t=cb(e),{width:n,height:r,depth:i,channels:a}=t,o=n*r,s=new Uint8Array(o*4);if(t.palette){let e=Cee(t),i=t.palette[0].length;for(let t=0;t<o;t+=1)s.set(e.subarray(t*i,t*i+3),t*4),s[t*4+3]=i===4?e[t*i+3]:255;return{width:n,height:r,data:s}}let c=2**i-1,l=Math.ceil(n*i/8);function u(e){if(i>=8)return t.data[e];let r=e%n*i;return t.data[Math.floor(e/n)*l+(r>>3)]>>8-i-(r&7)&c}function d(e){return i===16?e>>8:i===8?e:Math.round(e*255/c)}let f=t.transparency;for(let e=0;e<o;e+=1){let t=e*4;if(a===1||a===2){let n=u(e*a);s.fill(d(n),t,t+3),s[t+3]=a===2?d(u(e*2+1)):f?.[0]===n?0:255}else if(a===3||a===4){let n=u(e*a),r=u(e*a+1),i=u(e*a+2);s[t]=d(n),s[t+1]=d(r),s[t+2]=d(i),s[t+3]=a===4?d(u(e*4+3)):f?.[0]===n&&f[1]===r&&f[2]===i?0:255}else throw Error(`unsupported PNG with ${a} channels`)}return{width:n,height:r,data:s}}var Sb=class{core;images=[];nextImage=0;constructor(e){this.core=e}place(e,t,n){let r=`${_b}${this.nextImage++}`;this.core.write(gb.encode(`\x1b]8;;${r}\x1b\\ \x1b]8;;\x1b\\\b`));let i={ref:this.core.trackCursor(),marker:r,bitmap:e,width:e.width/t,height:e.height/t,alternate:this.core.isAlternateScreen()};if(this.images.push(i),this.images.length>hb){let e=this.images.shift();e&&this.remove(e)}let a=Math.ceil(i.height/n);a>1&&this.core.write(gb.encode(`\x1BD`.repeat(a-1)))}visible(e,t,n){if(this.images.length===0)return[];let r=this.core.isAlternateScreen(),i=[],a=[];for(let o of this.images){if(o.alternate!==r){a.push(o);continue}let s=this.core.trackedPoint(o.ref);if(s===null||this.core.trackedHyperlink(o.ref)!==o.marker){this.remove(o);continue}a.push(o);let c=s.y-e;c+Math.ceil(o.height/n)<=0||c>=t||i.push({bitmap:o.bitmap,width:o.width,height:o.height,x:s.x,y:c})}return this.images=a,i}clear(){for(let e of this.images)this.remove(e);this.images=[]}remove(e){this.core.untrack(e.ref),e.bitmap.close()}},Cb=new Uint8Array([0,97,115,109,1,0,0,0,1,35,5,96,4,127,127,127,127,0,96,3,127,127,127,1,127,96,2,127,127,0,96,3,127,127,127,0,96,5,127,127,127,127,127,1,127,2,49,6,3,101,110,118,1,119,0,0,3,101,110,118,1,100,0,1,3,101,110,118,1,115,0,1,3,101,110,118,1,98,0,2,3,101,110,118,1,118,0,3,3,101,110,118,1,112,0,4,7,25,6,1,119,0,0,1,100,0,1,1,115,0,2,1,98,0,3,1,118,0,4,1,112,0,5]),wb={userdata:0,writePty:1,bell:2,xtversion:4,size:6,deviceAttributes:8},Tb=1,Eb=-3,Db={width:0,height:4,data:8,length:12},Ob=new TextDecoder,kb=new TextEncoder,Ab=class e{memory;layouts;exports;memoryView;hosts=new Map;nextHostId=1;callbacks={writePty:0,deviceAttributes:0,size:0,bell:0,xtversion:0};version={pointer:0,size:0};constructor(e){this.exports=e.exports;let t=e.exports.memory;if(!(t instanceof WebAssembly.Memory))throw Error(`libghostty-vt did not export its memory`);this.memory=t,this.memoryView=new DataView(t.buffer);let n=this.call(`ghostty_type_json`),r=new Uint8Array(t.buffer),i=n;for(;i<r.length&&r[i]!==0;)i+=1;this.layouts=JSON.parse(Ob.decode(r.subarray(n,i)))}static async load(){let t=await fetch(Vv);if(!t.ok)throw Error(`could not load libghostty-vt (${t.status})`);let n=null,r=await WebAssembly.instantiate(await t.arrayBuffer(),{env:{log:(e,t)=>{n&&console.debug(`[libghostty-vt]`,Ob.decode(new Uint8Array(n.buffer,e,t)))}}}),i=new e(r.instance);return n=i.memory,i.installCallbacks(),i}call(e,...t){let n=this.exports[e];if(typeof n!=`function`)throw Error(`libghostty-vt export is missing: ${e}`);return n(...t)}layout(e){let t=this.layouts[e];if(!t)throw Error(`libghostty-vt layout is missing: ${e}`);return t}field(e,t){let n=this.layout(e).fields[t];if(!n)throw Error(`libghostty-vt field is missing: ${e}.${t}`);return n}alloc(e){let t=this.call(`ghostty_wasm_alloc_u8_array`,e);if(t===0)throw Error(`libghostty-vt could not allocate ${e} bytes`);return new Uint8Array(this.memory.buffer,t,e).fill(0),t}free(e,t){e!==0&&this.call(`ghostty_wasm_free_u8_array`,e,t)}allocOpaque(){let e=this.call(`ghostty_wasm_alloc_opaque`);if(e===0)throw Error(`libghostty-vt could not allocate a pointer`);return new DataView(this.memory.buffer).setUint32(e,0,!0),e}freeOpaque(e){e!==0&&this.call(`ghostty_wasm_free_opaque`,e)}readPointer(e){return this.dataView().getUint32(e,!0)}check(e,t){if(t!==0)throw Error(`${e} failed with result ${t}`)}flag(e,t,n){let r=this.alloc(1),i=this.call(e,t,n,r),a=this.bytes(r,1)[0];return this.free(r,1),i===0&&a!==0}encodeOutput(e){let t=this.call(`ghostty_wasm_alloc_usize`),n=``,r=e(0,0,t),i=this.view(t,4).getUint32(0,!0);if(r===Eb&&i>0){let r=this.alloc(i),a=e(r,i,t),o=this.view(t,4).getUint32(0,!0);a===0&&(n=Ob.decode(this.bytes(r,o))),this.free(r,i)}return this.call(`ghostty_wasm_free_usize`,t),n}attachHost(e,t){let n=this.nextHostId++;this.hosts.set(n,t),this.call(`ghostty_terminal_set`,e,wb.userdata,n);for(let t of[[wb.writePty,this.callbacks.writePty],[wb.deviceAttributes,this.callbacks.deviceAttributes],[wb.size,this.callbacks.size],[wb.bell,this.callbacks.bell],[wb.xtversion,this.callbacks.xtversion]])this.call(`ghostty_terminal_set`,e,t[0],t[1]);return n}detachHost(e,t){this.call(`ghostty_terminal_set`,e,wb.xtversion,0),this.call(`ghostty_terminal_set`,e,wb.bell,0),this.call(`ghostty_terminal_set`,e,wb.size,0),this.call(`ghostty_terminal_set`,e,wb.deviceAttributes,0),this.call(`ghostty_terminal_set`,e,wb.writePty,0),this.call(`ghostty_terminal_set`,e,wb.userdata,0),this.hosts.delete(t)}view(e,t){return new DataView(this.memory.buffer,e,t)}bytes(e,t){return new Uint8Array(this.memory.buffer,e,t)}dataView(){return this.memoryView.buffer!==this.memory.buffer&&(this.memoryView=new DataView(this.memory.buffer)),this.memoryView}setField(e,t,n,r){let i=this.field(t,n),a=this.dataView(),o=e+i.offset;if(i.type===`bool`||i.type===`u8`)a.setUint8(o,r);else if(i.type===`u16`)a.setUint16(o,r,!0);else if(i.type===`i32`)a.setInt32(o,r,!0);else if(i.type===`u32`||i.type===`enum`)a.setUint32(o,r,!0);else if(i.type===`u64`)a.setBigUint64(o,BigInt(r),!0);else throw Error(`unsupported libghostty-vt field type ${i.type}`)}readField(e,t,n){let r=this.field(t,n),i=this.dataView(),a=e+r.offset;if(r.type===`bool`||r.type===`u8`)return i.getUint8(a);if(r.type===`u16`)return i.getUint16(a,!0);if(r.type===`i32`)return i.getInt32(a,!0);if(r.type===`u32`||r.type===`enum`)return i.getUint32(a,!0);if(r.type===`u64`)return Number(i.getBigUint64(a,!0));throw Error(`unsupported libghostty-vt field type ${r.type}`)}installCallbacks(){let e=new WebAssembly.Instance(new WebAssembly.Module(Cb),{env:{w:(e,t,n,r)=>{let i=this.hosts.get(t);i&&r!==0&&i.write(Ob.decode(new Uint8Array(this.memory.buffer,n,r)))},d:(e,t,n)=>this.hosts.has(t)?(this.writeDeviceAttributes(n),1):0,s:(e,t,n)=>{let r=this.hosts.get(t);if(!r)return 0;let i=r.size(),a=`GhosttySizeReportSize`;return this.setField(n,a,`rows`,i.rows),this.setField(n,a,`columns`,i.columns),this.setField(n,a,`cell_width`,i.cellWidth),this.setField(n,a,`cell_height`,i.cellHeight),1},b:(e,t)=>{this.hosts.get(t)?.bell()},v:(e,t,n)=>{let r=this.hosts.get(n);r&&this.writeVersion(e,r.version())},p:(e,t,n,r,i)=>this.decodePng(t,n,r,i)}}),t=this.exports.__indirect_function_table;if(!(t instanceof WebAssembly.Table))throw Error(`libghostty-vt did not expose its callback table`);let n=[`w`,`d`,`s`,`b`,`v`,`p`].map(n=>{let r=e.exports[n];if(typeof r!=`function`)throw Error(`libghostty-vt callback is missing: ${n}`);let i=t.length;return t.grow(1),t.set(i,r),i});if(this.callbacks={writePty:n[0],deviceAttributes:n[1],size:n[2],bell:n[3],xtversion:n[4]},this.call(`ghostty_sys_set`,Tb,n[5])!==0)throw Error(`libghostty-vt did not accept the PNG decoder`)}decodePng(e,t,n,r){let i;try{i=xb(new Uint8Array(this.memory.buffer,t,n))}catch(e){return console.warn(`could not decode a kitty PNG image`,e),0}let a=this.call(`ghostty_alloc`,e,i.data.length);if(a===0)return 0;this.bytes(a,i.data.length).set(i.data);let o=this.dataView();return o.setUint32(r+Db.width,i.width,!0),o.setUint32(r+Db.height,i.height,!0),o.setUint32(r+Db.data,a,!0),o.setUint32(r+Db.length,i.data.length,!0),1}writeVersion(e,t){let n=kb.encode(t);this.free(this.version.pointer,this.version.size);let r=this.alloc(n.length);this.bytes(r,n.length).set(n),this.version={pointer:r,size:n.length},this.dataView().setUint32(e+this.field(`GhosttyString`,`ptr`).offset,r,!0),this.setField(e,`GhosttyString`,`len`,n.length)}writeDeviceAttributes(e){let t=e+this.field(`GhosttyDeviceAttributes`,`primary`).offset,n=e+this.field(`GhosttyDeviceAttributes`,`secondary`).offset,r=e+this.field(`GhosttyDeviceAttributes`,`tertiary`).offset,i=`GhosttyDeviceAttributesPrimary`,a=`GhosttyDeviceAttributesSecondary`,o=t+this.field(i,`features`).offset,s=this.dataView(),c=[4,22];c.forEach((e,t)=>s.setUint16(o+t*2,e,!0)),this.setField(t,i,`conformance_level`,62),this.setField(t,i,`num_features`,c.length),this.setField(n,a,`device_type`,0),this.setField(n,a,`firmware_version`,276),this.setField(n,a,`rom_cartridge`,0),this.setField(r,`GhosttyDeviceAttributesTertiary`,`unit_id`,0)}},jb=null;async function Mb(){jb=await Ab.load()}function Nb(){if(!jb)throw Error(`libghostty-vt is not loaded`);return jb}var Pb=new Map(`Unidentified.Backquote.Backslash.BracketLeft.BracketRight.Comma.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Equal.IntlBackslash.IntlRo.IntlYen.KeyA.KeyB.KeyC.KeyD.KeyE.KeyF.KeyG.KeyH.KeyI.KeyJ.KeyK.KeyL.KeyM.KeyN.KeyO.KeyP.KeyQ.KeyR.KeyS.KeyT.KeyU.KeyV.KeyW.KeyX.KeyY.KeyZ.Minus.Period.Quote.Semicolon.Slash.AltLeft.AltRight.Backspace.CapsLock.ContextMenu.ControlLeft.ControlRight.Enter.MetaLeft.MetaRight.ShiftLeft.ShiftRight.Space.Tab.Convert.KanaMode.NonConvert.Delete.End.Help.Home.Insert.PageDown.PageUp.ArrowDown.ArrowLeft.ArrowRight.ArrowUp.NumLock.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadBackspace.NumpadClear.NumpadClearEntry.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEnter.NumpadEqual.NumpadMemoryAdd.NumpadMemoryClear.NumpadMemoryRecall.NumpadMemoryStore.NumpadMemorySubtract.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadSubtract.NumpadSeparator.NumpadArrowUp.NumpadArrowDown.NumpadArrowRight.NumpadArrowLeft.NumpadBegin.NumpadHome.NumpadEnd.NumpadInsert.NumpadDelete.NumpadPageUp.NumpadPageDown.Escape.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12.F13.F14.F15.F16.F17.F18.F19.F20.F21.F22.F23.F24.F25.Fn.FnLock.PrintScreen.ScrollLock.Pause.BrowserBack.BrowserFavorites.BrowserForward.BrowserHome.BrowserRefresh.BrowserSearch.BrowserStop.Eject.LaunchApp1.LaunchApp2.LaunchMail.MediaPlayPause.MediaSelect.MediaStop.MediaTrackNext.MediaTrackPrevious.Power.Sleep.AudioVolumeDown.AudioVolumeMute.AudioVolumeUp.WakeUp.Copy.Cut.Paste`.split(`.`).map((e,t)=>[e,t]));function Fb(e){return Pb.get(e)??0}var Ib=new Map([[`!`,`1`],[`@`,`2`],[`#`,`3`],[`$`,`4`],[`%`,`5`],[`^`,`6`],[`&`,`7`],[`*`,`8`],[`(`,`9`],[`)`,`0`],[`~`,"`"],[`_`,`-`],[`+`,`=`],[`{`,`[`],[`}`,`]`],[`|`,`\\`],[`:`,`;`],[`"`,`'`],[`<`,`,`],[`>`,`.`],[`?`,`/`]]),Lb;function Rb(){return Lb||(Lb=globalThis.navigator?.keyboard?.getLayoutMap().catch(()=>void 0)??Promise.resolve(void 0),Lb)}function zb(){return Lb=void 0,Rb()}function Bb(e){return!e.shiftKey||e.ctrlKey||e.altKey||e.metaKey?0:+([...e.key].length===1)}function Vb(e,t){if([...e.key].length!==1)return 0;let n=t?.get(e.code);if(n&&[...n].length===1)return n.codePointAt(0)??0;if(/^[A-Z]$/u.test(e.key))return e.key.charCodeAt(0)+32;if(e.shiftKey){let t=Ib.get(e.key);if(t)return t.codePointAt(0)??0;let n=e.key.toLowerCase();return n!==e.key&&[...n].length===1?n.codePointAt(0)??0:0}return e.key.codePointAt(0)??0}var Hb=new Map([[`Backquote`,"`"],[`Minus`,`-`],[`Equal`,`=`],[`BracketLeft`,`[`],[`BracketRight`,`]`],[`Backslash`,`\\`],[`Semicolon`,`;`],[`Quote`,`'`],[`Comma`,`,`],[`Period`,`.`],[`Slash`,`/`],[`Space`,` `]]),Ub=[...`0123456789`].map(e=>[`Digit${e}`,e]),Wb=new Map([...Ib].map(e=>[e[1],e[0]]));function Gb(e){return/^Key[A-Z]$/u.test(e)?e[3].toLowerCase():/^Digit[0-9]$/u.test(e)?e[5]:Hb.get(e)}function Kb(e){return[...Hb,...Ub].every(t=>t[0]===`Space`||e.get(t[0])===t[1])}function qb(e,t){let n=t?.get(e.code),r=n&&[...n].length===1?n:Gb(e.code);if(r===void 0)return[...e.key].length===1?null:e.key;if(!e.shiftKey)return r;let i=r.toUpperCase();return i!==r&&[...i].length===1?i:t===void 0||!Kb(t)?null:Wb.get(r)??r}var Jb=new TextEncoder,Yb=new Map([[`[`,`\x1B`],[`m`,`\r`],[`i`,` `],[`@`,`\0`]]),Xb=class{runtime=Nb();terminal;keyEncoderSlot;keyEncoder;keyEventSlot;keyEvent;mouseEncoderSlot;mouseEncoder;mouseEventSlot;mouseEvent;scratch;keyboardLayoutMap;constructor(e){let t=this.runtime;this.terminal=e,this.loadKeyboardLayout(Rb()),this.keyEncoderSlot=t.allocOpaque(),t.check(`ghostty_key_encoder_new`,t.call(`ghostty_key_encoder_new`,0,this.keyEncoderSlot)),this.keyEncoder=t.readPointer(this.keyEncoderSlot),this.keyEventSlot=t.allocOpaque(),t.check(`ghostty_key_event_new`,t.call(`ghostty_key_event_new`,0,this.keyEventSlot)),this.keyEvent=t.readPointer(this.keyEventSlot),this.mouseEncoderSlot=t.allocOpaque(),t.check(`ghostty_mouse_encoder_new`,t.call(`ghostty_mouse_encoder_new`,0,this.mouseEncoderSlot)),this.mouseEncoder=t.readPointer(this.mouseEncoderSlot),this.mouseEventSlot=t.allocOpaque(),t.check(`ghostty_mouse_event_new`,t.call(`ghostty_mouse_event_new`,0,this.mouseEventSlot)),this.mouseEvent=t.readPointer(this.mouseEventSlot),this.scratch=t.alloc(1)}encodeKey(e,t=`press`,n=!1){let r=this.runtime,i=e.key.toLowerCase(),a=Yb.get(i);if(a!==void 0&&t===`press`&&e.ctrlKey&&!e.altKey&&!e.metaKey&&!(e.shiftKey&&/^[a-z]$/u.test(i))&&!r.flag(`ghostty_terminal_get`,this.terminal,8))return a;let o=n?this.metaText(e):null,s=o??e.key;if(o!==null&&t===`press`&&!e.ctrlKey&&[...s].length===1&&(s.codePointAt(0)??0)>127&&r.flag(`ghostty_terminal_mode_get`,this.terminal,1036)&&this.isLegacyKeyboard())return`\x1b${s}`;r.call(`ghostty_key_encoder_setopt_from_terminal`,this.keyEncoder,this.terminal),r.call(`ghostty_key_event_set_action`,this.keyEvent,t===`release`?0:e.repeat?2:1),r.call(`ghostty_key_event_set_key`,this.keyEvent,Fb(e.code));let c=+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)|(e.getModifierState(`CapsLock`)?16:0)|(e.getModifierState(`NumLock`)?32:0);r.call(`ghostty_key_event_set_mods`,this.keyEvent,c),r.call(`ghostty_key_event_set_consumed_mods`,this.keyEvent,Bb(e)),r.call(`ghostty_key_event_set_composing`,this.keyEvent,+!!e.isComposing),r.call(`ghostty_key_event_set_unshifted_codepoint`,this.keyEvent,Vb({code:e.code,key:s,shiftKey:e.shiftKey},this.keyboardLayoutMap));let l=Jb.encode(s.length===1?s:``),u=l.length===0?0:r.alloc(l.length);u!==0&&r.bytes(u,l.length).set(l),r.call(`ghostty_key_event_set_utf8`,this.keyEvent,u,l.length);let d=r.encodeOutput((e,t,n)=>r.call(`ghostty_key_encoder_encode`,this.keyEncoder,this.keyEvent,e,t,n));return u!==0&&r.free(u,l.length),d}metaText(e){return qb(e,this.keyboardLayoutMap)}refreshKeyboardLayout(){this.loadKeyboardLayout(zb())}encodePaste(e){let t=this.runtime,n=Jb.encode(e);if(n.length===0)return``;let r=t.alloc(n.length);t.bytes(r,n.length).set(n);let i=+!!t.flag(`ghostty_terminal_mode_get`,this.terminal,2004),a=t.encodeOutput((e,a,o)=>t.call(`ghostty_paste_encode`,r,n.length,i,e,a,o));return t.free(r,n.length),a}encodeMouse(e){let t=this.runtime;t.call(`ghostty_mouse_encoder_setopt_from_terminal`,this.mouseEncoder,this.terminal);let n=t.layout(`GhosttyMouseEncoderSize`),r=t.alloc(n.size);for(let i of[[`size`,n.size],[`screen_width`,e.screenWidth],[`screen_height`,e.screenHeight],[`cell_width`,e.cellWidth],[`cell_height`,e.cellHeight],[`padding_top`,0],[`padding_bottom`,0],[`padding_right`,0],[`padding_left`,0]])t.setField(r,`GhosttyMouseEncoderSize`,i[0],Math.max(0,Math.round(i[1])));t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,2,r),t.free(r,n.size),t.bytes(this.scratch,1)[0]=+!!e.anyButtonPressed,t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,3,this.scratch),t.bytes(this.scratch,1)[0]=1,t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,4,this.scratch),t.call(`ghostty_mouse_event_set_action`,this.mouseEvent,{press:0,release:1,motion:2}[e.action]),e.button===null?t.call(`ghostty_mouse_event_clear_button`,this.mouseEvent):t.call(`ghostty_mouse_event_set_button`,this.mouseEvent,e.button),t.call(`ghostty_mouse_event_set_mods`,this.mouseEvent,e.mods);let i=t.layout(`GhosttyMousePosition`),a=t.alloc(i.size),o=t.view(a,i.size);return o.setFloat32(t.field(`GhosttyMousePosition`,`x`).offset,e.x,!0),o.setFloat32(t.field(`GhosttyMousePosition`,`y`).offset,e.y,!0),t.call(`ghostty_mouse_event_set_position`,this.mouseEvent,a),t.free(a,i.size),t.encodeOutput((e,n,r)=>t.call(`ghostty_mouse_encoder_encode`,this.mouseEncoder,this.mouseEvent,e,n,r))}dispose(){let e=this.runtime;e.call(`ghostty_mouse_event_free`,this.mouseEvent),e.call(`ghostty_mouse_encoder_free`,this.mouseEncoder),e.call(`ghostty_key_event_free`,this.keyEvent),e.call(`ghostty_key_encoder_free`,this.keyEncoder),e.free(this.scratch,1),e.freeOpaque(this.mouseEventSlot),e.freeOpaque(this.mouseEncoderSlot),e.freeOpaque(this.keyEventSlot),e.freeOpaque(this.keyEncoderSlot)}async loadKeyboardLayout(e){this.keyboardLayoutMap=await e}isLegacyKeyboard(){return this.encodeKey(new KeyboardEvent(`keydown`,{key:`Tab`,code:`Tab`,shiftKey:!0}))===`\x1B[Z`}},Zb=26,Qb=30,$b=1,ex={imageId:1,placementId:2,isVirtual:3,xOffset:4,yOffset:5,columns:10,rows:11,z:12},tx={width:3,height:4,format:5,data:7,length:8},nx={size:48,pixelWidth:4,pixelHeight:8,column:20,row:24,visible:28,sourceX:32,sourceY:36,sourceWidth:40,sourceHeight:44},rx=new Map([[0,3],[1,4],[3,2],[4,1]]),ix=new Map([773,781,782,784,786,829,830,831,838,842,843,844,848,849,850,855,859,867,868,869,870,871,872,873,874,875,876,877,878,879,1155,1156,1157,1158,1159,1426,1427,1428,1429,1431,1432,1433,1436,1437,1438,1439,1440,1441,1448,1449,1451,1452,1455,1476,1552,1553,1554,1555,1556,1557,1558,1559,1623,1624,1625,1626,1627,1629,1630,1750,1751,1752,1753,1754,1755,1756,1759,1760,1761,1762,1764,1767,1768,1771,1772,1840,1842,1843,1845,1846,1850,1853,1855,1856,1857,1859,1861,1863,1865,1866,2027,2028,2029,2030,2031,2032,2033,2035,2070,2071,2072,2073,2075,2076,2077,2078,2079,2080,2081,2082,2083,2085,2086,2087,2089,2090,2091,2092,2093,2385,2387,2388,3970,3971,3974,3975,4957,4958,4959,6109,6458,6679,6773,6774,6775,6776,6777,6778,6779,6780,7019,7021,7022,7023,7024,7025,7026,7027,7376,7377,7378,7386,7387,7392,7616,7617,7619,7620,7621,7622,7623,7624,7625,7627,7628,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7678,8400,8401,8404,8405,8406,8407,8411,8412,8417,8423,8425,8432,11503,11504,11505,11744,11745,11746,11747,11748,11749,11750,11751,11752,11753,11754,11755,11756,11757,11758,11759,11760,11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,42607,42620,42621,42736,42737,43232,43233,43234,43235,43236,43237,43238,43239,43240,43241,43242,43243,43244,43245,43246,43247,43248,43249,43696,43698,43699,43703,43704,43710,43711,43713,65056,65057,65058,65059,65060,65061,65062,68111,68152,119173,119174,119175,119176,119177,119210,119211,119212,119213,119362,119363,119364].map((e,t)=>[e,t]));function ax(e,t,n){let r=Array.from(e).slice(1,4).map(e=>ix.get(e.codePointAt(0)??0)??null),i=r[2]??null;return{imageId:t,placementId:n,row:r[0]??null,column:r[1]??null,imageIdHigh:i!==null&&i<256?i:null}}function ox(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n].cells,i=null;for(let e=0;e<r.length;e+=1){let a=r[e].placeholder;i!==null&&a!==null&&a.imageId===i.imageId&&a.placementId===i.placementId&&(a.row===null||a.row===i.row)&&(a.column===null||a.column===i.column+i.width)&&(a.imageIdHigh===null||a.imageIdHigh===i.imageIdHigh)?i.width+=1:(i!==null&&t.push(sx(i)),i=a===null?null:{x:e,y:n,imageId:a.imageId,imageIdHigh:a.imageIdHigh,placementId:a.placementId,row:a.row??0,column:a.column??0,width:1})}i!==null&&t.push(sx(i))}return t}function sx(e){return{x:e.x,y:e.y,imageId:e.imageId+(e.imageIdHigh??0)*2**24,placementId:e.placementId,row:e.row,column:e.column,width:e.width}}function cx(e,t,n,r){let i=t.columns===0?Math.ceil(n.width/r.width):t.columns,a=t.rows===0?Math.ceil(n.height/r.height):t.rows,o=i*r.width,s=a*r.height,c=n.width*s>n.height*o,l=c?o/Math.max(n.width,1):s/Math.max(n.height,1),u=c?0:(o-n.width*l)/2/l,d=c?(s-n.height*l)/2/l:0,f=n.width+u*2,p=n.height+d*2,m={x:f*e.column/i,y:p*e.row/a,width:f*e.width/i,height:p/a},h=0,g=0,_=e.width*r.width,v=r.height;if(m.y<d){let e=d-m.y;m.height-=e,g=e,v-=e*l,m.y=0,m.height>n.height&&(m.height=n.height,v=n.height*l)}else m.y+m.height>p-d?(m.y-=d,m.height=p-d-m.y-d,v=m.height*l):m.y-=d;if(m.x<u){let e=u-m.x;m.width-=e,h=e,_-=e*l,m.x=0,m.width>n.width&&(m.width=n.width,_=n.width*l)}else m.x+m.width>f-u?(m.x-=u,m.width=f-u-m.x-u,_=m.width*l):m.x-=u;if(m.width<=0||m.height<=0)return null;let y={xOffset:Math.round(h*l),yOffset:Math.round(g*l),width:Math.round(_),height:Math.round(v),source:{x:Math.round(m.x),y:Math.round(m.y),width:Math.round(m.width),height:Math.round(m.height)}};return y.width===0||y.height===0?null:y}function lx(e){let t=Nb(),n=t.alloc(16),r=t.call(`ghostty_terminal_get`,e,Zb,n);return t.free(n,16),r===0}var ux=class{runtime=Nb();terminal;iteratorSlot;info;scratch;tail=[0,0];commands=0;cachedCommands=0;bitmaps=new Map;constructor(e){let t=this.runtime;this.terminal=e,this.iteratorSlot=t.allocOpaque(),t.check(`ghostty_kitty_graphics_placement_iterator_new`,t.call(`ghostty_kitty_graphics_placement_iterator_new`,0,this.iteratorSlot)),this.info=t.alloc(nx.size),this.scratch=t.alloc(16)}note(e){let t=[...this.tail,...e.subarray(0,2)],n=t.some((e,n)=>e===27&&t[n+1]===95&&t[n+2]===71),r=e.indexOf(27);for(;!n&&r!==-1;)n=e[r+1]===95&&e[r+2]===71,r=e.indexOf(27,r+1);n&&(this.commands+=1),this.tail=[...this.tail,...e.subarray(-2)].slice(-2)}images(e,t){this.commands!==this.cachedCommands&&(this.cachedCommands=this.commands,this.bitmaps.clear());let n=new Map,r=this.placements(e,t).map(e=>{let t=n.get(e.key)??this.bitmaps.get(e.key)??px(e.image);return n.set(e.key,t),{placement:e,bitmap:t}});return this.bitmaps=n,r}dispose(){let e=this.runtime;e.call(`ghostty_kitty_graphics_placement_iterator_free`,e.readPointer(this.iteratorSlot)),e.free(this.info,nx.size),e.free(this.scratch,16),e.freeOpaque(this.iteratorSlot),this.bitmaps.clear()}placements(e,t){let n=this.runtime;n.check(`ghostty_terminal_get`,n.call(`ghostty_terminal_get`,this.terminal,Qb,this.scratch));let r=n.readPointer(this.scratch);n.check(`ghostty_kitty_graphics_get`,n.call(`ghostty_kitty_graphics_get`,r,$b,this.iteratorSlot));let i=n.readPointer(this.iteratorSlot),a=[],o=[];for(;n.call(`ghostty_kitty_graphics_placement_next`,i);){let e=this.placementU32(i,ex.imageId);if(this.placementData(i,ex.isVirtual).getUint8(0)){o.push({imageId:e,placementId:this.placementU32(i,ex.placementId),columns:this.placementU32(i,ex.columns),rows:this.placementU32(i,ex.rows)});continue}let t=n.call(`ghostty_kitty_graphics_image`,r,e);if(t===0)throw Error(`kitty placement points to missing image ${e}`);n.bytes(this.info,nx.size).fill(0);let s=n.view(this.info,nx.size);s.setUint32(0,nx.size,!0),n.check(`ghostty_kitty_graphics_placement_render_info`,n.call(`ghostty_kitty_graphics_placement_render_info`,i,t,this.terminal,this.info)),s.getUint8(nx.visible)!==0&&a.push({...this.image(t,e),z:this.placementData(i,ex.z).getInt32(0,!0),column:s.getInt32(nx.column,!0),row:s.getInt32(nx.row,!0),xOffset:this.placementU32(i,ex.xOffset),yOffset:this.placementU32(i,ex.yOffset),width:s.getUint32(nx.pixelWidth,!0),height:s.getUint32(nx.pixelHeight,!0),source:{x:s.getUint32(nx.sourceX,!0),y:s.getUint32(nx.sourceY,!0),width:s.getUint32(nx.sourceWidth,!0),height:s.getUint32(nx.sourceHeight,!0)}})}if(o.length===0)return a;for(let i of ox(e)){let e=o.find(e=>e.imageId===i.imageId&&(i.placementId===0||e.placementId===i.placementId));if(e===void 0)continue;let s=n.call(`ghostty_kitty_graphics_image`,r,i.imageId);if(s===0)continue;let c=this.image(s,i.imageId),l=cx(i,e,c.image,t);l!==null&&a.push({...c,...l,z:-1,column:i.x,row:i.y})}return a}image(e,t){let n=this.imageData(e,tx.data),r=this.imageData(e,tx.length);return{key:`${t}:${n}:${r}`,image:{width:this.imageData(e,tx.width),height:this.imageData(e,tx.height),format:this.imageData(e,tx.format),pixels:this.runtime.bytes(n,r)}}}placementData(e,t){return this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_kitty_graphics_placement_get`,this.runtime.call(`ghostty_kitty_graphics_placement_get`,e,t,this.scratch)),this.runtime.view(this.scratch,4)}placementU32(e,t){return this.placementData(e,t).getUint32(0,!0)}imageData(e,t){return this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_kitty_graphics_image_get`,this.runtime.call(`ghostty_kitty_graphics_image_get`,e,t,this.scratch)),this.runtime.view(this.scratch,4).getUint32(0,!0)}};function dx(e,t,n,r,i){let a=r.width/i.width,o=r.height/i.height;for(let i of t){let t=i.placement;fx(t.z)===n&&e.drawImage(i.bitmap,t.source.x,t.source.y,t.source.width,t.source.height,t.column*r.width+t.xOffset*a,t.row*r.height+t.yOffset*o,t.width*a,t.height*o)}}function fx(e){return e<-1073741824?`belowBackground`:e<0?`belowText`:`aboveText`}function px(e){let t=rx.get(e.format);if(t===void 0)throw Error(`unsupported kitty image format ${e.format}`);let n=e.width*e.height,r=e.pixels,i=new Uint8ClampedArray(n*4);if(t===4)i.set(r.subarray(0,n*4));else for(let e=0;e<n;e+=1){let n=e*t,a=e*4;t===3?i.set(r.subarray(n,n+3),a):i.fill(r[n],a,a+3),i[a+3]=t===2?r[n+1]:255}let a=new OffscreenCanvas(e.width,e.height),o=a.getContext(`2d`);if(!o)throw Error(`could not create a canvas for a kitty image`);return o.putImageData(new ImageData(i,e.width,e.height),0,0),a}var mx=8,hx=16,gx=0,_x=1,vx=2,yx=8,bx={cols:1,rows:2,dirty:3,rowIterator:4,background:5,foreground:6,cursor:7,cursorHasValue:8,cursorStyle:10,cursorVisible:11,cursorBlinking:12,cursorInViewport:14,cursorX:15,cursorY:16},xx={dirty:1,raw:2,cells:3},Sx={raw:1,style:2,graphemesLength:3,graphemes:4,background:5,foreground:6,selected:7},Cx={keys:0,values:20,graphemesLength:40,selected:44,background:48,foreground:52,written:56,size:60},wx={narrow:0,wide:1,spacerTail:2},Tx={r:229,g:231,b:235},Ex={r:0,g:0,b:0};function Dx(e,t){return Math.floor((e*155+t*100)/255)}function Ox(e,t){return{r:Dx(e.r,t.r),g:Dx(e.g,t.g),b:Dx(e.b,t.b)}}function kx(e,t){let n=``;for(let r=0;r<t;r+=4096){let i=Math.min(4096,t-r),a=Array(i);for(let t=0;t<i;t+=1)a[t]=e.getUint32((r+t)*4,!0);n+=String.fromCodePoint(...a)}return n}function Ax(e,t){return{text:``,wide:0,foreground:e,background:t,bold:!1,italic:!1,invisible:!1,strikethrough:!1,overline:!1,underline:0,underlineColor:null,selected:!1,placeholder:null}}function jx(e,t){let n=e.dataView();return{r:n.getUint8(t),g:n.getUint8(t+1),b:n.getUint8(t+2)}}function Mx(e,t){let n=e.alloc(768);e.call(`ghostty_terminal_get`,t,21,n);let r=e.bytes(n,768),i=Array.from({length:256},(e,t)=>({r:r[t*3],g:r[t*3+1],b:r[t*3+2]}));return e.free(n,768),i}function Nx(e,t){let n=[],r=[];return e.cells.forEach((e,i)=>{if(e.wide!==2)for(let a of(e.text||` `).split(``))n.push(a),r.push({x:i,y:t})}),{text:n.join(``),points:r}}var Px=class{runtime=Nb();stateSlot;state;rowIteratorSlot;rowCellsSlot;scratch;style;cellQuery;graphemes=0;graphemeCapacity=0;rows=[];palette=[];constructor(){let e=this.runtime;this.stateSlot=e.allocOpaque(),e.check(`ghostty_render_state_new`,e.call(`ghostty_render_state_new`,0,this.stateSlot)),this.state=e.readPointer(this.stateSlot),this.rowIteratorSlot=e.allocOpaque(),e.check(`ghostty_render_state_row_iterator_new`,e.call(`ghostty_render_state_row_iterator_new`,0,this.rowIteratorSlot)),this.rowCellsSlot=e.allocOpaque(),e.check(`ghostty_render_state_row_cells_new`,e.call(`ghostty_render_state_row_cells_new`,0,this.rowCellsSlot)),this.scratch=e.alloc(16),this.style=e.alloc(e.layout(`GhosttyStyle`).size),this.cellQuery=e.alloc(Cx.size);let t=e.dataView();[[Sx.style,this.style],[Sx.graphemesLength,this.cellQuery+Cx.graphemesLength],[Sx.selected,this.cellQuery+Cx.selected],[Sx.background,this.cellQuery+Cx.background],[Sx.foreground,this.cellQuery+Cx.foreground]].forEach((e,n)=>{t.setUint32(this.cellQuery+Cx.keys+n*4,e[0],!0),t.setUint32(this.cellQuery+Cx.values+n*4,e[1],!0)})}snapshot(e,t){let n=this.runtime;n.check(`ghostty_render_state_update`,n.call(`ghostty_render_state_update`,this.state,e));let r=this.getRender(bx.cols,2),i=this.getRender(bx.rows,2),a=this.getRender(bx.dirty,4),o=this.getColor(bx.foreground,Tx),s=this.getColor(bx.background,Ex),c=this.getRender(bx.cursorHasValue,1)===0?o:this.getColor(bx.cursor,o),l=this.getRender(bx.cursorInViewport,1)!==0,u=this.getRender(bx.cursorVisible,1)!==0&&l;(this.rows.length!==i||this.rows.some(e=>e.cells.length!==r))&&(this.rows=Array.from({length:i},()=>({cells:Array.from({length:r},()=>Ax(o,s)),isWrapContinuation:!1,wrapsToNext:!1})));let d=new Set;if(a!==0){this.palette=Mx(n,e),n.check(`ghostty_render_state_get`,n.call(`ghostty_render_state_get`,this.state,bx.rowIterator,this.rowIteratorSlot));let c=n.readPointer(this.rowIteratorSlot),l=0;for(;l<i&&n.call(`ghostty_render_state_row_iterator_next`,c)!==0;)(a===2||this.getRowFlag(c,xx.dirty))&&(this.rows[l]=this.readRow(c,r,o,s,t),d.add(l),n.bytes(this.scratch,1)[0]=0,n.call(`ghostty_render_state_row_set`,c,0,this.scratch)),l+=1;n.view(this.scratch,4).setUint32(0,0,!0),n.call(`ghostty_render_state_set`,this.state,0,this.scratch)}return{cols:r,rows:i,foreground:o,background:s,cursor:c,cursorX:l?this.getRender(bx.cursorX,2):-1,cursorY:l?this.getRender(bx.cursorY,2):-1,cursorVisible:u,cursorBlinking:this.getRender(bx.cursorBlinking,1)!==0,cursorStyle:this.getRender(bx.cursorStyle,4),dirtyRows:d,rowData:this.rows}}invalidate(){this.rows=[]}dispose(){let e=this.runtime,t=e.readPointer(this.rowCellsSlot);t&&e.call(`ghostty_render_state_row_cells_free`,t);let n=e.readPointer(this.rowIteratorSlot);n&&e.call(`ghostty_render_state_row_iterator_free`,n),e.call(`ghostty_render_state_free`,this.state),e.free(this.style,e.layout(`GhosttyStyle`).size),e.free(this.cellQuery,Cx.size),e.free(this.scratch,16),e.free(this.graphemes,this.graphemeCapacity),e.freeOpaque(this.rowCellsSlot),e.freeOpaque(this.rowIteratorSlot),e.freeOpaque(this.stateSlot)}readRow(e,t,n,r,i){let a=this.runtime;a.check(`ghostty_render_state_row_get`,a.call(`ghostty_render_state_row_get`,e,xx.raw,this.scratch));let o=a.view(this.scratch,8).getBigUint64(0,!0);a.bytes(this.scratch+8,1)[0]=0,a.call(`ghostty_row_get`,o,2,this.scratch+8);let s=a.bytes(this.scratch+8,1)[0]!==0;a.bytes(this.scratch+8,1)[0]=0,a.call(`ghostty_row_get`,o,1,this.scratch+8);let c=a.bytes(this.scratch+8,1)[0]!==0;a.check(`ghostty_render_state_row_get`,a.call(`ghostty_render_state_row_get`,e,xx.cells,this.rowCellsSlot));let l=a.readPointer(this.rowCellsSlot),u=a.layout(`GhosttyStyle`),d=u.size,f=u.fields,p=[];for(;p.length<t&&a.call(`ghostty_render_state_row_cells_next`,l)!==0;){a.bytes(this.style,d).fill(0),a.setField(this.style,`GhosttyStyle`,`size`,d);let e=a.call(`ghostty_render_state_row_cells_get_multi`,l,5,this.cellQuery+Cx.keys,this.cellQuery+Cx.values,this.cellQuery+Cx.written),t=a.dataView(),o=t.getUint32(this.cellQuery+Cx.written,!0);o<3&&a.check(`ghostty_render_state_row_cells_get_multi`,e);let s=t.getUint32(this.cellQuery+Cx.graphemesLength,!0),c=t.getUint8(this.cellQuery+Cx.selected)!==0,u=o>=4?jx(a,this.cellQuery+Cx.background):r,m=o===5?jx(a,this.cellQuery+Cx.foreground):o===3?this.getCellColor(l,n):n,h=``;if(s>0){let e=s*4;if(e>this.graphemeCapacity){let t=Math.max(e,this.graphemeCapacity*2),n=a.alloc(t);a.free(this.graphemes,this.graphemeCapacity),this.graphemes=n,this.graphemeCapacity=t}a.call(`ghostty_render_state_row_cells_get`,l,Sx.graphemes,this.graphemes)===0&&(h=kx(a.view(this.graphemes,e),s))}let g=0;if(h.length===0&&p.at(-1)?.text.length){a.call(`ghostty_render_state_row_cells_get`,l,Sx.raw,this.scratch);let e=a.view(this.scratch,8).getBigUint64(0,!0);a.view(this.scratch+8,4).setUint32(0,0,!0),a.call(`ghostty_cell_get`,e,3,this.scratch+8),g=a.view(this.scratch+8,4).getUint32(0,!0)}let _=a.dataView(),v=e=>_.getUint8(this.style+f[e].offset)!==0,y=v(`bold`);if(i&&y&&_.getUint32(this.style+mx,!0)===_x){let e=_.getUint8(this.style+hx);e<8&&(m=this.palette[e+8]??m)}if(v(`inverse`)){let e=m;m=u,u=e}v(`faint`)&&(m=Ox(m,u));let b=this.style+f.underline_color.offset,x=_.getUint32(b,!0),S=b+yx,C=null;h.codePointAt(0)===1109742&&(C=ax(h,this.colorId(this.style+mx),this.colorId(b)),h=``),p.push({text:h,wide:g,foreground:m,background:u,bold:y,italic:v(`italic`),invisible:v(`invisible`),strikethrough:v(`strikethrough`),overline:v(`overline`),underline:_.getInt32(this.style+f.underline.offset,!0),underlineColor:x===_x?this.palette[_.getUint8(S)]:x===vx?jx(a,S):null,selected:c,placeholder:C})}for(;p.length<t;)p.push(Ax(n,r));return{cells:p,isWrapContinuation:s,wrapsToNext:c}}getRender(e,t){this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.state,e,this.scratch));let n=this.runtime.view(this.scratch,4);return t===1?n.getUint8(0):t===2?n.getUint16(0,!0):n.getUint32(0,!0)}getColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_get`,this.state,e,this.scratch)===0?jx(this.runtime,this.scratch):t}getRowFlag(e,t){return this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_render_state_row_get`,e,t,this.scratch)===0&&this.runtime.bytes(this.scratch,1)[0]!==0}getCellColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_row_cells_get`,e,Sx.foreground,this.scratch)===0?jx(this.runtime,this.scratch):t}colorId(e){let t=this.runtime.dataView(),n=t.getUint32(e,!0);if(n===gx)return 0;if(n===_x)return t.getUint8(e+yx);if(n===vx){let t=jx(this.runtime,e+yx);return t.r<<16|t.g<<8|t.b}throw Error(`unknown style color tag ${n}`)}},Fx=16,Ix=589824,Lx=381888,Rx=5e7,zx=new TextDecoder;function Bx(e){let t=[...e],n=[0,95,135,175,215,255];for(let e=16;e<232;e+=1){let r=e-16;t.push({r:n[Math.floor(r/36)],g:n[Math.floor(r/6)%6],b:n[r%6]})}for(let e=0;e<24;e+=1){let n=8+e*10;t.push({r:n,g:n,b:n})}return t}var Vx=class{encoder;kitty;runtime=Nb();terminalSlot;terminal;renderState;formatterSlot;formatter;scratch;point;scrollbar;host;hostId=0;sizeReport;disposed=!1;boldIsBright=!1;version=``;constructor(e,t,n,r,i){let a=this.runtime,o=a.layout(`GhosttyTerminalOptions`).size,s=a.alloc(o);a.setField(s,`GhosttyTerminalOptions`,`cols`,e),a.setField(s,`GhosttyTerminalOptions`,`rows`,t);let c=Math.floor(Lx/(8*(e+1)));a.setField(s,`GhosttyTerminalOptions`,`max_scrollback`,n===0?0:Math.min((Math.ceil(n/c)+1)*Ix,Rx)),this.terminalSlot=a.allocOpaque();let l=a.call(`ghostty_terminal_new`,0,this.terminalSlot,s);if(a.free(s,o),a.check(`ghostty_terminal_new`,l),this.terminal=a.readPointer(this.terminalSlot),!lx(this.terminal))throw a.call(`ghostty_terminal_free`,this.terminal),a.freeOpaque(this.terminalSlot),Error(`libghostty-vt was built without kitty graphics, build it with scripts/build-ghostty-wasm.mts`);this.sizeReport={rows:t,columns:e,cellWidth:1,cellHeight:1},this.host={write:r,size:()=>this.sizeReport,bell:i,version:()=>this.version},this.hostId=a.attachHost(this.terminal,this.host),this.renderState=new Px,this.encoder=new Xb(this.terminal),this.kitty=new ux(this.terminal);let u=`GhosttyFormatterTerminalOptions`,d=a.layout(u),f=a.alloc(d.size),p=a.field(u,`extra`),m=a.field(`GhosttyFormatterTerminalExtra`,`screen`);a.setField(f,u,`size`,d.size),a.setField(f,u,`trim`,1),a.setField(f+p.offset,`GhosttyFormatterTerminalExtra`,`size`,p.size),a.setField(f+p.offset+m.offset,`GhosttyFormatterScreenExtra`,`size`,m.size),this.formatterSlot=a.allocOpaque();let h=a.call(`ghostty_formatter_terminal_new`,0,this.formatterSlot,this.terminal,f);a.free(f,d.size),a.check(`ghostty_formatter_terminal_new`,h),this.formatter=a.readPointer(this.formatterSlot),this.scratch=a.alloc(16),this.point=a.alloc(a.layout(`GhosttyPoint`).size),this.scrollbar=a.alloc(a.layout(`GhosttyTerminalScrollbar`).size)}write(e){if(e.length===0)return;this.kitty.note(e);let t=this.runtime.alloc(e.length);this.runtime.bytes(t,e.length).set(e),this.runtime.call(`ghostty_terminal_vt_write`,this.terminal,t,e.length),this.runtime.free(t,e.length)}setReplies(e){e&&this.hostId===0?this.hostId=this.runtime.attachHost(this.terminal,this.host):!e&&this.hostId!==0&&(this.runtime.detachHost(this.terminal,this.hostId),this.hostId=0)}reset(){this.runtime.call(`ghostty_terminal_reset`,this.terminal),this.renderState.invalidate()}resize(e,t,n,r,i){this.sizeReport={rows:t,columns:e,cellWidth:Math.max(1,Math.round(n*i)),cellHeight:Math.max(1,Math.round(r*i))},this.runtime.check(`ghostty_terminal_resize`,this.runtime.call(`ghostty_terminal_resize`,this.terminal,Math.max(1,Math.min(65535,e)),Math.max(1,Math.min(65535,t)),this.sizeReport.cellWidth,this.sizeReport.cellHeight))}setColors(e){let t=this.runtime.alloc(3);for(let n of[[11,e.foreground],[12,e.background],[13,e.cursor]]){let e=n[1];this.runtime.bytes(t,3).set([e.r,e.g,e.b]),this.runtime.call(`ghostty_terminal_set`,this.terminal,n[0],t)}this.runtime.free(t,3);let n=Bx(e.palette),r=this.runtime.alloc(n.length*3);this.runtime.bytes(r,n.length*3).set(n.flatMap(e=>[e.r,e.g,e.b])),this.runtime.call(`ghostty_terminal_set`,this.terminal,14,r),this.runtime.free(r,n.length*3),this.renderState.invalidate()}setCursor(e,t){let n={bar:0,block:1,underline:2}[e];this.runtime.view(this.scratch,4).setUint32(0,n,!0),this.runtime.call(`ghostty_terminal_set`,this.terminal,22,this.scratch),this.runtime.bytes(this.scratch,1)[0]=+!!t,this.runtime.call(`ghostty_terminal_set`,this.terminal,23,this.scratch)}title(){if(this.runtime.bytes(this.scratch,8).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,12,this.scratch)!==0)return``;let e=this.runtime.view(this.scratch,8),t=e.getUint32(0,!0),n=e.getUint32(4,!0);return n===0?``:zx.decode(this.runtime.bytes(t,n))}screenText(){let e=this.runtime.alloc(8),t=this.runtime.call(`ghostty_formatter_format_alloc`,this.formatter,0,e,e+4),n=this.runtime.view(e,8),r=n.getUint32(0,!0),i=n.getUint32(4,!0);if(this.runtime.free(e,8),t!==0)return``;let a=zx.decode(this.runtime.bytes(r,i));return this.runtime.call(`ghostty_free`,0,r,i),a}scroll(e){let t=this.runtime.layout(`GhosttyTerminalScrollViewport`),n=this.runtime.alloc(t.size);this.runtime.setField(n,`GhosttyTerminalScrollViewport`,`tag`,2);let r=this.runtime.field(`GhosttyTerminalScrollViewport`,`value`);this.runtime.view(n+r.offset,r.size).setInt32(0,e,!0),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,n),this.runtime.free(n,t.size)}scrollToBottom(){let e=this.runtime.layout(`GhosttyTerminalScrollViewport`),t=this.runtime.alloc(e.size);this.runtime.setField(t,`GhosttyTerminalScrollViewport`,`tag`,1),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,t),this.runtime.free(t,e.size)}scrollbarState(){let e=this.runtime.layout(`GhosttyTerminalScrollbar`);return this.runtime.bytes(this.scrollbar,e.size).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,9,this.scrollbar)===0?{total:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`total`),offset:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`offset`),len:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`len`)}:null}isMouseTracking(){return this.flag(`ghostty_terminal_get`,11)}isMouseAnyEventTracking(){return this.flag(`ghostty_terminal_mode_get`,1003)}isFocusReporting(){return this.flag(`ghostty_terminal_mode_get`,1004)}isSynchronizedOutput(){return this.flag(`ghostty_terminal_mode_get`,2026)}endSynchronizedOutput(){this.runtime.check(`ghostty_terminal_mode_set`,this.runtime.call(`ghostty_terminal_mode_set`,this.terminal,2026,0))}currentColors(){return{foreground:this.terminalColor(18),background:this.terminalColor(19),cursor:this.terminalColor(20),palette:Mx(this.runtime,this.terminal)}}isApplicationCursorKeys(){return this.flag(`ghostty_terminal_mode_get`,1)}isKittyKeyboard(){return this.flag(`ghostty_terminal_get`,8)}isAlternateScreen(){return this.runtime.dataView().setUint32(this.scratch,0,!0),this.runtime.call(`ghostty_terminal_get`,this.terminal,6,this.scratch)===0&&this.runtime.dataView().getUint32(this.scratch,!0)===1}setSelection(e,t){let n=this.runtime.layout(`GhosttyGridRef`).size,r=this.gridRef(e.x,e.y,2);try{let e=this.gridRef(t.x,t.y,2),i=this.runtime.layout(`GhosttySelection`),a=this.runtime.alloc(i.size);this.runtime.setField(a,`GhosttySelection`,`size`,i.size);let o=this.runtime.field(`GhosttySelection`,`start`),s=this.runtime.field(`GhosttySelection`,`end`);this.runtime.bytes(a+o.offset,o.size).set(this.runtime.bytes(r,o.size)),this.runtime.bytes(a+s.offset,s.size).set(this.runtime.bytes(e,s.size)),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,a),this.runtime.free(e,n),this.runtime.free(a,i.size)}finally{this.runtime.free(r,n)}}selectWord(e){return this.selectAt(`GhosttyTerminalSelectWordOptions`,`ghostty_terminal_select_word`,e)}selectLine(e){return this.selectAt(`GhosttyTerminalSelectLineOptions`,`ghostty_terminal_select_line`,e)}clearSelection(){this.runtime.call(`ghostty_terminal_set`,this.terminal,21,0)}selectionText(){let e=this.runtime.alloc(Fx),t=this.runtime.view(e,Fx);t.setUint32(0,Fx,!0),t.setUint8(8,1),t.setUint8(9,1);let n=this.runtime.encodeOutput((t,n,r)=>this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,t,n,r));return this.runtime.free(e,Fx),n}hyperlinkAt(e,t){let n=this.gridRef(e,t,1),r=this.hyperlinkOf(n);return this.runtime.free(n,this.runtime.layout(`GhosttyGridRef`).size),r}toScreen(e){let t=this.gridRef(e.x,e.y,1),n=this.pointFromGridRef(t,2);return this.runtime.free(t,this.runtime.layout(`GhosttyGridRef`).size),n}trackCursor(){let e=this.runtime.allocOpaque(),t=this.runtime.call(`ghostty_terminal_grid_ref_track`,this.terminal,this.cursorPoint(),e),n=this.runtime.readPointer(e);return this.runtime.freeOpaque(e),this.runtime.check(`ghostty_terminal_grid_ref_track`,t),n}retrack(e){let t=this.runtime.call(`ghostty_tracked_grid_ref_set`,e,this.terminal,this.cursorPoint());this.runtime.check(`ghostty_tracked_grid_ref_set`,t)}trackedPoint(e){return this.runtime.call(`ghostty_tracked_grid_ref_point`,e,2,this.scratch)===0?{x:this.runtime.readField(this.scratch,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(this.scratch,`GhosttyPointCoordinate`,`y`)}:null}trackedHyperlink(e){let t=this.runtime.layout(`GhosttyGridRef`).size,n=this.runtime.alloc(t);this.runtime.setField(n,`GhosttyGridRef`,`size`,t);let r=this.runtime.call(`ghostty_tracked_grid_ref_snapshot`,e,n)===0?this.hyperlinkOf(n):null;return this.runtime.free(n,t),r}untrack(e){this.runtime.call(`ghostty_tracked_grid_ref_free`,e)}snapshot(){return this.renderState.snapshot(this.terminal,this.boldIsBright)}invalidate(){this.renderState.invalidate()}cellSize(){return{width:this.sizeReport.cellWidth,height:this.sizeReport.cellHeight}}dispose(){if(this.disposed)return;this.disposed=!0;let e=this.runtime;e.call(`ghostty_formatter_free`,this.formatter),this.encoder.dispose(),this.kitty.dispose(),this.renderState.dispose(),this.hostId!==0&&e.detachHost(this.terminal,this.hostId),e.call(`ghostty_terminal_free`,this.terminal),e.free(this.scrollbar,e.layout(`GhosttyTerminalScrollbar`).size),e.free(this.scratch,16),e.free(this.point,e.layout(`GhosttyPoint`).size),e.freeOpaque(this.formatterSlot),e.freeOpaque(this.terminalSlot)}hyperlinkOf(e){let t=this.runtime.encodeOutput((t,n,r)=>this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,e,t,n,r));return t===``?null:t}cursorPosition(){this.runtime.dataView().setUint32(this.scratch,0,!0),this.runtime.call(`ghostty_terminal_get`,this.terminal,3,this.scratch),this.runtime.call(`ghostty_terminal_get`,this.terminal,4,this.scratch+2);let e=this.runtime.dataView();return{x:e.getUint16(this.scratch,!0),y:e.getUint16(this.scratch+2,!0)}}cursorPoint(){let e=this.cursorPosition();return this.fillPoint(this.point,e.x,e.y,0),this.point}fillPoint(e,t,n,r){this.runtime.setField(e,`GhosttyPoint`,`tag`,r);let i=this.runtime.field(`GhosttyPoint`,`value`),a=this.runtime.dataView();a.setUint16(e+i.offset,Math.max(0,t),!0),a.setUint32(e+i.offset+4,Math.max(0,n),!0)}gridRef(e,t,n){let r=this.runtime.alloc(this.runtime.layout(`GhosttyPoint`).size);this.fillPoint(r,e,t,n);let i=this.runtime.layout(`GhosttyGridRef`).size,a=this.runtime.alloc(i);this.runtime.setField(a,`GhosttyGridRef`,`size`,i);let o=this.runtime.call(`ghostty_terminal_grid_ref`,this.terminal,r,a);return this.runtime.free(r,this.runtime.layout(`GhosttyPoint`).size),o!==0&&(this.runtime.free(a,i),this.runtime.check(`ghostty_terminal_grid_ref`,o)),a}selectAt(e,t,n){let r=this.gridRef(n.x,n.y,2),i=this.runtime.layout(e),a=this.runtime.layout(`GhosttySelection`),o=this.runtime.alloc(i.size),s=this.runtime.alloc(a.size);this.runtime.setField(o,e,`size`,i.size);let c=this.runtime.field(e,`ref`);this.runtime.bytes(o+c.offset,c.size).set(this.runtime.bytes(r,c.size)),this.runtime.setField(s,`GhosttySelection`,`size`,a.size);let l=null;if(this.runtime.call(t,this.terminal,o,s)===0){let e=this.pointFromGridRef(s+this.runtime.field(`GhosttySelection`,`start`).offset,2),t=this.pointFromGridRef(s+this.runtime.field(`GhosttySelection`,`end`).offset,2);e&&t&&(l={start:e,end:t})}return this.runtime.free(s,a.size),this.runtime.free(r,this.runtime.layout(`GhosttyGridRef`).size),this.runtime.free(o,i.size),l}pointFromGridRef(e,t){let n=this.runtime.layout(`GhosttyPointCoordinate`),r=this.runtime.alloc(n.size),i=this.runtime.call(`ghostty_terminal_point_from_grid_ref`,this.terminal,e,t,r)===0?{x:this.runtime.readField(r,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(r,`GhosttyPointCoordinate`,`y`)}:null;return this.runtime.free(r,n.size),i}flag(e,t){return this.runtime.flag(e,this.terminal,t)}terminalColor(e){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.check(`ghostty_terminal_get`,this.runtime.call(`ghostty_terminal_get`,this.terminal,e,this.scratch)),jx(this.runtime,this.scratch)}};function Hx(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=r.indexOf(i);for(;a!==-1;)n.push(a),a=r.indexOf(i,a+i.length);return n}var Ux=class{core;redraw;listeners=new Set;query=``;matches=[];activeMatch=-1;stale=!1;timer=null;constructor(e,t){this.core=e,this.redraw=t}find(e,t,n,r){let i=this.matches[this.activeMatch]??null;if(this.query=e,this.refresh(),this.matches.length===0)this.activeMatch=-1;else if(n||i===null){let e=i?.row??r,t=this.matches.findIndex(t=>t.row>=e);this.activeMatch=t===-1?this.matches.length-1:t}else{let e=this.matches.findIndex(e=>e.row===i.row&&e.index===i.index),n=e===-1?0:e,r=t?-1:1;this.activeMatch=(n+r+this.matches.length)%this.matches.length}return this.emit(),this.matches[this.activeMatch]??null}onResults(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}clear(){this.query=``,this.matches=[],this.activeMatch=-1}outputChanged(){this.query!==``&&(this.stale=!0,this.timer===null&&(this.timer=window.setTimeout(()=>{if(this.timer=null,!this.stale||this.query===``)return;let e=this.matches[this.activeMatch];this.refresh();let t=e?this.matches.findIndex(t=>t.row===e.row&&t.index===e.index):-1;this.activeMatch=t===-1?this.matches.length-1:t,this.emit(),this.redraw()},200)))}highlights(e,t){if(this.query===``)return[];let n=this.matches[this.activeMatch],r=[];return e.rowData.forEach((e,i)=>{let a=Nx(e,i);Hx(a.text,this.query).forEach((e,o)=>{let s=a.points[e],c=a.points[e+this.query.length-1];s&&c&&r.push({row:i,start:s.x,end:c.x+1,active:n?.row===t+i&&n.index===o})})}),r}dispose(){this.timer!==null&&window.clearTimeout(this.timer),this.timer=null}refresh(){this.stale=!1,this.matches=[],this.query!==``&&this.core.screenText().split(`
|
|
65
|
+
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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ll(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ll(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Rl=new Set([`type`,`properties`,`required`,`additionalProperties`]),zl=[`oneOf`,`anyOf`];function Bl(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Vl(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Rl.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Bl(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Wr(n,r,e.length===1?e[0]:Vl(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Bl(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Hl(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Rl)if(t in e)return;let n=t.filter(e=>zl.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Vl(t);else{let e=n[0],i=zl.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Vl([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,jl(e,r))}function Ul(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)):jl(i,s),jl(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ll(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Hl(e)}}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)}jl(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Wr(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Kl(t,`input`,e.processors),output:Kl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Wl(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 Wl(r.element,n);if(r.type===`set`)return Wl(r.valueType,n);if(r.type===`lazy`)return Wl(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`||r.type===`catch`)return Wl(r.innerType,n);if(r.type===`intersection`)return Wl(r.left,n)||Wl(r.right,n);if(r.type===`record`||r.type===`map`)return Wl(r.keyType,n)||Wl(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Wl(r.in,n)||Wl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Wl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Wl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Wl(e,n))return!0;return!!(r.rest&&Wl(r.rest,n))}return!1}var Gl=(e,t={})=>n=>{let r=Ml({...n,processors:t});return Pl(e,r),Il(r,e),Ul(r,e)},Kl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ml({...i??{},target:a,io:t,processors:n});return Pl(e,o),Il(o,e),Ul(o,e)},ql=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Jl=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Yl=(e,t)=>{ql(e,`minimum`,t),Jl(e,`maximum`,t)},Xl=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Zl=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ql=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},$l=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},eu=(e,t)=>ql(e,`minimum`,t.minimum),tu=(e,t)=>Jl(e,`maximum`,t.maximum),nu=e=>(t,n)=>{$l(t,n.format);let[r,i]=e[n.format];ql(t,`minimum`,r),Jl(t,`maximum`,i)},ru={greater_than:(e,t)=>ql(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Jl(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Xl(e,t.value),number_format:nu(ui),bigint_format:nu(di),min_length:eu,max_length:tu,length_equals:(e,t)=>Yl(e,t.length),min_size:eu,max_size:tu,size_equals:(e,t)=>Yl(e,t.size),string_format:(e,t)=>{$l(e,t.format),t.pattern&&Zl(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ql(e,t.mime)};function iu(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ru[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ql(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ql(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Jl(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Jl(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Xl(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ql(t,i.mime);for(let e of i.patterns??[])Zl(t,e);return t}var au={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ou=new Map([[fs,Ja],[ms,Ya]]),su=e=>ou.get(e)??e,cu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=iu(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=au[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(su);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}))])}},lu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=iu(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Nl(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},uu=(e,t,n,r)=>{n.type=`boolean`},du=(e,t,n,r)=>{n.not={}},fu=(e,t,n,r)=>{let i=e._zod.def,a=Ir(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},pu=(e,t,n,r)=>{Nl(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},mu=(e,t,n,r)=>{Nl(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},hu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=iu(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Pl(a.element,t,{...r,path:[...r.path,`items`]})};function gu(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?gu(t.out):t.type===`catch`?gu(t.innerType):e._zod.optin}var _u=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Nl(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Wr(i.properties,e,Pl(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?gu(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Pl(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},vu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Pl(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},yu=(e,t,n,r)=>{let i=e._zod.def,a=Pl(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Pl(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},bu=(e,t,n,r)=>{let i=e._zod.def,a=Pl(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`}]},xu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Su=Symbol();function Cu(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Nl(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Su):JSON.parse(o)}var wu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Cu(i.defaultValue,e,t,n,r);o!==Su&&(n.default=o)},Tu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Cu(i.defaultValue,e,t,n,r);o!==Su&&(n._prefault=o)},Eu=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Nl(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Du=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Pl(o,t,r);let s=t.seen.get(e);s.ref=o},Ou=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ku=(e,t,n,r)=>{let i=e._zod.def;Pl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Au=new WeakSet([Object.prototype,Error.prototype]);function ju(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Mu=L(`ZodError`,(e,t)=>{oa.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Au.has(n)||(Au.add(n),ju(n,`format`,e=>t=>la(e,t)),ju(n,`flatten`,e=>t=>ca(e,t)),ju(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Rr,2)}),ju(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Rr,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Nu=pa(Mu),Pu=ma(Mu),Fu=ha(Mu),Iu=_a(Mu),Lu=Ca(Mu),Ru=wa(Mu),zu=Ta(Mu),Bu=Ea(Mu),Vu=Da(Mu),Hu=Oa(Mu),Uu=ka(Mu),Wu=Aa(Mu);function Gu(){Qi.localeError||$i(Cc())}function Ku(){Qi.memoizer||$i({memoizer:bc()})}var qu=L(`ZodType`,(e,t)=>(Gu(),Ao.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Zr(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return si(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lf(e,t))},superRefine(e,t){return this.check(uf(e,t))},overwrite(e){return this.check(xl(e))},optional(){return Wd(this)},exactOptional(){return Kd(this)},nullable(){return Jd(this)},nullish(){return Wd(Jd(this))},nonoptional(e){return ef(this,e)},array(){return Md(this)},or(e){return Id([this,e])},and(e){return Rd(this,e)},transform(e){return af(this,Hd(e))},default(e){return Xd(this,e)},prefault(e){return Qd(this,e)},catch(e){return nf(this,e)},pipe(e){return af(this,e)},readonly(){return sf(this)},describe(e){let t=this.clone();return Dc.add(t,{description:e}),t},meta(...e){if(e.length===0)return Dc.get(this);let t=this.clone();return Dc.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Fi(this,`~standard`,{...No(this),jsonSchema:{input:Kl(this,`input`),output:Kl(this,`output`)}})},set"~standard"(e){Pi(this,`~standard`,e)},parse:function e(t,n){return Nu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Pu(this,t,n,{callee:e})},safeParse(e,t){return Fu(this,e,t)},async safeParseAsync(e,t){return Iu(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Pi(this,`spa`,e)},validate(e,t){return ba(this,e,t)},validateAsync(e,t){return Sa(this,e,t)},encode:function e(t,n){return Lu(this,t,n,{callee:e})},decode:function e(t,n){return Ru(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await zu(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Bu(this,t,n,{callee:e})},safeEncode(e,t){return Vu(this,e,t)},safeDecode(e,t){return Hu(this,e,t)},async safeEncodeAsync(e,t){return Uu(this,e,t)},async safeDecodeAsync(e,t){return Wu(this,e,t)},toJSONSchema(e){return Gl(this,{})(e)},get description(){return Dc.get(this)?.description},get _def(){return this._zod.def}}),Ju=L(`_ZodString`,(e,t)=>{Po.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cu(e,t,n,r)},Ii({format:e=>iu(e).format??null,minLength:e=>iu(e).minimum??null,maxLength:e=>iu(e).maximum??null},{regex(...e){return this.check(hl(...e))},includes(...e){return this.check(vl(...e))},startsWith(...e){return this.check(yl(...e))},endsWith(...e){return this.check(bl(...e))},min(...e){return this.check(pl(...e))},max(...e){return this.check(fl(...e))},length(...e){return this.check(ml(...e))},nonempty(...e){return this.check(pl(1,...e))},lowercase(e){return this.check(gl(e))},uppercase(e){return this.check(_l(e))},trim(){return this.check(Cl())},normalize(...e){return this.check(Sl(...e))},toLowerCase(){return this.check(wl())},toUpperCase(){return this.check(Tl())},slugify(){return this.check(El())}})),Yu=L(`ZodString`,(e,t)=>{Po.init(e,t),Ju.init(e,t)},{email(e){return this.check(Ac(nd,e))},url(e){return this.check(Ic(ad,e))},jwt(e){return this.check(Zc(bd,e))},emoji(e){return this.check(Lc(od,e))},guid(e){return this.check(jc(rd,e))},uuid(e){return this.check(Mc(id,e))},uuidv4(e){return this.check(Nc(id,e))},uuidv6(e){return this.check(Pc(id,e))},uuidv7(e){return this.check(Fc(id,e))},nanoid(e){return this.check(Rc(sd,e))},cuid(e){return this.check(zc(cd,e))},cuid2(e){return this.check(Bc(ld,e))},ulid(e){return this.check(Vc(ud,e))},base64(e){return this.check(Jc(_d,e))},base64url(e){return this.check(Yc(vd,e))},xid(e){return this.check(Hc(dd,e))},ksuid(e){return this.check(Uc(fd,e))},ipv4(e){return this.check(Wc(pd,e))},ipv6(e){return this.check(Gc(md,e))},cidrv4(e){return this.check(Kc(hd,e))},cidrv6(e){return this.check(qc(gd,e))},e164(e){return this.check(Xc(yd,e))},datetime(e){return this.check(Qc(Qu,e))},date(e){return this.check($c($u,e))},time(e){return this.check(el(ed,e))},duration(e){return this.check(tl(td,e))}});function Xu(e){return kc(Yu,e)}var Zu=L(`ZodStringFormat`,(e,t)=>{Fo.init(e,t),Ju.init(e,t)}),Qu=L(`ZodISODateTime`,(e,t)=>{es.init(e,t),Zu.init(e,t)}),$u=L(`ZodISODate`,(e,t)=>{ts.init(e,t),Zu.init(e,t)}),ed=L(`ZodISOTime`,(e,t)=>{ns.init(e,t),Zu.init(e,t)}),td=L(`ZodISODuration`,(e,t)=>{rs.init(e,t),Zu.init(e,t)}),nd=L(`ZodEmail`,(e,t)=>{Ro.init(e,t),Zu.init(e,t)}),rd=L(`ZodGUID`,(e,t)=>{Io.init(e,t),Zu.init(e,t)}),id=L(`ZodUUID`,(e,t)=>{Lo.init(e,t),Zu.init(e,t)}),ad=L(`ZodURL`,(e,t)=>{Ko.init(e,t),Zu.init(e,t)}),od=L(`ZodEmoji`,(e,t)=>{qo.init(e,t),Zu.init(e,t)}),sd=L(`ZodNanoID`,(e,t)=>{Jo.init(e,t),Zu.init(e,t)}),cd=L(`ZodCUID`,(e,t)=>{Yo.init(e,t),Zu.init(e,t)}),ld=L(`ZodCUID2`,(e,t)=>{Xo.init(e,t),Zu.init(e,t)}),ud=L(`ZodULID`,(e,t)=>{Zo.init(e,t),Zu.init(e,t)}),dd=L(`ZodXID`,(e,t)=>{Qo.init(e,t),Zu.init(e,t)}),fd=L(`ZodKSUID`,(e,t)=>{$o.init(e,t),Zu.init(e,t)}),pd=L(`ZodIPv4`,(e,t)=>{is.init(e,t),Zu.init(e,t)}),md=L(`ZodIPv6`,(e,t)=>{ss.init(e,t),Zu.init(e,t)}),hd=L(`ZodCIDRv4`,(e,t)=>{cs.init(e,t),Zu.init(e,t)}),gd=L(`ZodCIDRv6`,(e,t)=>{us.init(e,t),Zu.init(e,t)}),_d=L(`ZodBase64`,(e,t)=>{ps.init(e,t),Zu.init(e,t)}),vd=L(`ZodBase64URL`,(e,t)=>{gs.init(e,t),Zu.init(e,t)}),yd=L(`ZodE164`,(e,t)=>{_s.init(e,t),Zu.init(e,t)}),bd=L(`ZodJWT`,(e,t)=>{ys.init(e,t),Zu.init(e,t)}),xd=L(`ZodNumber`,(e,t)=>{bs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lu(e,t,n,r),e.isFinite=!0},Ii({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=iu(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=iu(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=iu(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>iu(e).format??null},{gt(e,t){return this.check(ll(e,t))},gte(e,t){return this.check(ul(e,t))},min(e,t){return this.check(ul(e,t))},lt(e,t){return this.check(sl(e,t))},lte(e,t){return this.check(cl(e,t))},max(e,t){return this.check(cl(e,t))},int(e){return this.check(wd(e))},safe(e){return this.check(wd(e))},positive(e){return this.check(ll(0,e))},nonnegative(e){return this.check(ul(0,e))},negative(e){return this.check(sl(0,e))},nonpositive(e){return this.check(cl(0,e))},multipleOf(e,t){return this.check(dl(e,t))},step(e,t){return this.check(dl(e,t))},finite(){return this}}));function Sd(e){return nl(xd,e)}var Cd=L(`ZodNumberFormat`,(e,t)=>{xs.init(e,t),xd.init(e,t)});function wd(e){return rl(Cd,e)}var Td=L(`ZodBoolean`,(e,t)=>{Ss.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uu(e,t,n,r)});function Ed(e){return il(Td,e)}var Dd=L(`ZodUnknown`,(e,t)=>{Cs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Od(){return al(Dd)}var kd=L(`ZodNever`,(e,t)=>{ws.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>du(e,t,n,r)});function Ad(e){return ol(kd,e)}var jd=L(`ZodArray`,(e,t)=>{Ku(),Os.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hu(e,t,n,r),e.element=t.element},{min(e,t){return this.check(pl(e,t))},nonempty(e){return this.check(pl(1,e))},max(e,t){return this.check(fl(e,t))},length(e,t){return this.check(ml(e,t))},unwrap(){return this.element}});function Md(e,t){return Dl(jd,e,t)}var Nd=L(`ZodObject`,(e,t)=>{Ku(),Ps.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_u(e,t,n,r),Ui(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Bd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Zr(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Zr(this._zod.def,{catchall:Od()}))},loose(){return this.clone(Zr(this._zod.def,{catchall:Od()}))},strict(){return this.clone(Zr(this._zod.def,{catchall:Ad()}))},strip(){return this.clone(Zr(this._zod.def,{catchall:void 0}))},extend(e){return hi(this,e)},safeExtend(e){return _i(this,e)},merge(e){return vi(this,e)},pick(e){return fi(this,e)},omit(e){return mi(this,e)},partial(...e){return yi(Ud,this,e[0])},exactPartial(...e){return yi(Gd,this,e[0],`exactPartial`)},required(...e){return bi($d,this,e[0])}});function Pd(e,t){return new Nd({type:`object`,shape:e,catchall:Ad(),...I(t)})}var Fd=L(`ZodUnion`,(e,t)=>{Is.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vu(e,t,n,r),e.options=t.options});function Id(e,t){return new Fd({type:`union`,options:e,...I(t)})}var Ld=L(`ZodIntersection`,(e,t)=>{Ls.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yu(e,t,n,r)});function Rd(e,t){return new Ld({type:`intersection`,left:e,right:t})}var zd=L(`ZodEnum`,(e,t)=>{Bs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fu(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 zd({...t,checks:[],...I(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 zd({...t,checks:[],...I(r),entries:i})}});function Bd(e,t){return new zd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...I(t)})}var Vd=L(`ZodTransform`,(e,t)=>{Ku(),Vs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Mi(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Mi(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Hd(e){return new Vd({type:`transform`,transform:e})}var Ud=L(`ZodOptional`,(e,t)=>{Us.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wd(e){return new Ud({type:`optional`,innerType:e})}var Gd=L(`ZodExactOptional`,(e,t)=>{Ws.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kd(e){return new Gd({type:`optional`,innerType:e})}var qd=L(`ZodNullable`,(e,t)=>{Gs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jd(e){return new qd({type:`nullable`,innerType:e})}var Yd=L(`ZodDefault`,(e,t)=>{Ks.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Xd(e,t){return new Yd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ii(t)}})}var Zd=L(`ZodPrefault`,(e,t)=>{Js.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qd(e,t){return new Zd({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ii(t)}})}var $d=L(`ZodNonOptional`,(e,t)=>{Ys.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ef(e,t){return new $d({type:`nonoptional`,innerType:e,...I(t)})}var tf=L(`ZodCatch`,(e,t)=>{Qs.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function nf(e,t){return new tf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Gi(t)})}var rf=L(`ZodPipe`,(e,t)=>{$s.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.in=t.in,e.out=t.out});function af(e,t){return new rf({type:`pipe`,in:e,out:t})}var of=L(`ZodReadonly`,(e,t)=>{tc.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sf(e){return new of({type:`readonly`,innerType:e})}var cf=L(`ZodCustom`,(e,t)=>{rc.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pu(e,t,n,r)});function lf(e,t={}){return Ol(cf,e,t)}function uf(e,t){return kl(e,t)}var df=Pd({theme:Xu().refine(e=>Fr.some(t=>t.id===e)).default(Fr[0].id),terminal:Pd({font:Pd({family:Xu().default(`FiraCode Nerd Font`),size:Sd().default(14),lineHeight:Sd().default(1.35),ligatures:Ed().default(!0)}).prefault({}),cursor:Pd({style:Bd([`block`,`bar`,`underline`]).default(`bar`),blink:Ed().default(!0)}).prefault({}),padding:Pd({top:Sd().default(4),right:Sd().default(4),bottom:Sd().default(0),left:Sd().default(4)}).prefault({}),scrollback:Sd().default(1e3),boldIsBright:Ed().default(!0),behavior:Pd({modernizeShiftEnter:Ed().default(!0),pasteBrowserImages:Ed().default(!0),captureShortcuts:Ed().default(!0),bellFlash:Ed().default(!0),bellSound:Ed().default(!0),clickToMoveCursor:Ed().default(!0),optionAsMeta:Bd([`off`,`left`,`right`,`both`]).default(`off`),confirmCloseBusyTab:Ed().default(!0)}).prefault({})}).prefault({}),diff:Pd({split:Ed().default(!1),wrap:Ed().default(!0)}).prefault({})}),ff=`prefs`,pf=df.parse({});function mf(){let e=localStorage.getItem(ff);if(e===null)return structuredClone(pf);let t=df.safeParse(JSON.parse(e));return t.success?t.data:(console.warn(`invalid stored prefs, using the defaults:\n${da(t.error)}`),structuredClone(pf))}function hf(e){localStorage.setItem(ff,JSON.stringify(e))}function gf(){let e=R().prefs.theme,t=Fr.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t}function _f(){let e=z(e=>e.prefs.theme),t=Fr.find(t=>t.id===e);if(t===void 0)throw Error(`unknown theme ${e}`);return t.codeTheme}function vf(){let e=gf(),t=document.documentElement.style;t.setProperty(`--bg`,e.background),t.setProperty(`--text`,e.foreground),t.setProperty(`--blue`,e.palette[4]),t.setProperty(`--danger`,e.palette[1]),t.setProperty(`--green`,e.palette[2]),t.setProperty(`--yellow`,e.palette[3]),document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e.background)}var yf={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`},bf;function xf(e){bf=Jn()(()=>e)}function Sf(e){return bf.subscribe(e)}function R(){return bf.getState()}function z(e){return Xn(bf,e)}function B(e){bf.setState(e)}function Cf(e,t){let n=e.machines.find(e=>e.id===t);if(n===void 0)throw Error(`unknown machine ${t}`);return n}function wf(e,t,n){return e.projects.find(e=>e.machine===t&&e.id===n)}function Tf(e){return e.selection?.machine??e.machines.at(0)?.id??null}function Ef(e,t){B({machines:R().machines.map(n=>n.id===e?{...n,...t}:n)})}function Df(e,t,n){if(n!==null)return e.find(e=>e.id===t)?.activity[n]}function Of(e){let t=e.selection;if(t!==null)return Df(e.machines,t.machine,t.sessionId)}function kf(e){return Of(e)?.running===!0}function Af(e){return Sr(e.machine,e.sessionId??e.projectId)}function jf(e){B({draft:e})}function Mf(e){B({paletteOpen:e})}function Nf(e){B({settingsOpen:e,paletteOpen:!1,...e&&{settingsMachine:Tf(R()),settingsAccount:null,settingsEditedMachine:null}})}function Pf(e){B({settingsOpen:!0,settingsPage:e,settingsAccount:null,settingsEditedMachine:null,paletteOpen:!1,...!R().settingsOpen&&{settingsMachine:Tf(R())}})}function Ff(e){B({prefs:e}),hf(e),vf()}function V(e){B({error:D(e)})}function If(){B({error:null})}function Lf(e){let t=new Map;function n(t,n){R().machines.some(e=>e.id===t)&&e.apply(t,n)}async function r(r,a){let o=await e.save(r,a),s=t.get(r);s!==void 0&&(--s.writes,!(s.writes>0)&&(o===null?await i(r):n(r,o)))}async function i(r){let i=t.get(r)?.version;try{let a=await e.load(r),o=t.get(r);o!==void 0&&o.writes===0&&o.version===i&&n(r,a)}catch(e){V(e)}}return{update(n,i){e.set(n,i);let a=t.get(n)??{writes:0,version:0,timer:void 0};t.set(n,a),a.timer===void 0&&(a.writes+=1),a.version+=1,window.clearTimeout(a.timer),a.timer=window.setTimeout(()=>{a.timer=void 0,r(n,i)},300)},receive(e,r){(t.get(e)?.writes??0)===0&&n(e,r)}}}var Rf=Lf({set:(e,t)=>Ef(e,{config:t}),save:async(e,t)=>{try{let n=await F(e,`config.save`,t);return Ef(e,{configError:null}),n}catch(t){return Ef(e,{configError:D(t)}),null}},load:async e=>(await F(e,`config.get`,void 0)).config,apply:(e,t)=>Ef(e,{config:t})}),zf=Lf({set:(e,t)=>Ef(e,{composer:t}),save:async(e,t)=>{try{return await F(e,`composer.save`,t)}catch(e){return V(e),null}},load:e=>F(e,`composer.get`,void 0),apply:Wf}),Bf=Rf.update,Vf=Rf.receive,Hf=zf.update,Uf=zf.receive;function Wf(e,t){Ef(e,{composer:t});let n=R().selection;if(n===null||n.machine!==e||Df(R().machines,e,n.sessionId)!==void 0)return;let r=(n.sessionId===null?null:fr(Af(n)))??Kf(t,n.sessionId===null?t.provider:R().settings.provider),i=r.provider!==R().settings.provider||r.accountId!==R().settings.accountId;B({settings:r}),i&&Xf()}var Gf={provider:`claude`,accountId:null,model:null,effort:null,mode:null,plan:!1};function Kf(e,t){return e===null?{...Gf,provider:t}:{provider:t,...e[t]}}function qf(e){let t={...R().settings,...e};B({settings:t});let n=R().selection;if(n===null)return;n.sessionId!==null&&pr(Af(n),t);let r=Cf(R(),n.machine).composer;r!==null&&Hf(n.machine,{...r,provider:t.provider,[t.provider]:{accountId:t.accountId,model:t.model,effort:t.effort,mode:t.mode,plan:t.plan}}),e.accountId!==void 0&&Xf(),n.sessionId!==null&&Df(R().machines,n.machine,n.sessionId)!==void 0&&e.accountId===void 0&&F(n.machine,`sessions.configure`,{sessionId:n.sessionId,settings:t}).catch(V)}function Jf(e,t){if(Ef(e,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),R().selection?.machine!==e)return;let n=R().settings,r=[...[...t.claudeAccounts,...t.codexAccounts].filter(e=>e.valid).map(e=>({provider:e.provider,accountId:e.id})),...t.openCode.available?[{provider:`opencode`,accountId:null}]:[]];if(r.some(e=>e.provider===n.provider&&e.accountId===n.accountId))return;let i=r.find(e=>e.provider===n.provider),a=R().selection?.sessionId===null?r.at(0):void 0;i===void 0?a===void 0?n.accountId!==null&&qf({accountId:null}):qf({...Kf(Cf(R(),e).composer,a.provider),accountId:a.accountId}):qf({accountId:i.accountId})}async function Yf(e){try{Jf(e,await F(e,`accounts.list`,void 0))}catch(e){V(e)}}async function Xf(){let e=R().selection;if(e===null)return;let{provider:t,accountId:n}=R().settings;if(t!==`opencode`&&n===null)B({capabilities:null});else try{let r=await F(e.machine,`capabilities`,{provider:t,accountId:n,projectId:e.projectId});if(R().selection?.machine!==e.machine||R().selection?.projectId!==e.projectId||R().settings.provider!==t||R().settings.accountId!==n)return;B({capabilities:r});let i=R().settings;if(i.model!==null){let e=r.models.find(e=>e.value===i.model)?.effort;i.provider!==`opencode`&&i.effort===null&&e!=null&&qf({effort:e});return}let a=r.models.find(e=>!e.hidden&&e.value===r.defaultModel)??r.models.find(e=>!e.hidden);if(a===void 0)return;qf({model:a.value,...a.effort===null?{}:{effort:a.effort}})}catch(e){V(e)}}var Zf={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`};function Qf(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function $f(e){let t=Math.round((Date.now()-e)/1e3);return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function ep(e){let t=new Date(e),n=t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`}),r=new Date,i=Math.round((new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime()-new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime())/864e5);return i<=0?n:i===1?`yesterday at ${n}`:`${t.toLocaleDateString(void 0,t.getFullYear()===r.getFullYear()?{month:`numeric`,day:`numeric`}:{month:`numeric`,day:`numeric`,year:`numeric`})} ${n}`}function tp(e){let t=new Date(e),n=t.getDate(),r=n%100>=11&&n%100<=13?`th`:n%10==1?`st`:n%10==2?`nd`:n%10==3?`rd`:`th`;return`${t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`})}, ${n}${r} ${t.toLocaleDateString(`en-US`,{month:`long`})} ${t.getFullYear()}`}function np(e){return new Intl.NumberFormat(void 0,{notation:`compact`}).format(e)}function rp(e){let t=Math.round(e),n=Math.floor(t/60),r=String(t%60).padStart(2,`0`);return n<60?`${n}:${r}`:`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}:${r}`}var ip=`notifications`,ap=Promise.resolve(),op=new Set;function sp(){return window.isSecureContext?!(`Notification`in window)||!(`serviceWorker`in navigator)?`unsupported`:Notification.permission:`insecure`}function cp(){let e=localStorage.getItem(ip);if(e===null||e===`on`)return!0;if(e===`off`)return!1;throw Error(`unknown notification setting ${e}`)}async function lp(e){e&&Notification.permission==="default"&&await Notification.requestPermission(),localStorage.setItem(ip,e?`on`:`off`)}async function up(e,t){(await navigator.permissions.query({name:`notifications`})).addEventListener(`change`,t,{signal:e})}function dp(e,t,n){if(document.hidden)for(let r of t){let t=pp(e,r);mp(e,r,`${t===void 0?`Agent`:Zf[t.provider]} ${n}`,t?.title??`Session`,Sr(e,r)).catch(e=>console.error(`could not show a notification`,e))}}function fp(e,t,n){mp(e,t,pp(e,t)?.title??`Session`,n,`push:${Sr(e,t)}`).catch(e=>console.error(`could not show a notification`,e))}function pp(e,t){return R().sessions.find(n=>n.machine===e&&n.id===t)}async function mp(e,t,n,r,i){if(sp()!==`granted`||!cp()||!Cf(R(),e).notifier)return;let a=pp(e,t);await(await navigator.serviceWorker.ready).showNotification(n,{body:r,tag:i,data:a===void 0?null:{kind:`session`,machine:e,project:a.projectId,sessionId:t}})}async function hp(e,t,n){sp()===`granted`&&cp()&&Cf(R(),n.machine).notifier&&await(await navigator.serviceWorker.ready).showNotification(e,{body:t,data:{kind:`terminal`,...n}})}function gp(){let e=R().machines.filter(e=>Xt(e.id)&&!e.notifier&&!op.has(e.id)).map(e=>e.id);if(e.length!==0){for(let t of e)op.add(t);_p().then(t=>Promise.all(e.map(e=>F(e,`notifications.claim`,{endpoint:t})))).catch(e=>console.error(`could not claim notifications`,e)).finally(()=>{for(let t of e)op.delete(t)})}}async function _p(){if(vp()!==`supported`)return null;let e=await navigator.serviceWorker.getRegistration();if(e===void 0)return null;let t=await e.pushManager.getSubscription();return t===null?null:t.endpoint}function vp(){return window.isSecureContext?!(`Notification`in window)||!(`serviceWorker`in navigator)||!(`PushManager`in window)?yp()?`install`:`unsupported`:Notification.permission===`denied`?`denied`:`supported`:`insecure`}function yp(){return/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.userAgent.includes(`Mac`)&&navigator.maxTouchPoints>1}async function bp(){return await(await navigator.serviceWorker.ready).pushManager.getSubscription()!==null}async function xp(){return Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission===`granted`&&(await wp(Tp),!0)}function Sp(){return wp(Ep)}function Cp(e){return wp(async()=>{if(vp()!==`supported`)return;let t=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!t)return;let n=await Dp(),r=t.options.applicationServerKey;r!==null&&kp(r)===n.publicKey?await Ap(e,t,n):await Tp()})}function wp(e){let t=ap.then(e);return ap=t.catch(()=>void 0),t}async function Tp(){await Ep();let e=await Dp(),t=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e.publicKey});await Promise.all(Op().map(n=>Ap(n,t,e)))}async function Ep(){let e=await(await navigator.serviceWorker.ready).pushManager.getSubscription();e&&(await Promise.all(Op().map(t=>F(t,`push.unsubscribe`,{endpoint:e.endpoint}))),await e.unsubscribe())}async function Dp(){let e=await caches.open(`offsite-worker`),t=await e.match(`/push-keys`);if(t!==void 0)return await t.json();let n=await crypto.subtle.generateKey({name:`ECDSA`,namedCurve:`P-256`},!0,[`sign`,`verify`]),r=(await crypto.subtle.exportKey(`jwk`,n.privateKey)).d;if(r===void 0)throw Error(`the browser did not export the push key`);let i={publicKey:kp(await crypto.subtle.exportKey(`raw`,n.publicKey)),privateKey:r};return await e.put(`/push-keys`,new Response(JSON.stringify(i))),i}function Op(){return R().machines.filter(e=>Xt(e.id)).map(e=>e.id)}function kp(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}async function Ap(e,t,n){await F(e,`push.subscribe`,{subscription:t.toJSON(),...n,machine:e})}function jp(){let e=_r(),t=mr(e.map(e=>e.id));xf({machines:e.map(Cr),sessions:[],projects:e.flatMap(wr),prefs:mf(),paletteOpen:!1,settingsOpen:!1,settingsPage:`General`,settingsAccount:null,settingsEditedMachine:null,settingsMachine:e.at(0)?.id??null,unseen:[],selection:t,loaded:t?.sessionId===null,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],settings:(t===null||t.sessionId===null?null:fr(Af(t)))??Gf,draft:null,context:null,capabilities:null,error:null,sentAt:0}),vf(),Yt({open:(e,t)=>{Ef(e,{via:t}),Np(e)},close:e=>{let t=R().machines.find(t=>t.id===e);t!==void 0&&t.status!==`offline`&&Ef(e,{status:`offline`,via:null,notifier:!1})},unpaired:e=>Ef(e,{status:`unpaired`,via:null,notifier:!1}),event:Lp}),addEventListener(`keydown`,gp,{capture:!0}),addEventListener(`pointerdown`,gp,{capture:!0}),addEventListener(`storage`,e=>{e.key===`machines`&&Tr()});for(let t of e)qt(t.id,t.addresses);Ar(e),Mp()}async function Mp(){try{let e=br();e!==null&&await Er(e.address,e.code)}catch(e){V(e)}}async function Np(e){try{let t=await F(e,`sync`,void 0),n=R().machines.find(t=>t.id===e);if(n===void 0)return;Ef(e,{status:`online`,name:n.label??t.hostname,hostname:t.hostname,system:{defaults:t.defaults,platform:t.platform,defaultShell:t.defaultShell,defaultClaudeBaseDir:t.defaultClaudeBaseDir},activity:t.activity,providers:t.providers}),Pp(e,t.projects),Fp(e,t.sessions),Vf(e,t.config),Uf(e,t.composer),Ip(e),Yf(e),R().selection?.machine===e&&Xf()}catch(e){V(e)}}function Pp(e,t){B({projects:[...R().projects.filter(t=>t.machine!==e),...t.map(t=>({...t,machine:e}))]}),Pr()}function Fp(e,t){B({sessions:[...R().sessions.filter(t=>t.machine!==e),...t.map(t=>({...t,machine:e}))]})}function Ip(e){let t=R().selection;t?.machine===e&&t.sessionId!==null&&F(e,`sessions.open`,{projectId:t.projectId,sessionId:t.sessionId}).catch(V)}function Lp(e,t){let n=R(),r=n.machines.find(t=>t.id===e);if(r===void 0)return;let i=n.selection?.machine===e,a=i?n.selection?.sessionId??null:null;switch(t.type){case`activity`:{let o=r.activity,s=a!==null&&t.activity[a]?.running===!0,c=Object.keys(o).filter(e=>o[e].running&&t.activity[e]?.running!==!0),l=Object.keys(t.activity).filter(e=>t.activity[e].waiting&&o[e]?.waiting!==!0);dp(e,c.filter(e=>o[e].prompted),`finished`),dp(e,l,`needs your input`),Ef(e,{activity:t.activity}),B({partial:s||!i?n.partial:``,unseen:[...n.unseen,...c.filter(e=>e!==a).map(t=>Sr(e,t)).filter(e=>!n.unseen.includes(e))]});return}case`limits`:Ef(e,{claudeAccounts:r.claudeAccounts.map(e=>e.id===t.accountId?{...e,limits:t.limits}:e),codexAccounts:r.codexAccounts.map(e=>e.id===t.accountId?{...e,limits:t.limits}:e)});return;case`config`:Vf(e,t.config);return;case`composer`:Uf(e,t.composer);return;case`projects`:Pp(e,t.projects);return;case`sessions`:Fp(e,t.sessions);return;case`accounts`:Jf(e,t);return;case`providers`:Ef(e,{providers:t.providers});return;case`started`:if(n.selection===null||!i||n.selection.projectId!==t.projectId||n.selection.sessionId!==null)return;B({selection:{machine:e,projectId:t.projectId,sessionId:t.sessionId},loaded:!0,items:[],earlier:[],before:null,partial:``,requests:[],queue:[]}),hr();return;case`notification`:fp(e,t.sessionId,t.message);return;case`notifier`:Ef(e,{notifier:t.active});return}if(a!==null&&t.sessionId===a)switch(t.type){case`history`:B({loaded:!0,items:t.items,earlier:[],before:t.before,requests:t.requests,queue:t.queue,settings:t.settings??(n.settings.provider===t.provider?n.settings:Kf(Cf(n,e).composer,t.provider)),context:t.context,partial:t.partial}),t.settings!==null&&pr(Sr(e,t.sessionId),t.settings);return;case`context`:B({context:t.context});return;case`items`:{let e=new Map(t.items.map(e=>[e.id,e]));B({items:[...n.items.map(t=>e.get(t.id)??t),...t.items.filter(e=>!n.items.some(t=>t.id===e.id))],partial:t.items.some(e=>e.kind===`assistant`&&e.parent===null)?``:n.partial});return}case`delta`:B({partial:n.partial+t.text});return;case`request`:B({requests:[...n.requests,t.request]});return;case`requestDone`:B({requests:n.requests.filter(e=>e.id!==t.requestId)});return;case`queue`:B({queue:t.queue});return;case`settings`:{let r={...t.settings,accountId:n.settings.accountId};B({settings:r}),pr(Sr(e,t.sessionId),r)}}}var H=i(),Rp=Object.defineProperty,zp=(e,t)=>Rp(e,`name`,{value:t,configurable:!0});function Bp(e){let t=e+`CollectionProvider`,[n,r]=h(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=zp(e=>{let{scope:t,children:n}=e,r=P.useRef(null),a=P.useRef(new Map).current;return(0,H.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=k(s),l=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(s,n),o=O(t,i.collectionRef);return(0,H.jsx)(c,{ref:o,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=k(u),p=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),s=O(t,o),c=a(u,n);return P.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,H.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return P.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return zp(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}zp(Bp,`createCollection`);var Vp=new WeakMap,Hp=class e extends Map{static{zp(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],Vp.set(this,!0)}set(e,t){return Vp.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=Gp(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=Up(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Up(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Up(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function Up(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=Wp(e,t);return n===-1?void 0:e[n]}zp(Up,`at`);function Wp(e,t){let n=e.length,r=Gp(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}zp(Wp,`toSafeIndex`);function Gp(e){return e!==e||e===0?0:Math.trunc(e)}zp(Gp,`toSafeInteger`);function Kp(e){let t=e+`CollectionProvider`,[n,r]=h(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,s]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let c=zp(({state:e,...t})=>e?(0,H.jsx)(u,{...t,state:e}):(0,H.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=zp(e=>{let t=y();return(0,H.jsx)(u,{...e,state:t})},`CollectionInit`);l.displayName=e+`CollectionInit`;let u=zp(e=>{let{scope:t,children:n,state:r}=e,a=P.useRef(null),[s,c]=P.useState(null),l=O(a,c),[u,d]=r,f=P.useRef(new Hp),p=P.useCallback(()=>{let e=f.current;return Yp(e)||e.sort(Xp),e},[]);return P.useEffect(()=>{if(!s)return;let e=Zp(()=>{d(e=>{let t=e.toSorted(Xp);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s,d]),(0,H.jsx)(i,{scope:t,collectionElementRef:l,collectionElementRefObject:a,getCollection:p,setCollection:d,registryRef:f,children:(0,H.jsx)(o,{scope:t,collectionElement:s,collection:u,children:n})})},`CollectionProviderImpl`);u.displayName=e+`CollectionProviderImpl`;let d=e+`CollectionSlot`,f=k(d),p=P.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(d,n),o=O(t,i.collectionElementRef);return(0,H.jsx)(f,{ref:o,children:r})});p.displayName=d;let m=e+`CollectionItemSlot`,_=k(m),v=P.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=P.useRef(null),{setCollection:s,registryRef:c}=a(m,n),l=P.useRef(i);qp(l.current,i)||(l.current=i);let u=l.current,d=P.useCallback(e=>{let t=c.current;e?t.set(e,{...l.current,element:e}):o.current&&t.delete(o.current)},[c]),f=O(t,d,o);g(()=>{let e=o.current,t=c.current;e&&t.has(e)&&t.set(e,{...u,element:e})},[u,c]);let p=P.useRef(null);return P.useEffect(()=>{let e=o.current,t=p.current;((t?.element??null)!==e||e&&t?.itemData!==u)&&(p.current=e?{element:e,itemData:u}:null,s(n=>{let r=new Hp(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...u,element:e}),r.sort(Xp)}))}),P.useEffect(()=>()=>{let e=p.current;p.current=null,e&&s(t=>{if(!t.has(e.element))return t;let n=new Hp(t);return n.delete(e.element),n})},[s]),(0,H.jsx)(_,{"data-radix-collection-item":``,ref:f,children:r})});v.displayName=m;function y(){return P.useState(new Hp)}zp(y,`useInitCollection`);function b(t){let{collection:n}=s(e+`CollectionConsumer`,t);return n}zp(b,`useCollection`);function x(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return zp(x,`useGetCollection`),[{Provider:c,Slot:p,ItemSlot:v},{createCollectionScope:r,useCollection:b,useGetCollection:x,useInitCollection:y}]}zp(Kp,`createCollection`);function qp(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}zp(qp,`shallowEqual`);function Jp(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}zp(Jp,`isElementPreceding`);function Yp(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}zp(Yp,`isInDocumentOrder`);function Xp(e,t){return!e[1].element||!t[1].element?0:Jp(e[1].element,t[1].element)?-1:1}zp(Xp,`sortByDocumentPosition`);function Zp(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}zp(Zp,`getChildListObserver`);var Qp=Object.defineProperty,$p=(e,t)=>Qp(e,`name`,{value:t,configurable:!0}),em={LTR:`ltr`,RTL:`rtl`},tm=P.createContext(void 0);function nm(e){let t=P.useContext(tm);return e||t||em.LTR}$p(nm,`useDirection`);var rm=Object.defineProperty,im=(e,t)=>rm(e,`name`,{value:t,configurable:!0}),[am,om]=h(`AlertDialog`,[se]),sm=se(),cm=im(e=>{let{__scopeAlertDialog:t,...n}=e,r=sm(t);return(0,H.jsx)(ve,{...r,...n,modal:!0})},`AlertDialog`),lm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(Oe,{...i,...r,ref:t})},`AlertDialogTrigger`)),um=im(e=>{let{__scopeAlertDialog:t,...n}=e,r=sm(t);return(0,H.jsx)(ke,{...r,...n})},`AlertDialogPortal`),dm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(Ee,{...i,...r,ref:t})},`AlertDialogOverlay`)),[fm,pm]=am(`AlertDialogContent`),mm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=sm(n),o=P.useRef(null),s=O(t,o),c=P.useRef(null);return(0,H.jsx)(fm,{scope:n,cancelRef:c,children:(0,H.jsx)(he,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:v(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),hm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(de,{...i,...r,ref:t})},`AlertDialogTitle`)),gm=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(le,{...i,...r,ref:t})},`AlertDialogDescription`)),_m=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=sm(n);return(0,H.jsx)(ge,{...i,...r,ref:t})},`AlertDialogAction`)),vm=`AlertDialogCancel`,ym=P.forwardRef(im(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=pm(vm,n),a=sm(n),o=O(t,i);return(0,H.jsx)(ge,{...a,...r,ref:o})},`AlertDialogCancel`)),bm=Object.defineProperty,xm=(e,t)=>bm(e,`name`,{value:t,configurable:!0}),Sm=!1;function Cm(){let[e,t]=P.useState(Sm);return P.useEffect(()=>{Sm||(Sm=!0,t(!0))},[]),e}xm(Cm,`useIsHydrated`);var wm=P.useSyncExternalStore;function Tm(){return()=>{}}xm(Tm,`subscribe`);function Em(){return wm(Tm,()=>!0,()=>!1)}xm(Em,`useIsHydratedModern`);var Dm=typeof wm==`function`?Em:Cm,Om=Object.defineProperty,km=(e,t)=>Om(e,`name`,{value:t,configurable:!0}),Am=`rovingFocusGroup.onEntryFocus`,jm={bubbles:!1,cancelable:!0},Mm=`RovingFocusGroup`,[Nm,Pm,Fm]=Bp(Mm),[Im,Lm]=h(Mm,[Fm]),Rm={Vertical:`vertical`,Horizontal:`horizontal`},zm={LTR:`ltr`,RTL:`rtl`},[Bm,Vm]=Im(Mm),Hm=P.forwardRef(km(function(e,t){return(0,H.jsx)(Nm.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(Nm.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(Um,{...e,ref:t})})})},`RovingFocusGroup`)),Um=P.forwardRef(km(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...f}=e,p=P.useRef(null),m=O(t,p),h=nm(a),[g,_]=x({prop:o,defaultProp:s??null,onChange:c,caller:Mm}),[y,b]=P.useState(!1),S=T(l),C=Pm(n),w=P.useRef(!1),[E,D]=P.useState(0);return P.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(Am,S),()=>e.removeEventListener(Am,S)},[S]),(0,H.jsx)(Bm,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:P.useCallback(e=>_(e),[_]),onItemShiftTab:P.useCallback(()=>b(!0),[]),onFocusableItemAdd:P.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:P.useCallback(()=>D(e=>e-1),[]),children:(0,H.jsx)(u.div,{tabIndex:y||E===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:`none`,...e.style},onMouseDown:v(e.onMouseDown,()=>{w.current=!0}),onFocus:v(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(Am,jm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=C().filter(e=>e.focusable);Ym([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),d)}}w.current=!1}),onBlur:v(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Wm=`RovingFocusGroupItem`,Gm=P.forwardRef(km(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=p(),l=a||c,d=Vm(Wm,n),f=d.currentTabStopId===l,m=Pm(n),{onFocusableItemAdd:h,onFocusableItemRemove:_,currentTabStopId:y}=d,b=Dm();return g(()=>{if(b&&r)return h(),()=>_()},[b,r,h,_]),P.useEffect(()=>{if(!b&&r)return h(),()=>_()},[b,r,h,_]),(0,H.jsx)(Nm.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(u.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:v(e.onMouseDown,e=>{r?d.onItemFocus(l):e.preventDefault()}),onFocus:v(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:v(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Jm(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?Xm(n,r+1):n.slice(r+1)}setTimeout(()=>Ym(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:y!=null}):o})})},`RovingFocusGroupItem`)),Km={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function qm(e,t){return t===zm.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}km(qm,`getDirectionAwareKey`);function Jm(e,t,n){let r=qm(e.key,n);if(!(t===Rm.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Rm.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return Km[r]}km(Jm,`getFocusIntent`);function Ym(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}km(Ym,`focusFirst`);function Xm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}km(Xm,`wrapArray`);var Zm=Object.defineProperty,Qm=(e,t)=>Zm(e,`name`,{value:t,configurable:!0}),$m={LTR:`ltr`,RTL:`rtl`},eh=[`Enter`,` `],th=[`ArrowDown`,`PageUp`,`Home`],nh=[`ArrowUp`,`PageDown`,`End`],rh=[...th,...nh],ih={ltr:[...eh,`ArrowRight`],rtl:[...eh,`ArrowLeft`]},ah={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},oh=`Menu`,[sh,ch,lh]=Bp(oh),[uh,dh]=h(oh,[lh,ae,Lm]),fh=ae(),ph=Lm(),[mh,hh]=uh(oh),[gh,_h]=uh(oh),vh=Qm(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=fh(t),[c,l]=P.useState(null),u=P.useRef(!1),d=T(a),f=nm(i);return P.useEffect(()=>{let e=Qm(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Qm(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),P.useEffect(()=>{if(!n)return;let e=Qm(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,H.jsx)(j,{...s,children:(0,H.jsx)(mh,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,H.jsx)(gh,{scope:t,onClose:P.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),yh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e,i=fh(n);return(0,H.jsx)(A,{...i,...r,ref:t})},`MenuAnchor`)),bh=`MenuPortal`,[xh,Sh]=uh(bh,{forceMount:void 0}),Ch=Qm(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=hh(bh,t);return(0,H.jsx)(xh,{scope:t,forceMount:n,children:(0,H.jsx)(m,{present:n||a.open,children:(0,H.jsx)(S,{asChild:!0,container:i,children:r})})})},`MenuPortal`),wh=`MenuContent`,[Th,Eh]=uh(wh),Dh=P.forwardRef(Qm(function(e,t){let n=Sh(wh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=hh(wh,e.__scopeMenu),o=_h(wh,e.__scopeMenu);return(0,H.jsx)(sh.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(m,{present:r||a.open,children:(0,H.jsx)(sh.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(Oh,{...i,ref:t}):(0,H.jsx)(kh,{...i,ref:t})})})})},`MenuContent`)),Oh=P.forwardRef(Qm(function(e,t){let n=hh(wh,e.__scopeMenu),r=P.useRef(null),i=O(t,r);return P.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,H.jsx)(jh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:v(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),kh=P.forwardRef(Qm(function(e,t){let n=hh(wh,e.__scopeMenu);return(0,H.jsx)(jh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Ah=k(`MenuContent.ScrollLock`),jh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,...y}=e,x=hh(wh,n),S=_h(wh,n),w=fh(n),T=ph(n),E=ch(n),[D,k]=P.useState(null),A=P.useRef(null),[ee,j]=P.useState(null);b(ee);let{nodes:te,registry:ne}=C(),ie=!!(i||g),ae=O(t,A,x.onContentChange,j),M=P.useRef(0),oe=P.useRef(``),se=P.useRef(0),le=P.useRef(null),ue=P.useRef(`right`),de=P.useRef(0),fe=P.useMemo(()=>g?[A,...te.map(e=>({current:e}))]:[],[A,te,g]),pe=g?De:P.Fragment,me=g?{as:Ah,allowPinchZoom:!0,shards:fe}:void 0,he=Qm(e=>{let t=oe.current+e,n=E().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=cg(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){oe.current=e,window.clearTimeout(M.current),e!==``&&(M.current=window.setTimeout(()=>s(``),1e3))}Qm(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);P.useEffect(()=>()=>window.clearTimeout(M.current),[]),ce();let ge=P.useCallback(e=>ue.current===le.current?.side&&ug(e,le.current?.area),[]);return(0,H.jsx)(Th,{scope:n,searchRef:oe,onItemEnter:P.useCallback(e=>{ge(e)&&e.preventDefault()},[ge]),onItemLeave:P.useCallback(e=>{ge(e)||(A.current?.focus(),k(null))},[ge]),onTriggerLeave:P.useCallback(e=>{ge(e)&&e.preventDefault()},[ge]),pointerGraceTimerRef:se,onPointerGraceIntentChange:P.useCallback(e=>{le.current=e},[]),children:(0,H.jsx)(d,{registry:ie?ne:null,children:(0,H.jsx)(pe,{...me,children:(0,H.jsx)(_,{asChild:!0,trapped:i,branches:te,onMountAutoFocus:v(a,e=>{e.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(f,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,H.jsx)(Hm,{asChild:!0,...T,dir:S.dir,orientation:`vertical`,loop:r,currentTabStopId:D,onCurrentTabStopIdChange:k,onEntryFocus:v(c,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(re,{role:`menu`,"aria-orientation":`vertical`,"data-state":rg(x.open),"data-radix-menu-content":``,dir:S.dir,...w,...y,ref:ae,style:{outline:`none`,...y.style},onKeyDown:v(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&he(e.key));let i=A.current;if(e.target!==i||!rh.includes(e.key))return;e.preventDefault();let a=E().filter(e=>!e.disabled).map(e=>e.ref.current);nh.includes(e.key)&&a.reverse(),og(a)}),onBlur:v(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(M.current),oe.current=``)}),onPointerMove:v(e.onPointerMove,dg(e=>{let t=e.target,n=de.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>de.current?`right`:`left`;ue.current=t,de.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Mh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(u.div,{role:`group`,...r,ref:t})},`MenuGroup`)),Nh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(u.div,{...r,ref:t})},`MenuLabel`)),Ph=`MenuItem`,Fh=`menu.itemSelect`,Ih=P.forwardRef(Qm(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=P.useRef(null),o=_h(Ph,e.__scopeMenu),s=Eh(Ph,e.__scopeMenu),c=O(t,a),l=P.useRef(!1),u=Qm(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Fh,{bubbles:!0,cancelable:!0});e.addEventListener(Fh,e=>r?.(e),{once:!0}),E(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,H.jsx)(Lh,{...i,ref:c,disabled:n,onClick:v(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:v(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:v(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&eh.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Lh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Eh(Ph,n),s=ph(n),c=P.useRef(null),l=O(t,c),[d,f]=P.useState(!1),[p,m]=P.useState(``);return P.useEffect(()=>{let e=c.current;e&&m((e.textContent??``).trim())},[a.children]),(0,H.jsx)(sh.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,H.jsx)(Gm,{asChild:!0,...s,focusable:!r,children:(0,H.jsx)(u.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:v(e.onPointerMove,dg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:v(e.onPointerLeave,dg(e=>o.onItemLeave(e))),onFocus:v(e.onFocus,()=>f(!0)),onBlur:v(e.onBlur,()=>f(!1))})})})},`MenuItemImpl`)),Rh=P.forwardRef(Qm(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(Gh,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(Ih,{role:`menuitemcheckbox`,"aria-checked":ig(n)?`mixed`:n,...i,ref:t,"data-state":ag(n),onSelect:v(i.onSelect,()=>r?.(ig(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[zh,Bh]=uh(`MenuRadioGroup`,{value:void 0,onValueChange:Qm(()=>{},`onValueChange`)}),Vh=P.forwardRef(Qm(function(e,t){let{value:n,onValueChange:r,...i}=e,a=T(r);return(0,H.jsx)(zh,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,H.jsx)(Mh,{...i,ref:t})})},`MenuRadioGroup`)),Hh=`MenuRadioItem`,Uh=P.forwardRef(Qm(function(e,t){let{value:n,...r}=e,i=Bh(Hh,e.__scopeMenu),a=n===i.value;return(0,H.jsx)(Gh,{scope:e.__scopeMenu,checked:a,children:(0,H.jsx)(Ih,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ag(a),onSelect:v(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),Wh=`MenuItemIndicator`,[Gh,Kh]=uh(Wh,{checked:!1}),qh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=Kh(Wh,n);return(0,H.jsx)(m,{present:r||ig(a.checked)||a.checked===!0,children:(0,H.jsx)(u.span,{...i,ref:t,"data-state":ag(a.checked)})})},`MenuItemIndicator`)),Jh=P.forwardRef(Qm(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(u.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),Yh=`MenuSub`,[Xh,Zh]=uh(Yh),Qh=Qm(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=hh(Yh,t),o=fh(t),[s,c]=P.useState(null),[l,u]=P.useState(null),d=T(i);return P.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,H.jsx)(j,{...o,children:(0,H.jsx)(mh,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,H.jsx)(Xh,{scope:t,contentId:p(),triggerId:p(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),$h=`MenuSubTrigger`,eg=P.forwardRef(Qm(function(e,t){let n=hh($h,e.__scopeMenu),r=_h($h,e.__scopeMenu),i=Zh($h,e.__scopeMenu),a=Eh($h,e.__scopeMenu),o=P.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=P.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);P.useEffect(()=>u,[u]),P.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=O(t,i.onTriggerChange);return(0,H.jsx)(yh,{asChild:!0,...l,children:(0,H.jsx)(Lh,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":rg(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:v(e.onPointerMove,dg(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:v(e.onPointerLeave,dg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:v(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(a.searchRef.current===``||t.key!==` `)&&ih[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),tg=`MenuSubContent`,ng=P.forwardRef(Qm(function(e,t){let n=Sh(wh,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=hh(wh,e.__scopeMenu),s=_h(wh,e.__scopeMenu),c=Zh(tg,e.__scopeMenu),l=P.useRef(null),u=O(t,l);return(0,H.jsx)(sh.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(m,{present:r||o.open,children:(0,H.jsx)(sh.Slot,{scope:e.__scopeMenu,children:(0,H.jsx)(jh,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===$m.RTL?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:v(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:v(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:v(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ah[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function rg(e){return e?`open`:`closed`}Qm(rg,`getOpenState`);function ig(e){return e===`indeterminate`}Qm(ig,`isIndeterminate`);function ag(e){return ig(e)?`indeterminate`:e?`checked`:`unchecked`}Qm(ag,`getCheckedState`);function og(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Qm(og,`focusFirst`);function sg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Qm(sg,`wrapArray`);function cg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=sg(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Qm(cg,`getNextMatch`);function lg(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Qm(lg,`isPointInPolygon`);function ug(e,t){return t?lg({x:e.clientX,y:e.clientY},t):!1}Qm(ug,`isPointerInGraceArea`);function dg(e){return t=>t.pointerType===`mouse`?e(t):void 0}Qm(dg,`whenMouse`);var fg=Object.defineProperty,pg=(e,t)=>fg(e,`name`,{value:t,configurable:!0}),mg=`ContextMenu`,[hg,eee]=h(mg,[dh]),gg=dh(),[_g,vg]=hg(mg),yg=pg(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=P.useRef(!1),[c,l]=x({prop:i,defaultProp:!1,onChange:r,caller:mg}),u=gg(t);return(0,H.jsx)(_g,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,H.jsx)(vh,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),bg=`ContextMenuTrigger`,xg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=vg(bg,n),o=gg(n),[s,c]=P.useState({x:0,y:0}),l=P.useMemo(()=>({current:{getBoundingClientRect:pg(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),d=P.useRef(0),f=P.useCallback(()=>window.clearTimeout(d.current),[]),p=pg(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return P.useEffect(()=>f,[f]),P.useEffect(()=>void(r&&f()),[r,f]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(yh,{...o,virtualRef:l}),(0,H.jsx)(u.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:v(e.onContextMenu,e=>{f(),p(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:v(e.onPointerDown,Og(e=>{f(),a.open&&a.onOpenChange(!1),d.current=window.setTimeout(()=>p(e),700)})),onPointerMove:r?e.onPointerMove:v(e.onPointerMove,Og(f)),onPointerCancel:r?e.onPointerCancel:v(e.onPointerCancel,Og(f)),onPointerUp:r?e.onPointerUp:v(e.onPointerUp,Og(f))})]})},`ContextMenuTrigger`)),Sg=pg(e=>{let{__scopeContextMenu:t,...n}=e,r=gg(t);return(0,H.jsx)(Ch,{...r,...n})},`ContextMenuPortal`),Cg=`ContextMenuContent`,wg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=vg(Cg,n),a=gg(n),o=P.useRef(!1);return(0,H.jsx)(Dh,{...a,side:`right`,sideOffset:2,align:`start`,...r,ref:t,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),Tg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=gg(n);return(0,H.jsx)(Ih,{...i,...r,ref:t})},`ContextMenuItem`)),Eg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=gg(n);return(0,H.jsx)(Rh,{...i,...r,ref:t})},`ContextMenuCheckboxItem`)),Dg=P.forwardRef(pg(function(e,t){let{__scopeContextMenu:n,...r}=e,i=gg(n);return(0,H.jsx)(qh,{...i,...r,ref:t})},`ContextMenuItemIndicator`));function Og(e){return t=>t.pointerType===`mouse`?void 0:e(t)}pg(Og,`whenTouchOrPen`);var kg=Object.defineProperty,Ag=(e,t)=>kg(e,`name`,{value:t,configurable:!0}),jg=`DropdownMenu`,[Mg,tee]=h(jg,[dh]),Ng=dh(),[Pg,Fg]=Mg(jg),Ig=Ag(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Ng(t),l=P.useRef(null),[u,d]=x({prop:i,defaultProp:a??!1,onChange:o,caller:jg});return(0,H.jsx)(Pg,{scope:t,triggerId:p(),triggerRef:l,contentId:p(),open:u,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,H.jsx)(vh,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Lg=`DropdownMenuTrigger`,Rg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Fg(Lg,n),o=Ng(n),s=O(t,a.triggerRef);return(0,H.jsx)(yh,{asChild:!0,...o,children:(0,H.jsx)(u.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:v(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:v(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),zg=Ag(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Ng(t);return(0,H.jsx)(Ch,{...r,...n})},`DropdownMenuPortal`),Bg=`DropdownMenuContent`,Vg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Fg(Bg,n),a=Ng(n),o=P.useRef(!1);return(0,H.jsx)(Dh,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:v(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:v(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Hg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Nh,{...i,...r,ref:t})},`DropdownMenuLabel`)),Ug=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Ih,{...i,...r,ref:t})},`DropdownMenuItem`)),Wg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Rh,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),Gg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Vh,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),Kg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Uh,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),qg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(qh,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Jg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(Jh,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Yg=Ag(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Ng(t),[s,c]=x({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,H.jsx)(Qh,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),Xg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(eg,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),Zg=P.forwardRef(Ag(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ng(n);return(0,H.jsx)(ng,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),Qg=Object.defineProperty,$g=P.forwardRef(((e,t)=>Qg(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,H.jsx)(u.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),e_=Object.defineProperty,t_=(e,t)=>e_(e,`name`,{value:t,configurable:!0});function n_(e,[t,n]){return Math.min(n,Math.max(t,e))}t_(n_,`clamp`);var r_=Object.defineProperty,i_=(e,t)=>r_(e,`name`,{value:t,configurable:!0}),a_=`Popover`,[o_,nee]=h(a_,[ae]),s_=ae(),[c_,l_]=o_(a_),u_=i_(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=s_(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=P.useState(0),[m,h]=P.useState(0),[g,_]=x({prop:r,defaultProp:i??!1,onChange:a,caller:a_});return(0,H.jsx)(j,{...s,children:(0,H.jsx)(c_,{scope:t,contentId:p(),titleId:p(),descriptionId:p(),titlePresent:d>0,descriptionPresent:m>0,setTitleCount:f,setDescriptionCount:h,triggerRef:c,open:g,onOpenChange:_,onOpenToggle:P.useCallback(()=>_(e=>!e),[_]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),d_=`PopoverTrigger`,f_=P.forwardRef(i_(function(e,t){let{__scopePopover:n,...r}=e,i=l_(d_,n),a=s_(n),o=O(t,i.triggerRef),s=(0,H.jsx)(u.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":C_(i.open),...r,ref:o,onClick:v(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,H.jsx)(A,{asChild:!0,...a,children:s})},`PopoverTrigger`)),p_=`PopoverPortal`,[m_,h_]=o_(p_,{forceMount:void 0}),g_=i_(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=l_(p_,t);return(0,H.jsx)(m_,{scope:t,forceMount:n,children:(0,H.jsx)(m,{present:n||a.open,children:(0,H.jsx)(S,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),__=`PopoverContent`,v_=P.forwardRef(i_(function(e,t){let n=h_(__,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=l_(__,e.__scopePopover);return(0,H.jsx)(m,{present:r||a.open,children:a.modal?(0,H.jsx)(b_,{...i,ref:t}):(0,H.jsx)(x_,{...i,ref:t})})},`PopoverContent`)),y_=k(`PopoverContent.RemoveScroll`),b_=P.forwardRef(i_(function(e,t){let n=l_(__,e.__scopePopover),r=P.useRef(null),i=O(t,r),a=P.useRef(!1),{nodes:o,registry:s}=C();return P.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,H.jsx)(De,{as:y_,allowPinchZoom:!0,shards:P.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,H.jsx)(S_,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:v(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:v(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:v(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),x_=P.forwardRef(i_(function(e,t){let n=l_(__,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,H.jsx)(S_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),S_=P.forwardRef(i_(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":p,branchNodes:m,branchRegistry:h,...g}=e,v=l_(__,n),y=s_(n),[x,S]=P.useState(null),C=O(t,S);return b(x),ce(),(0,H.jsx)(d,{registry:h,children:(0,H.jsx)(_,{asChild:!0,loop:!0,trapped:r,branches:m,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(f,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>v.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,H.jsx)(re,{"data-state":C_(v.open),role:`dialog`,id:v.contentId,"aria-labelledby":v.titlePresent?v.titleId:void 0,"aria-describedby":v.descriptionPresent?w_(p,v.descriptionId):p,...y,...g,ref:C,style:{...g.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function C_(e){return e?`open`:`closed`}i_(C_,`getState`);function w_(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}i_(w_,`concatAriaDescribedby`);var T_=e(o(),1),E_=Object.defineProperty,D_=(e,t)=>E_(e,`name`,{value:t,configurable:!0}),O_={ItemAligned:`item-aligned`,Popper:`popper`},k_={LTR:`ltr`,RTL:`rtl`},A_=[` `,`Enter`,`ArrowUp`,`ArrowDown`],j_=[` `,`Enter`],M_=`Select`,[N_,P_,F_]=Bp(M_),[I_,ree]=h(M_,[F_,ae]),L_=ae(),[R_,z_]=I_(M_),[B_,V_]=I_(M_);function H_(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:m,form:h,internal_do_not_use_render:g}=e,_=L_(t),[v,y]=P.useState(null),[b,S]=P.useState(null),[C,w]=P.useState(!1),T=nm(l),[E,D]=x({prop:r,defaultProp:i??!1,onChange:a,caller:M_}),[O,k]=x({prop:o,defaultProp:s,onChange:c,caller:M_}),A=P.useRef(null),ee=P.useRef(!1),[te,ne]=P.useState(null),re=D_(e=>{ne({value:e,hasConsumerStoppedPropagation:ee.current}),k(e)},`handleUserSelect`),ie=P.useRef(O);P.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=D_(()=>k(ie.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,k]);let ae=!v||!!h||!!v.closest(`form`),[M,oe]=P.useState(new Set),se=p(),ce=Array.from(M).map(e=>e.props.value).join(`;`),le=P.useCallback(e=>{oe(t=>new Set(t).add(e))},[]),ue=P.useCallback(e=>{oe(t=>{let n=new Set(t);return n.delete(e),n})},[]),de={required:m,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:se,value:O,onValueChange:k,hasConsumerStoppedPropagationRef:ee,userSelection:te,onUserSelect:re,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:M,nativeSelectKey:ce,isFormControl:ae};return(0,H.jsx)(j,{..._,children:(0,H.jsx)(R_,{scope:t,...de,children:(0,H.jsx)(N_.Provider,{scope:t,children:(0,H.jsx)(B_,{scope:t,onNativeOptionAdd:le,onNativeOptionRemove:ue,children:yv(g)?g(de):n})})})})}D_(H_,`SelectProvider`);var U_=D_(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,H.jsx)(H_,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[n,e?(0,H.jsx)(vv,{__scopeSelect:t}):null]})})},`Select`),iee=`SelectTrigger`,aee=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=L_(n),o=z_(iee,n),s=o.disabled||r,c=O(t,o.onTriggerChange),l=P_(n),d=P.useRef(`touch`),[f,p,m]=xv(e=>{let t=l().filter(e=>!e.disabled),n=Sv(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),h=D_(e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,H.jsx)(A,{asChild:!0,...a,children:(0,H.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":bv(o.value)?``:void 0,...i,ref:c,onClick:v(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:v(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:v(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),p(e.key)),!(t&&e.key===` `)&&A_.includes(e.key)&&(h(),e.preventDefault())})})})},`SelectTrigger`)),oee=`SelectValue`,see=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=z_(oee,n),{onValueNodeHasChildrenChange:l}=c,d=a!==void 0,f=O(t,c.onValueNodeChange);g(()=>{l(d)},[l,d]);let p=bv(c.value);return(0,H.jsx)(u.span,{...s,asChild:!p&&s.asChild,ref:f,style:{pointerEvents:`none`},children:(0,H.jsx)(P.Fragment,{children:p?o:a},p?`placeholder`:`value`)})},`SelectValue`)),cee=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,H.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[lee,uee]=I_(`SelectPortal`,{forceMount:void 0}),dee=D_(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,H.jsx)(lee,{scope:e.__scopeSelect,forceMount:n,children:(0,H.jsx)(S,{asChild:!0,...r})})},`SelectPortal`),W_=`SelectContent`,G_=P.forwardRef(D_(function(e,t){let n=uee(W_,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=z_(W_,e.__scopeSelect),[o,s]=P.useState();return g(()=>{s(new DocumentFragment)},[]),(0,H.jsx)(m,{present:r||a.open,children:({present:e})=>e?(0,H.jsx)(Z_,{...i,ref:t}):(0,H.jsx)(K_,{...i,fragment:o})})},`SelectContent`)),K_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?T_.createPortal((0,H.jsx)(J_,{scope:n,children:(0,H.jsx)(N_.Slot,{scope:n,children:(0,H.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),q_=10,[J_,Y_]=I_(W_),X_=k(`SelectContent.RemoveScroll`),Z_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n}=e,{position:r=O_.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:y,...b}=e,x=z_(W_,n),[S,C]=P.useState(null),[w,T]=P.useState(null),E=O(t,C),[D,k]=P.useState(null),[A,ee]=P.useState(null),j=P_(n),[te,ne]=P.useState(!1),re=P.useRef(!1),ie=P.useRef(!1),ae=P.useRef(!1);P.useEffect(()=>{if(S)return oe(S)},[S]),ce();let M=P.useCallback(e=>{let[t,...n]=j().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[j,w]),se=P.useCallback(()=>M([D,S]),[M,D,S]);P.useEffect(()=>{te&&se()},[te,se]);let{onOpenChange:le,triggerPointerDownPosRef:ue}=x;P.useEffect(()=>{if(S){let e={x:0,y:0},t=D_(t=>{e={x:Math.abs(Math.round(t.pageX)-(ue.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ue.current?.y??0))}},`handlePointerMove`),n=D_(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(S)||le(!1),document.removeEventListener(`pointermove`,t),ue.current=null},`handlePointerUp`);return ue.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[S,le,ue]),P.useEffect(()=>{let e=D_(()=>le(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[le]);let[de,fe]=xv(e=>{let t=j().filter(e=>!e.disabled),n=Sv(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),pe=P.useCallback((e,t,n)=>{let r=!ie.current;r&&(ie.current=!0);let i=!re.current&&!n;x.value!==void 0&&x.value===t||i?(k(e),i&&(re.current=!0)):r&&k(e)},[x.value]),me=P.useCallback(()=>S?.focus(),[S]),he=P.useCallback((e,t,n)=>{if(!e)return;let r=!ae.current;r&&(ae.current=!0);let i=!re.current&&!n;(x.value!==void 0&&x.value===t||i||r)&&ee(e)},[x.value]),ge=r===O_.Popper?$_:Q_,N=ge===$_?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:y}:{};return(0,H.jsx)(J_,{scope:n,content:S,viewport:w,onViewportChange:T,itemRefCallback:pe,selectedItem:D,onItemLeave:me,itemTextRefCallback:he,focusSelectedItem:se,selectedItemText:A,position:r,isPositioned:te,searchRef:de,children:(0,H.jsx)(De,{as:X_,allowPinchZoom:!0,children:(0,H.jsx)(_,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:v(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(f,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,H.jsx)(ge,{role:`listbox`,id:x.contentId,"data-state":x.open?`open`:`closed`,dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...N,onPlaced:()=>ne(!0),ref:E,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:v(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&fe(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=j().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Q_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=z_(W_,n),o=Y_(W_,n),[s,c]=P.useState(null),[l,d]=P.useState(null),f=O(t,d),p=P_(n),m=P.useRef(!1),h=P.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=P.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==k_.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q_,d=n_(a,[q_,Math.max(q_,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-q_,d=n_(a,[q_,Math.max(q_,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=p(),c=window.innerHeight-q_*2,u=_.scrollHeight,d=window.getComputedStyle(l),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-q_,D=c-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+h+k,ee=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}s.style.margin=`${q_}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);g(()=>x(),[x]);let[S,C]=P.useState();g(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let w=P.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]);return(0,H.jsx)(ev,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:w,children:(0,H.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,H.jsx)(u.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),$_=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=q_,...a}=e,o=L_(n);return(0,H.jsx)(re,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[ev,tv]=I_(W_,{}),nv=`SelectViewport`,rv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Y_(nv,n),o=tv(nv,n),s=O(t,a.onViewportChange),c=P.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,H.jsx)(N_.Slot,{scope:n,children:(0,H.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:v(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-q_*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[fee,pee]=I_(`SelectGroup`),iv=`SelectItem`,[av,ov]=I_(iv),sv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=z_(iv,n),c=Y_(iv,n),l=s.value===r,[d,f]=P.useState(a??``),[m,h]=P.useState(!1),g=T(e=>c.itemRefCallback?.(e,r,i)),_=O(t,g),y=p(),b=P.useRef(`touch`);function x(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return D_(x,`handleSelect`),(0,H.jsx)(av,{scope:n,value:r,disabled:i,textId:y,isSelected:l,onItemTextChange:P.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(N_.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,H.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":m?``:void 0,"aria-selected":l&&m,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:v(o.onFocus,()=>h(!0)),onBlur:v(o.onBlur,()=>h(!1)),onClick:v(o.onClick,e=>{i||b.current!==`mouse`&&x(e)}),onPointerUp:v(o.onPointerUp,e=>{i||b.current===`mouse`&&x(e)}),onPointerDown:v(o.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:v(o.onPointerMove,e=>{b.current=e.pointerType,i?c.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:v(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:v(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(j_.includes(e.key)&&x(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),cv=`SelectItemText`,lv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=z_(cv,n),s=Y_(cv,n),c=ov(cv,n),l=V_(cv,n),[d,f]=P.useState(null),p=T(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=O(t,f,c.onItemTextChange,p),h=d?.textContent,_=P.useMemo(()=>(0,H.jsx)(`option`,{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=l;return g(()=>(v(_),()=>y(_)),[v,y,_]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.span,{id:c.textId,...a,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!bv(o.value)?T_.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),uv=`SelectItemIndicator`,dv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,...r}=e;return ov(uv,n).isSelected?(0,H.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),fv=`SelectScrollUpButton`,pv=P.forwardRef(D_(function(e,t){let n=Y_(fv,e.__scopeSelect),r=tv(fv,e.__scopeSelect),[i,a]=P.useState(!1),o=O(t,r.onScrollButtonChange);return g(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};D_(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(gv,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),mv=`SelectScrollDownButton`,hv=P.forwardRef(D_(function(e,t){let n=Y_(mv,e.__scopeSelect),r=tv(mv,e.__scopeSelect),[i,a]=P.useState(!1),o=O(t,r.onScrollButtonChange);return g(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};D_(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(gv,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),gv=P.forwardRef(D_(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y_(`SelectScrollButton`,n),o=P.useRef(null),s=P_(n),c=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>c(),[c]),g(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,H.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:v(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:v(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:v(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),_v=`SelectBubbleInput`,vv=P.forwardRef(D_(function({__scopeSelect:e,...t},n){let r=z_(_v,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:d,userSelection:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=P.useRef(null),g=O(n,h),_=i??``,v=P.useRef(_),y=P.useRef(f),b=P.useRef(!1),x=Array.from(p).some(e=>(e.props.value??``)===``);return P.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=f!==null&&f!==y.current;y.current=f;let i=v.current!==_;v.current=_;let a=r&&i;if(r&&!i&&f.value!==_&&!f.hasConsumerStoppedPropagation&&n){b.current=!0;try{n.call(e,f.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{b.current=!1,n.call(e,_)}return}let o=a&&!f.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,_),e.dispatchEvent(t)}},[_,f]),(0,H.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:d,onChange:e=>{b.current||a(e.target.value)},...t,style:{...te,...t.style},ref:g,defaultValue:_,children:[bv(i)&&!x?(0,H.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function yv(e){return typeof e==`function`}D_(yv,`isFunction`);function bv(e){return e===``||e===void 0}D_(bv,`shouldShowPlaceholder`);function xv(e){let t=T(e),n=P.useRef(``),r=P.useRef(0),i=P.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}D_(a,`updateSearch`),a(i)},[t]),a=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}D_(xv,`useTypeaheadSearch`);function Sv(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Cv(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}D_(Sv,`findNextItem`);function Cv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}D_(Cv,`wrapArray`);var wv=Object.defineProperty,Tv=(e,t)=>wv(e,`name`,{value:t,configurable:!0}),Ev=`Switch`,[Dv,mee]=h(Ev),[Ov,kv]=Dv(Ev);function Av(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=x({prop:n,defaultProp:i??!1,onChange:c,caller:Ev}),[m,h]=P.useState(null),[g,_]=P.useState(null),[v,y]=P.useState(null),b={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,H.jsx)(Ov,{scope:t,...b,children:Rv(d)?d(b):r})}Tv(Av,`SwitchProvider`);var jv=`SwitchTrigger`,Mv=P.forwardRef(Tv(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:d,setChecked:f,onUserClick:p,isFormControl:m,bubbleInput:h}=kv(jv,e),g=O(r,d),_=P.useRef(c);return P.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=Tv(()=>f(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,f]),(0,H.jsx)(u.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":zv(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:v(t,e=>{let t=e.isPropagationStopped();p({requestedChecked:!c,hasConsumerStoppedPropagation:t}),f(e=>!e),h&&m&&(t||e.stopPropagation())})})},`SwitchTrigger`)),Nv=P.forwardRef(Tv(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,H.jsx)(Av,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Mv,{...d,ref:t,__scopeSwitch:n}),e&&(0,H.jsx)(Lv,{__scopeSwitch:n})]})})},`Switch`)),Pv=`SwitchThumb`,Fv=P.forwardRef(Tv(function(e,t){let{__scopeSwitch:n,...r}=e,i=kv(Pv,n);return(0,H.jsx)(u.span,{"data-state":zv(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),Iv=`SwitchBubbleInput`,Lv=P.forwardRef(Tv(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=kv(Iv,e),g=O(r,h),_=ee(i),y=P.useRef(!1),b=P.useRef(o),x=P.useRef(a),S=P.useRef(null);P.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=b.current!==o;b.current=o;let i=a!==null&&a!==x.current;if(x.current=a,i)S.current=r?null:a,r&&n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=S.current;S.current=null;let r=t?.requestedChecked===o;y.current=!0,n.call(e,o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),y.current=!1}},[m,o,a]);let C=P.useRef(o);return(0,H.jsx)(u.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??C.current,required:c,disabled:l,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:v(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function Rv(e){return typeof e==`function`}Tv(Rv,`isFunction`);function zv(e){return e?`checked`:`unchecked`}Tv(zv,`getState`);var Bv=class extends P.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(e,t.componentStack)}render(){let e=this.state.error;return e===null?this.props.children:(0,H.jsxs)(`div`,{className:`flex h-dvh flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:`Something went wrong`}),(0,H.jsx)(`p`,{className:`text-muted-foreground max-w-xl text-sm whitespace-pre-wrap`,children:e.message}),(0,H.jsx)(y,{onClick:()=>location.reload(),children:`Reload`})]})}},Vv=`/assets/ghostty-vt-CQAu1Gs5.wasm`,Hv=Uint8Array,Uv=Uint16Array,Wv=Int32Array,Gv=new Hv([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Kv=new Hv([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qv=new Hv([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jv=function(e,t){for(var n=new Uv(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Wv(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Yv=Jv(Gv,2),Xv=Yv.b,Zv=Yv.r;Xv[28]=258,Zv[258]=28;var Qv=Jv(Kv,0),$v=Qv.b;Qv.r;for(var ey=new Uv(32768),ty=0;ty<32768;++ty){var ny=(ty&43690)>>1|(ty&21845)<<1;ny=(ny&52428)>>2|(ny&13107)<<2,ny=(ny&61680)>>4|(ny&3855)<<4,ey[ty]=((ny&65280)>>8|(ny&255)<<8)>>1}for(var ry=(function(e,t,n){for(var r=e.length,i=0,a=new Uv(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Uv(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Uv(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ey[d]>>c]=l}else for(s=new Uv(r),i=0;i<r;++i)e[i]&&(s[i]=ey[o[e[i]-1]++]>>15-e[i]);return s}),iy=new Hv(288),ty=0;ty<144;++ty)iy[ty]=8;for(var ty=144;ty<256;++ty)iy[ty]=9;for(var ty=256;ty<280;++ty)iy[ty]=7;for(var ty=280;ty<288;++ty)iy[ty]=8;for(var ay=new Hv(32),ty=0;ty<32;++ty)ay[ty]=5;var oy=ry(iy,9,1),sy=ry(ay,5,1),cy=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ly=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},uy=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},dy=function(e){return(e+7)/8|0},fy=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Hv(e.subarray(t,n))},py=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],my=function(e,t,n){var r=Error(t||py[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,my),!n)throw r;return r},hy=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Hv(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Hv(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Hv(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=ly(e,d,1);var v=ly(e,d+1,3);if(d+=3,!v){var y=dy(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&my(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=oy,m=sy,h=9,g=5;else if(v==2){var S=ly(e,d,31)+257,C=ly(e,d+10,15)+4,w=S+ly(e,d+5,31)+1;d+=14;for(var T=new Hv(w),E=new Hv(19),D=0;D<C;++D)E[qv[D]]=ly(e,d+D*3,7);d+=C*3;for(var O=cy(E),k=(1<<O)-1,A=ry(E,O,1),D=0;D<w;){var ee=A[ly(e,d,k)];d+=ee&15;var y=ee>>4;if(y<16)T[D++]=y;else{var j=0,te=0;for(y==16?(te=3+ly(e,d,3),d+=2,j=T[D-1]):y==17?(te=3+ly(e,d,7),d+=3):y==18&&(te=11+ly(e,d,127),d+=7);te--;)T[D++]=j}}var ne=T.subarray(0,S),re=T.subarray(S);h=cy(ne),g=cy(re),p=ry(ne,h,1),m=ry(re,g,1)}else my(1);if(d>_){c&&my(0);break}}s&&l(f+131072);for(var ie=(1<<h)-1,ae=(1<<g)-1,M=d;;M=d){var j=p[uy(e,d)&ie],oe=j>>4;if(d+=j&15,d>_){c&&my(0);break}if(j||my(2),oe<256)n[f++]=oe;else if(oe==256){M=d,p=null;break}else{var se=oe-254;if(oe>264){var D=oe-257,ce=Gv[D];se=ly(e,d,(1<<ce)-1)+Xv[D],d+=ce}var le=m[uy(e,d)&ae],ue=le>>4;le||my(3),d+=le&15;var re=$v[ue];if(ue>3){var ce=Kv[ue];re+=uy(e,d)&(1<<ce)-1,d+=ce}if(d>_){c&&my(0);break}s&&l(f+131072);var de=f+se;if(f<re){var fe=a-re,pe=Math.min(re,de);for(fe+f<0&&my(3);f<pe;++f)n[f]=r[fe+f]}for(;f<de;++f)n[f]=n[f-re]}}t.l=p,t.p=M,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?fy(n,0,f):n.subarray(0,f)},gy=new Hv(0),_y=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&my(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&my(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2},vy=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new Hv(32768),this.p=new Hv(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||my(5),this.d&&my(4),!this.p.length)this.p=e;else if(e.length){var t=new Hv(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=hy(this.p,this.s,this.o);this.ondata(fy(n,t,this.s.b),this.d),this.o=fy(n,this.s.b-32768),this.s.b=this.o.length,this.p=fy(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),yy=function(){function e(e,t){vy.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(vy.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(_y(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&my(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),vy.prototype.c.call(this,t)},e}();function by(e,t){return hy(e.subarray(_y(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var xy=typeof TextDecoder<`u`&&new TextDecoder;try{xy.decode(gy,{stream:!0})}catch{}function Sy(e,t=`utf8`){return new TextDecoder(t).decode(e)}var Cy=new TextEncoder;function wy(e){return Cy.encode(e)}var Ty=8192,Ey=(()=>{let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),Dy={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array},Oy=class e{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=Ty,n={}){let r=!1;typeof t==`number`?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);let i=n.offset?n.offset>>>0:0,a=t.byteLength-i,o=i;(ArrayBuffer.isView(t)||t instanceof e)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+i),t=t.buffer),this.lastWrittenByte=r?a:0,this.buffer=t,this.length=a,this.byteLength=a,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,a),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let e=this._marks.pop();if(e===void 0)throw Error(`Mark stack empty`);return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){let t=(this.offset+e)*2,n=new Uint8Array(t);n.set(new Uint8Array(this.buffer)),this.buffer=n.buffer,this.length=t,this.byteLength=t,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,`uint8`)}readArray(e,t){let n=Dy[t].BYTES_PER_ELEMENT*e,r=this.byteOffset+this.offset,i=this.buffer.slice(r,r+n);if(this.littleEndian===Ey&&t!==`uint8`&&t!==`int8`){let e=new Uint8Array(this.buffer.slice(r,r+n));e.reverse();let i=new Dy[t](e.buffer);return this.offset+=n,i.reverse(),i}let a=new Dy[t](i);return this.offset+=n,a}readInt16(){let e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){let e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){let e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){let e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){let e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){let e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){let e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){let e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t=``;for(let n=0;n<e;n++)t+=this.readChar();return t}readUtf8(e=1){return Sy(this.readBytes(e))}decodeText(e=1,t=`utf8`){return Sy(this.readBytes(e),t)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let t=0;t<e.length;t++)this._data.setUint8(this.offset++,e[t]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let t=0;t<e.length;t++)this.writeUint8(e.charCodeAt(t));return this}writeUtf8(e){return this.writeBytes(wy(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}},ky=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;ky[e]=t}var Ay=4294967295;function jy(e,t,n){let r=e;for(let e=0;e<n;e++)r=ky[(r^t[e])&255]^r>>>8;return r}function My(e,t){return(jy(Ay,e,t)^Ay)>>>0}function Ny(e,t,n){let r=e.readUint32(),i=My(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function Py(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function Fy(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function Iy(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function Ly(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+(t[a-i]>>1)&255}else{for(;a<i;a++)t[a]=e[a]+(n[a]>>1)&255;for(;a<r;a++)t[a]=e[a]+(t[a-i]+n[a]>>1)&255}}function Ry(e,t,n,r,i){let a=0;if(n.length===0){for(;a<i;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+t[a-i]&255}else{for(;a<i;a++)t[a]=e[a]+n[a]&255;for(;a<r;a++)t[a]=e[a]+zy(t[a-i],n[a],n[a-i])&255}}function zy(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}function By(e,t,n,r,i,a){switch(e){case 0:Py(t,n,i);break;case 1:Fy(t,n,i,a);break;case 2:Iy(t,n,r,i);break;case 3:Ly(t,n,r,i,a);break;case 4:Ry(t,n,r,i,a);break;default:throw Error(`Unsupported filter: ${e}`)}}var Vy=new Uint16Array([255]),Hy=new Uint8Array(Vy.buffer)[0]===255;function Uy(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],s=Math.ceil(a/8)*i,c=new Uint8Array(r*n*s),l=0;for(let e=0;e<7;e++){let i=o[e],a=Math.ceil((n-i.x)/i.xStep),u=Math.ceil((r-i.y)/i.yStep);if(a<=0||u<=0)continue;let d=a*s,f=new Uint8Array(d);for(let e=0;e<u;e++){let o=t[l++],u=t.subarray(l,l+d);l+=d;let p=new Uint8Array(d);By(o,u,p,f,d,s),f.set(p);for(let t=0;t<a;t++){let a=i.x+t*i.xStep,o=i.y+e*i.yStep;if(!(a>=n||o>=r))for(let e=0;e<s;e++)c[(o*n+a)*s+e]=p[t*s+e]}}}if(a===16){let e=new Uint16Array(c.buffer);if(Hy)for(let t=0;t<e.length;t++)e[t]=Wy(e[t]);return e}return c}function Wy(e){return(e&255)<<8|e>>8&255}var Gy=new Uint16Array([255]),Ky=new Uint8Array(Gy.buffer)[0]===255,qy=new Uint8Array;function Jy(e){let{data:t,width:n,height:r,channels:i,depth:a}=e,o=Math.ceil(a/8)*i,s=Math.ceil(a/8*i*n),c=new Uint8Array(r*s),l=qy,u=0,d,f;for(let e=0;e<r;e++){switch(d=t.subarray(u+1,u+1+s),f=c.subarray(e*s,(e+1)*s),t[u]){case 0:Py(d,f,s);break;case 1:Fy(d,f,s,o);break;case 2:Iy(d,f,l,s);break;case 3:Ly(d,f,l,s,o);break;case 4:Ry(d,f,l,s,o);break;default:throw Error(`Unsupported filter: ${t[u]}`)}l=f,u+=s+1}if(a===16){let e=new Uint16Array(c.buffer);if(Ky)for(let t=0;t<e.length;t++)e[t]=Yy(e[t]);return e}return c}function Yy(e){return(e&255)<<8|e>>8&255}var Xy=Uint8Array.of(137,80,78,71,13,10,26,10);function Zy(e){if(!Qy(e.readBytes(Xy.length)))throw Error(`wrong PNG signature`)}function Qy(e){if(e.length<Xy.length)return!1;for(let t=0;t<Xy.length;t++)if(e[t]!==Xy[t])return!1;return!0}var $y=`tEXt`,hee=0,eb=new TextDecoder(`latin1`);function gee(e){if(vee(e),e.length===0||e.length>79)throw Error(`keyword length must be between 1 and 79`)}var _ee=/^[\u0000-\u00FF]*$/;function vee(e){if(!_ee.test(e))throw Error(`invalid latin1 text`)}function yee(e,t,n){let r=tb(t);e[r]=bee(t,n-r.length-1)}function tb(e){for(e.mark();e.readByte()!==hee;);let t=e.offset;e.reset();let n=eb.decode(e.readBytes(t-e.offset-1));return e.skip(1),gee(n),n}function bee(e,t){return eb.decode(e.readBytes(t))}var nb={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},rb={UNKNOWN:-1,DEFLATE:0},ib={UNKNOWN:-1,ADAPTIVE:0},ab={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},ob={NONE:0,BACKGROUND:1,PREVIOUS:2},sb={SOURCE:0,OVER:1},xee=class extends Oy{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;_chunks;_inflatorResult;constructor(e,t={}){super(e);let{checkCrc:n=!1}=t;this._checkCrc=n,this._inflator=new yy((e,t)=>{if(this._chunks.push(e),t){let e=this._chunks.reduce((e,t)=>e+t.length,0);this._inflatorResult=new Uint8Array(e);let t=0;for(let e of this._chunks)this._inflatorResult.set(e,t),t+=e.length;this._chunks=[]}}),this._chunks=[],this._png={width:-1,height:-1,channels:-1,data:new Uint8Array,depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array,this._compressionMethod=rb.UNKNOWN,this._filterMethod=ib.UNKNOWN,this._interlaceMethod=ab.UNKNOWN,this._colorType=nb.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this._inflatorResult=new Uint8Array,this.setBigEndian()}decode(){for(Zy(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeChunk(e,t)}return this._inflator.push(new Uint8Array,!0),this.decodeImage(),this._png}decodeApng(){for(Zy(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeApngChunk(e,t)}return this.decodeApngImage(),this._apng}decodeChunk(e,t){let n=this.offset;switch(t){case`IHDR`:this.decodeIHDR();break;case`PLTE`:this.decodePLTE(e);break;case`IDAT`:this.decodeIDAT(e);break;case`IEND`:this._end=!0;break;case`tRNS`:this.decodetRNS(e);break;case`iCCP`:this.decodeiCCP(e);break;case $y:yee(this._png.text,this,e);break;case`pHYs`:this.decodepHYs();break;default:this.skip(e)}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?Ny(this,e+4,t):this.skip(4)}decodeApngChunk(e,t){let n=this.offset;switch(t!==`fdAT`&&t!==`IDAT`&&this._writingDataChunks&&this.pushDataToFrame(),t){case`acTL`:this.decodeACTL();break;case`fcTL`:this.decodeFCTL();break;case`fdAT`:this.decodeFDAT(e);break;default:this.decodeChunk(e,t),this.offset=n+e}if(this.offset-n!==e)throw Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?Ny(this,e+4,t):this.skip(4)}decodeIHDR(){let e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=See(this.readUint8());let t=this.readUint8();this._colorType=t;let n;switch(t){case nb.GREYSCALE:n=1;break;case nb.TRUECOLOUR:n=3;break;case nb.INDEXED_COLOUR:n=1;break;case nb.GREYSCALE_ALPHA:n=2;break;case nb.TRUECOLOUR_ALPHA:n=4;break;case nb.UNKNOWN:default:throw Error(`Unknown color type: ${t}`)}if(this._png.channels=n,this._compressionMethod=this.readUint8(),this._compressionMethod!==rb.DEFLATE)throw Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let e={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array};this._frames.push(e)}decodePLTE(e){if(e%3!=0)throw RangeError(`PLTE field length must be a multiple of 3. Got ${e}`);let t=e/3;this._hasPalette=!0;let n=[];this._palette=n;for(let e=0;e<t;e++)n.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;try{this._inflator.push(new Uint8Array(this.buffer,n,t),!1)}catch(e){throw Error(`Error while decompressing the data:`,{cause:e})}this.skip(e)}decodeFDAT(e){this._writingDataChunks=!0;let t=e,n=this.offset+this.byteOffset;n+=4,t-=4;try{this._inflator.push(new Uint8Array(this.buffer,n,t),!1)}catch(e){throw Error(`Error while decompressing the data:`,{cause:e})}this.skip(e)}decodetRNS(e){switch(this._colorType){case nb.GREYSCALE:case nb.TRUECOLOUR:if(e%2!=0)throw RangeError(`tRNS chunk length must be a multiple of 2. Got ${e}`);if(e/2>this._png.width*this._png.height)throw Error(`tRNS chunk contains more alpha values than there are pixels (${e/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(e/2);for(let t=0;t<e/2;t++)this._transparency[t]=this.readUint16();break;case nb.INDEXED_COLOUR:{if(e>this._palette.length)throw Error(`tRNS chunk contains more alpha values than there are palette colors (${e} vs ${this._palette.length})`);let t=0;for(;t<e;t++){let e=this.readByte();this._palette[t].push(e)}for(;t<this._palette.length;t++)this._palette[t].push(255);break}case nb.UNKNOWN:case nb.GREYSCALE_ALPHA:case nb.TRUECOLOUR_ALPHA:default:throw Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(e){let t=tb(this),n=this.readUint8();if(n!==rb.DEFLATE)throw Error(`Unsupported iCCP compression method: ${n}`);let r=this.readBytes(e-t.length-2);this._png.iccEmbeddedProfile={name:t,profile:by(r)}}decodepHYs(){let e=this.readUint32(),t=this.readUint32(),n=this.readByte();this._png.resolution={x:e,y:t,unit:n}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let e=0;e<this._numberOfFrames;e++){let t={sequenceNumber:this._frames[e].sequenceNumber,delayNumber:this._frames[e].delayNumber,delayDenominator:this._frames[e].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},n=this._frames.at(e);if(n){if(n.data=Jy({data:n.data,width:n.width,height:n.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),e===0||n.xOffset===0&&n.yOffset===0&&n.width===this._png.width&&n.height===this._png.height)t.data=n.data;else{let r=this._apng.frames.at(e-1);this.disposeFrame(n,r,t),this.addFrameDataToCanvas(t,n)}this._apng.frames.push(t)}}return this._apng}disposeFrame(e,t,n){switch(e.disposeOp){case ob.NONE:break;case ob.BACKGROUND:for(let t=0;t<this._png.height;t++)for(let r=0;r<this._png.width;r++){let i=(t*e.width+r)*this._png.channels;for(let e=0;e<this._png.channels;e++)n.data[i+e]=0}break;case ob.PREVIOUS:n.data.set(t.data);break;default:throw Error(`Unknown disposeOp`)}}addFrameDataToCanvas(e,t){let n=1<<this._png.depth,r=(e,n)=>({index:((e+t.yOffset)*this._png.width+t.xOffset+n)*this._png.channels,frameIndex:(e*t.width+n)*this._png.channels});switch(t.blendOp){case sb.SOURCE:for(let n=0;n<t.height;n++)for(let i=0;i<t.width;i++){let{index:a,frameIndex:o}=r(n,i);for(let n=0;n<this._png.channels;n++)e.data[a+n]=t.data[o+n]}break;case sb.OVER:for(let i=0;i<t.height;i++)for(let a=0;a<t.width;a++){let{index:o,frameIndex:s}=r(i,a);for(let r=0;r<this._png.channels;r++){let i=t.data[s+this._png.channels-1]/n,a=r%(this._png.channels-1)==0?1:t.data[s+r],c=Math.floor(i*a+(1-i)*e.data[o+r]);e.data[o+r]+=c}}break;default:throw Error(`Unknown blendOp`)}}decodeImage(){let e=this._inflatorResult;if(this._filterMethod!==ib.ADAPTIVE)throw Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===ab.NO_INTERLACE)this._png.data=Jy({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===ab.ADAM7)this._png.data=Uy({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){this._inflator.push(new Uint8Array,!0);let e=this._inflatorResult,t=this._frames.at(-1);t?t.data=e:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:ob.NONE,blendOp:sb.SOURCE,data:e}),this._inflator=new yy((e,t)=>{if(this._chunks.push(e),t){let e=this._chunks.reduce((e,t)=>e+t.length,0);this._inflatorResult=new Uint8Array(e);let t=0;for(let e of this._chunks)this._inflatorResult.set(e,t),t+=e.length;this._chunks=[]}}),this._chunks=[],this._writingDataChunks=!1}};function See(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw Error(`invalid bit depth: ${e}`);return e}function Cee(e){let t=e.palette,n=e.depth;if(!t)throw Error(`Color palette is undefined.`);wee(e);let r=e.width*e.height,i=r*t[0].length,a=new Uint8Array(i),o=0,s=0,c=new Uint8Array(r),l=255;switch(n){case 1:l=128;break;case 2:l=192;break;case 4:l=240;break;case 8:l=255;break;default:throw Error(`Incorrect depth value`)}for(let t of e.data){let r=l,i=8;for(;r&&(i-=n,c[o++]=(t&r)>>i,r>>=n,o%e.width!==0););}if(e.palette)for(let t of c){let n=e.palette.at(t);if(!n)throw Error(`Incorrect index of palette color`);a.set(n,s),s+=n.length}return a}function wee(e){let t=e.depth<8?Math.ceil(e.width*e.depth/8)*e.height*e.channels:e.width*e.height*e.channels;if(e.data.length!==t)throw RangeError(`wrong data size. Found ${e.data.length}, expected ${t}`)}function cb(e,t){return new xee(e,t).decode()}var lb=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn(`BE platform detected. This version of node-sixel works only on LE properly.`);function t(e){return e&255}e.red=t;function n(e){return e>>>8&255}e.green=n;function r(e){return e>>>16&255}e.blue=r;function i(e){return e>>>24&255}e.alpha=i;function a(e,t,n,r=255){return((r&255)<<24|(n&255)<<16|(t&255)<<8|e&255)>>>0}e.toRGBA8888=a;function o(e){return[e&255,e>>8&255,e>>16&255,e>>>24]}e.fromRGBA8888=o;function s(e,i){let a=t(e),o=n(e),s=r(e),c=2**53-1,l=-1;for(let e=0;e<i.length;++e){let t=a-i[e][0],n=o-i[e][1],r=s-i[e][2],u=t*t+n*n+r*r;if(!u)return e;u<c&&(c=u,l=e)}return l}e.nearestColorIndex=s;function c(e,t,n){return Math.max(e,Math.min(n,t))}function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n*6<1?t+(e-t)*6*n:n*2<1?e:n*3<2?t+(e-t)*(4-n*6):t}function u(e,t,n){if(!n){let e=Math.round(t*255);return a(e,e,e)}let r=t<.5?t*(1+n):t+n-t*n,i=2*t-r;return a(c(0,255,Math.round(l(r,i,e+1/3)*255)),c(0,255,Math.round(l(r,i,e)*255)),c(0,255,Math.round(l(r,i,e-1/3)*255)))}function d(e,t,n){return(4278190080|Math.round(n/100*255)<<16|Math.round(t/100*255)<<8|Math.round(e/100*255))>>>0}e.normalizeRGB=d;function f(e,t,n){return u((e+240)/360,t/100,n/100)}e.normalizeHLS=f,e.PALETTE_VT340_COLOR=new Uint32Array([d(0,0,0),d(20,20,80),d(80,13,13),d(20,80,20),d(80,20,80),d(20,80,80),d(80,80,20),d(53,53,53),d(26,26,26),d(33,33,60),d(60,26,26),d(33,60,33),d(60,33,60),d(33,60,60),d(60,60,33),d(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([d(0,0,0),d(13,13,13),d(26,26,26),d(40,40,40),d(6,6,6),d(20,20,20),d(33,33,33),d(46,46,46),d(0,0,0),d(13,13,13),d(26,26,26),d(40,40,40),d(6,6,6),d(20,20,20),d(33,33,33),d(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let e=[a(0,0,0),a(205,0,0),a(0,205,0),a(205,205,0),a(0,0,238),a(205,0,205),a(0,250,205),a(229,229,229),a(127,127,127),a(255,0,0),a(0,255,0),a(255,255,0),a(92,92,255),a(255,0,255),a(0,255,255),a(255,255,255)],t=[0,95,135,175,215,255];for(let n=0;n<6;++n)for(let r=0;r<6;++r)for(let i=0;i<6;++i)e.push(a(t[n],t[r],t[i]));for(let t=8;t<=238;t+=10)e.push(a(t,t,t));return new Uint32Array(e)})(),e.DEFAULT_BACKGROUND=a(0,0,0,255),e.DEFAULT_FOREGROUND=a(255,255,255,255)})),ub=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:`AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRBoAgpAwA3AwAgAkGoiQJqQaAIKQMANwMAIAJBsIkCakGgCCkDADcDACACQbiJAmpBoAgpAwA3AwAgAkHAiQJqQaAIKQMANwMAIAJByIkCakGgCCkDADcDACACQdCJAmpBoAgpAwA3AwAgAkHYiQJqQaAIKQMANwMAIAJB4IkCakGgCCkDADcDACACQeiJAmpBoAgpAwA3AwAgAkHwiQJqQaAIKQMANwMAIAJB+IkCakGgCCkDADcDACACQYCKAmpBoAgpAwA3AwAgAkGIigJqQaAIKQMANwMAIAJBkIoCakGgCCkDADcDACACQZiKAmpBoAgpAwA3AwAgAkGgigJqQaAIKQMANwMAIAJBqIoCakGgCCkDADcDACACQbCKAmpBoAgpAwA3AwAgAkG4igJqQaAIKQMANwMAIAJBwIoCakGgCCkDADcDACACQciKAmpBoAgpAwA3AwAgAkHQigJqQaAIKQMANwMAIAJB2IoCakGgCCkDADcDACACQeCKAmpBoAgpAwA3AwAgAkHoigJqQaAIKQMANwMAIAJB8IoCakGgCCkDADcDACACQfiKAmpBoAgpAwA3AwAgAkGAiwJqQaAIKQMANwMAIAJBiIsCakGgCCkDADcDACACQZCLAmpBoAgpAwA3AwAgAkGYiwJqQaAIKQMANwMAIAJBoIsCakGgCCkDADcDACACQaiLAmpBoAgpAwA3AwAgAkGwiwJqQaAIKQMANwMAIAJBuIsCakGgCCkDADcDACACQcCLAmpBoAgpAwA3AwAgAkHIiwJqQaAIKQMANwMAIAJB0IsCakGgCCkDADcDACACQdiLAmpBoAgpAwA3AwAgAkHgiwJqQaAIKQMANwMAIAJB6IsCakGgCCkDADcDACACQfCLAmpBoAgpAwA3AwAgAkH4iwJqQaAIKQMANwMAIAJBgIwCakGgCCkDADcDACACQYiMAmpBoAgpAwA3AwAgAkGQjAJqQaAIKQMANwMAIAJBmIwCakGgCCkDADcDACACQaCMAmpBoAgpAwA3AwAgAkGojAJqQaAIKQMANwMAIAJBsIwCakGgCCkDADcDACACQbiMAmpBoAgpAwA3AwAgAkHAjAJqQaAIKQMANwMAIAJByIwCakGgCCkDADcDACACQdCMAmpBoAgpAwA3AwAgAkHYjAJqQaAIKQMANwMAIAJB4IwCakGgCCkDADcDACACQeiMAmpBoAgpAwA3AwAgAkHwjAJqQaAIKQMANwMAIAJB+IwCakGgCCkDADcDACACQYCNAmpBoAgpAwA3AwAgAkGIjQJqQaAIKQMANwMAIAJBkI0CakGgCCkDADcDACACQZiNAmpBoAgpAwA3AwAgAkGwiQZqIARBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBEGABPwKAABB1AgoAgBBAnRB0IkOaiAEQYAE/AoAAEHUCCgCAEECdEHgiRJqIARBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBEGABPwKAABB1AhB1AgoAgAiAkGAAWoiAzYCACABIANIDQEgAkGA/wBIDQALCwJAIABFDQAgCEH//wBLDQBBgIABIAhrIAcgAUH//wBLGyECAkAgAEEBcUUNACACRQ0AIAhBAnRBoIkCaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBAnFFDQAgAkUNACAIQQJ0QbCJBmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsCQCAAQQRxRQ0AIAJFDQAgCEECdEHAiQpqIQMgAiEEIAJBB3EiBwRAA0AgAyAFNgIAIANBBGohAyAEQQFrIQQgB0EBayIHDQALCyACQQFrQQdJDQADQCADIAU2AhwgAyAFNgIYIAMgBTYCFCADIAU2AhAgAyAFNgIMIAMgBTYCCCADIAU2AgQgAyAFNgIAIANBIGohAyAEQQhrIgQNAAsLAkAgAEEIcUUNACACRQ0AIAhBAnRB0IkOaiEDIAIhBCACQQdxIgcEQANAIAMgBTYCACADQQRqIQMgBEEBayEEIAdBAWsiBw0ACwsgAkEBa0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgBEEIayIEDQALCwJAIABBEHFFDQAgAkUNACAIQQJ0QeCJEmohAyACIQQgAkEHcSIHBEADQCADIAU2AgAgA0EEaiEDIARBAWshBCAHQQFrIgcNAAsLIAJBAWtBB0kNAANAIAMgBTYCHCADIAU2AhggAyAFNgIUIAMgBTYCECADIAU2AgwgAyAFNgIIIAMgBTYCBCADIAU2AgAgA0EgaiEDIARBCGsiBA0ACwsgAEEgcUUNACACRQ0AIAJBAWshByAIQQJ0QfCJFmohAyACQQdxIgQEQANAIAMgBTYCACADQQRqIQMgAkEBayECIARBAWsiBA0ACwsgB0EHSQ0AA0AgAyAFNgIcIAMgBTYCGCADIAU2AhQgAyAFNgIQIAMgBTYCDCADIAU2AgggAyAFNgIEIAMgBTYCACADQSBqIQMgAkEIayICDQALC0HcCEHcCCgCACAAcjYCACAGQQFqIgIgBi0AAEH/AHEiA0E/ayIAQT9LDQQaDAMLAkBB7AgoAgAiBEEBRgRAQfAIKAIAIgNBzAgoAgAiAUkNASADIAFwIQMMAQtB+AgoAgAhAkH0CCgCACEBAkACQCAEQQVHDQAgAUEBRw0AIAJB6QJODQQMAQsgAkHkAEoNA0H8CCgCAEHkAEoNA0GACSgCAEHkAEoNAwsCQCABRQ0AIAFBAkoNACACQfwIKAIAQYAJKAIAIAFBAnRBiAhqKAIAEQIAIQFB8AgoAgAiA0HMCCgCACICTwR/IAMgAnAFIAMLQQJ0QZAJaiABNgIAC0HwCCgCACIDQcwIKAIAIgFJDQAgAyABcCEDCyADQQJ0QZAJaigCACEFDAELIANB/QBxQSFHBEAgCCEBIAYhAgwECyAEQSNHDQQCQEHsCCgCACICQQFGBEBB8AgoAgAiAUHMCCgCACIASQ0BIAEgAHAhAQwBC0H4CCgCACEBQfQIKAIAIQACQAJAIAJBBUcNACAAQQFHDQAgAUHpAkgNAQwHCyABQeQASg0GQfwIKAIAQeQASg0GQYAJKAIAQeQASg0GCwJAIABFDQAgAEECSg0AIAFB/AgoAgBBgAkoAgAgAEECdEGICGooAgARAgAhAEHwCCgCACIBQcwIKAIAIgJPBH8gASACcAUgAQtBAnRBkAlqIAA2AgALQfAIKAIAIgFBzAgoAgAiAEkNACABIABwIQELIAFBAnRBkAlqKAIAIQUMBAsgCCEBIAYhAgtB1AgoAgAhBgNAAkAgASAGSA0AIAZB//8ASg0AIAZBAnQiBEGgiQJqIgZBoAgpAwA3AwAgBEGoiQJqQaAIKQMANwMAIARBsIkCakGgCCkDADcDACAEQbiJAmpBoAgpAwA3AwAgBEHAiQJqQaAIKQMANwMAIARByIkCakGgCCkDADcDACAEQdCJAmpBoAgpAwA3AwAgBEHYiQJqQaAIKQMANwMAIARB4IkCakGgCCkDADcDACAEQeiJAmpBoAgpAwA3AwAgBEHwiQJqQaAIKQMANwMAIARB+IkCakGgCCkDADcDACAEQYCKAmpBoAgpAwA3AwAgBEGIigJqQaAIKQMANwMAIARBkIoCakGgCCkDADcDACAEQZiKAmpBoAgpAwA3AwAgBEGgigJqQaAIKQMANwMAIARBqIoCakGgCCkDADcDACAEQbCKAmpBoAgpAwA3AwAgBEG4igJqQaAIKQMANwMAIARBwIoCakGgCCkDADcDACAEQciKAmpBoAgpAwA3AwAgBEHQigJqQaAIKQMANwMAIARB2IoCakGgCCkDADcDACAEQeCKAmpBoAgpAwA3AwAgBEHoigJqQaAIKQMANwMAIARB8IoCakGgCCkDADcDACAEQfiKAmpBoAgpAwA3AwAgBEGAiwJqQaAIKQMANwMAIARBiIsCakGgCCkDADcDACAEQZCLAmpBoAgpAwA3AwAgBEGYiwJqQaAIKQMANwMAIARBoIsCakGgCCkDADcDACAEQaiLAmpBoAgpAwA3AwAgBEGwiwJqQaAIKQMANwMAIARBuIsCakGgCCkDADcDACAEQcCLAmpBoAgpAwA3AwAgBEHIiwJqQaAIKQMANwMAIARB0IsCakGgCCkDADcDACAEQdiLAmpBoAgpAwA3AwAgBEHgiwJqQaAIKQMANwMAIARB6IsCakGgCCkDADcDACAEQfCLAmpBoAgpAwA3AwAgBEH4iwJqQaAIKQMANwMAIARBgIwCakGgCCkDADcDACAEQYiMAmpBoAgpAwA3AwAgBEGQjAJqQaAIKQMANwMAIARBmIwCakGgCCkDADcDACAEQaCMAmpBoAgpAwA3AwAgBEGojAJqQaAIKQMANwMAIARBsIwCakGgCCkDADcDACAEQbiMAmpBoAgpAwA3AwAgBEHAjAJqQaAIKQMANwMAIARByIwCakGgCCkDADcDACAEQdCMAmpBoAgpAwA3AwAgBEHYjAJqQaAIKQMANwMAIARB4IwCakGgCCkDADcDACAEQeiMAmpBoAgpAwA3AwAgBEHwjAJqQaAIKQMANwMAIARB+IwCakGgCCkDADcDACAEQYCNAmpBoAgpAwA3AwAgBEGIjQJqQaAIKQMANwMAIARBkI0CakGgCCkDADcDACAEQZiNAmpBoAgpAwA3AwAgBEGwiQZqIAZBgAT8CgAAQdQIKAIAQQJ0QcCJCmogBkGABPwKAABB1AgoAgBBAnRB0IkOaiAGQYAE/AoAAEHUCCgCAEECdEHgiRJqIAZBgAT8CgAAQdQIKAIAQQJ0QfCJFmogBkGABPwKAABB1AhB1AgoAgBBgAFqIgY2AgALIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiAFNgIAIABBAXZBAXEgAWxBAnRBsIkGaiAFNgIAIABBAnZBAXEgAWxBAnRBwIkKaiAFNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiAFNgIAIABBBHZBAXEgAWxBAnRB4IkSaiAFNgIAIABBBXYgAWxBAnRB8IkWaiAFNgIAQdQIKAIAIQYLIAFBAWohAUHcCEHcCCgCACAAcjYCACACLQAAIQAgAkEBaiIEIQIgAEH/AHEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHgiQIgADcDAEHYiQIgADcDAEHQiQIgADcDAEHIiQIgADcDAEHAiQIgADcDAEG4iQIgADcDAEGwiQIgADcDAEGoCCgCACIEQf8AakGAAW0hCAJAIARBgQFIDQBBASEBIAhBAiAIQQJKG0EBayICQQFxIQMgBEGBAk4EQCACQX5xIQIDQCABQQl0IgdBEHJBoIkCakGwiQJBgAT8CgAAIAdBsI0CakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsLIANFDQAgAUEJdEEQckGgiQJqQbCJAkGABPwKAAALAkAgBEEBSA0AIAhBASAIQQFKGyIDQQFxIQUCQCADQQFrIgdFBEBBACEBDAELIANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQbCJBmpBsIkCQYAE/AoAACAGQZAEckGwiQZqQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACwsgBQRAIAFBCXRBEHJBsIkGakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEFIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiBkEQckHAiQpqQbCJAkGABPwKAAAgBkGQBHJBwIkKakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAFBEAgAUECdEHAiQpqQbCJAkGABPwKAAALIARBAUgNACADQQFxIQUgBwR/IANB/v///wdxIQJBACEBA0AgAUEJdCIGQRByQdCJDmpBsIkCQYAE/AoAACAGQZAEckHQiQ5qQbCJAkGABPwKAAAgAUECaiEBIAJBAmsiAg0ACyABQQd0QQRyBUEECyEBIAUEQCABQQJ0QdCJDmpBsIkCQYAE/AoAAAsgBEEBSA0AIANBAXEhBSAHBH8gA0H+////B3EhAkEAIQEDQCABQQl0IgZBEHJB4IkSakGwiQJBgAT8CgAAIAZBkARyQeCJEmpBsIkCQYAE/AoAACABQQJqIQEgAkECayICDQALIAFBB3RBBHIFQQQLIQEgBQRAIAFBAnRB4IkSakGwiQJBgAT8CgAACyAEQQFIDQAgA0EBcSEEIAcEfyADQf7///8HcSECQQAhAQNAIAFBCXQiA0EQckHwiRZqQbCJAkGABPwKAAAgA0GQBHJB8IkWakGwiQJBgAT8CgAAIAFBAmohASACQQJrIgINAAsgAUEHdEEEcgVBBAshASAERQ0AIAFBAnRB8IkWakGwiQJBgAT8CgAAC0HUCCAIQQd0QQRyNgIAC58TAgh/AX5B5AgoAgAhA0HgCCgCACECQegIKAIAIQcgAUGQiQFqIglB/wE6AAAgACABSARAIABBkIkBaiEIA0AgAiEEIAhBAWohAQJAIAgtAABB/wBxIgJBMGtBCUsEQCABIQgMAQtB7AgoAgBBAnRB7AhqIgUoAgAhAANAIAUgAiAAQQpsakEwayIANgIAIAEtAAAhAiABQQFqIgghASACQf8AcSICQTBrQQpJDQALCwJAAkACQAJAAkACQAJ/AkAgAkE/ayIAQT9NBEAgBEUNASAEQSFGBEBB8AgoAgAiAUEBIAEbIgQgB2ohAQJAIABFDQAgB0H//wBLDQBBgIABIAdrIAQgAUH//wBLGyEFAkAgAEEBcUUNACAHQQJ0QaCJAmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEECcUUNACAHQQJ0QbCJBmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEEcUUNACAHQQJ0QcCJCmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEIcUUNACAHQQJ0QdCJDmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLAkAgAEEQcUUNACAHQQJ0QeCJEmohAiAFIgRBB3EiBgRAA0AgAiADNgIAIAJBBGohAiAEQQFrIQQgBkEBayIGDQALCyAFQQFrQQdJDQADQCACIAM2AhwgAiADNgIYIAIgAzYCFCACIAM2AhAgAiADNgIMIAIgAzYCCCACIAM2AgQgAiADNgIAIAJBIGohAiAEQQhrIgQNAAsLIABBIHFFDQAgBUEBayEEIAdBAnRB8IkWaiEAIAVBB3EiAgRAA0AgACADNgIAIABBBGohACAFQQFrIQUgAkEBayICDQALCyAEQQdJDQADQCAAIAM2AhwgACADNgIYIAAgAzYCFCAAIAM2AhAgACADNgIMIAAgAzYCCCAAIAM2AgQgACADNgIAIABBIGohACAFQQhrIgUNAAsLIAhBAWoiBSAILQAAQf8AcSICQT9rIgBBP00NAxoMBAsCQEHsCCgCACIFQQFGBEBB8AgoAgAiAUHMCCgCACIESQ0BIAEgBHAhAQwBC0H4CCgCACEEQfQIKAIAIQECQAJAIAVBBUcNACABQQFHDQAgBEHpAk4NBAwBCyAEQeQASg0DQfwIKAIAQeQASg0DQYAJKAIAQeQASg0DCwJAIAFFDQAgAUECSg0AIARB/AgoAgBBgAkoAgAgAUECdEGICGooAgARAgAhBEHwCCgCACIBQcwIKAIAIgVPBH8gASAFcAUgAQtBAnRBkAlqIAQ2AgALQfAIKAIAIgFBzAgoAgAiBEkNACABIARwIQELIAFBAnRBkAlqKAIAIQMMAQsgAkH9AHFBIUcEQCAHIQEgAiEADAQLIARBI0cNBAJAQewIKAIAIgRBAUYEQEHwCCgCACIBQcwIKAIAIgBJDQEgASAAcCEBDAELQfgIKAIAIQFB9AgoAgAhAAJAAkAgBEEFRw0AIABBAUcNACABQekCSA0BDAcLIAFB5ABKDQZB/AgoAgBB5ABKDQZBgAkoAgBB5ABKDQYLAkAgAEUNACAAQQJKDQAgAUH8CCgCAEGACSgCACAAQQJ0QYgIaigCABECACEAQfAIKAIAIgFBzAgoAgAiBE8EfyABIARwBSABC0ECdEGQCWogADYCAAtB8AgoAgAiAUHMCCgCACIASQ0AIAEgAHAhAQsgAUECdEGQCWooAgAhAwwECyAHIQEgCAshBQNAIAFB//8ATQRAIABBAXEgAWxBAnRBoIkCaiADNgIAIABBAXZBAXEgAWxBAnRBsIkGaiADNgIAIABBAnZBAXEgAWxBAnRBwIkKaiADNgIAIABBA3ZBAXEgAWxBAnRB0IkOaiADNgIAIABBBHZBAXEgAWxBAnRB4IkSaiADNgIAIABBBXYgAWxBAnRB8IkWaiADNgIACyABQQFqIQEgBS0AACEAIAVBAWoiBCEFIABB/wBxIgJBP2siAEHAAEkNAAsgBCEFC0EAIQQgBSEIIAEhByACIQAgAkH9AHFBIUYNAQtBBCEHIAQhAiAAQSRrDgoDAgICAgICAgIBAgtB7AhCATcCAAwCC0GoCCgCAEEEaxAABEBB0AhBATYCAA8LAkBBqAgoAgAiBkEFSA0AQaAIKQMAIQogBkEDa0EBdiIBQQdxIQJBACEAIAFBAWtBB08EQCABQfj///8HcSEFA0AgAEEDdCIBQbCJAmogCjcDACABQQhyQbCJAmogCjcDACABQRByQbCJAmogCjcDACABQRhyQbCJAmogCjcDACABQSByQbCJAmogCjcDACABQShyQbCJAmogCjcDACABQTByQbCJAmogCjcDACABQThyQbCJAmogCjcDACAAQQhqIQAgBUEIayIFDQALCyACRQ0AA0AgAEEDdEGwiQJqIAo3AwAgAEEBaiEAIAJBAWsiAg0ACwtBwIkGQbCJAiAGQQJ0IgD8CgAAQdCJCkGwiQIgAPwKAABB4IkOQbCJAiAA/AoAAEHwiRJBsIkCIAD8CgAAQYCKFkGwiQIgAPwKAAAgBCECDAELAkAgAEE7Rw0AQewIKAIAIgBBB0oNAEHsCCAAQQFqNgIAIABBAnRB8AhqQQA2AgALIAEhBwsgCCAJSQ0ACwtB5AggAzYCAEHgCCACNgIAQegIIAc2AgAL4gcCBX8BfgJAQdAIAn8CQAJAIAAgAU4NACABQZCJAWohBiAAQZCJAWohBQNAIAUtAAAiA0H/AHEhAgJAAkACQAJAAkACQAJAQeAIKAIAIgRBIkcEQCAEDQcgAkEiRgRAQewIQgE3AgBB4AhBIjYCAAwICyACQT9rQcAASQ0GIANBIWsiAkEMTQ0BDAULAkAgAkEwayIEQQlNBEBB7AgoAgBBAnRB7AhqIgIgBCACKAIAQQpsajYCAAwBC0HsCCgCACEEIAJBO0YEQCAEQQdKDQFB7AggBEEBajYCACAEQQJ0QfAIakEANgIADAELIARBBEYEQEHECEECNgIAQbAIQfAIKQMANwMAQbgIQfgIKAIAIgI2AgBBvAhB/AgoAgAiBDYCAEHICEECQQFBwAgoAgAiAxs2AgBBrAggBEEAIAMbNgIAQagIIAJBgIABIAJBgIABSBtBBGpBACADGzYCAEHgCEEANgIADAoLIAJBP2tBwABJDQQLIANBIWsiAkEMTQ0BDAILQQEgAnRBjSBxRQ0DDAQLQQEgAnRBjSBxDQELIANBoQFrIgJBDEsNA0EBIAJ0QY0gcUUNAwtBxAhCgYCAgBA3AgBBsAhB8AgoAgBBAEHsCCgCACICQQBKGzYCAEG0CEH0CCgCAEEAIAJBAUobNgIAQbgIQfgIKAIAQQAgAkECShs2AgBB4AhBADYCAEG8CEEANgIADAQLIANBoQFrIgJBDEsNAUEBIAJ0QY0gcUUNAQtBxAhCgYCAgBA3AgBBsAhCADcDAEG4CEIANwMADAMLIAVBAWoiBSAGSQ0ACwsCQEHICCgCAA4DAwEAAQsCQEGoCCgCACIFQQVIDQBBoAgpAwAhByAFQQNrQQF2IgNBB3EhBEEAIQIgA0EBa0EHTwRAIANB+P///wdxIQYDQCACQQN0IgNBsIkCaiAHNwMAIANBCHJBsIkCaiAHNwMAIANBEHJBsIkCaiAHNwMAIANBGHJBsIkCaiAHNwMAIANBIHJBsIkCaiAHNwMAIANBKHJBsIkCaiAHNwMAIANBMHJBsIkCaiAHNwMAIANBOHJBsIkCaiAHNwMAIAJBCGohAiAGQQhrIgYNAAsLIARFDQADQCACQQN0QbCJAmogBzcDACACQQFqIQIgBEEBayIEDQALC0HAiQZBsIkCIAVBAnQiA/wKAABB0IkKQbCJAiAD/AoAAEHgiQ5BsIkCIAP8CgAAQfCJEkGwiQIgA/wKAABBgIoWQbCJAiAD/AoAAEECDAELEAhByAgoAgALEAEiAjYCACACDQAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLdABB6AhBBDYCAEHkCCAANgIAQewIQgE3AgBBxAhCADcCAEHACCADNgIAQdwIQgA3AgBBqAhCADcDAEGwCEIANwMAQbgIQgA3AwBBzAggAkGAICACQYAgSRs2AgBBoAggAa1CgYCAgBB+NwMAQdAIQQA2AgALIwBB0AgoAgBFBEAgACABQcgIKAIAQQJ0QYAIaigCABEBAAsLWgECfwJAAkACQEHICCgCAEEBaw4CAAECC0HYCEHoCCgCACIAQdgIKAIAIgEgACABShsiAEGAgAEgAEGAgAFIGyIANgIAIABBBGsPC0GoCCgCAEEEayEACyAAC0IBAX8Cf0EGQdwIKAIAIgBBIHENABpBBSAAQRBxDQAaQQQgAEEIcQ0AGkEDIABBBHENABpBAiAAQQFxIABBAnEbCwu9BQEFfQJ/IAJFBEAgAUH/AWxBMmpB5ABtIgBBCHQgAHIgAEEQdHIMAQsgArJDAADIQpUhBiAAQfABarJDAAC0Q5UhBQJ9IAGyQwAAyEKVIgNDAAAAP10EQCADIAZDAACAP5KUDAELIAYgA0MAAIA/IAaTlJILIQcgAyADkiEGAkAgBUOrqqo+kiIEQwAAAABdBEAgBEMAAIA/kiEEDAELIARDAACAP15FDQAgBEMAAIC/kiEECyAGIAeTIQMgBUMAAAAAXSEAAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF`}})),db=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=lb(),n=ub();function r(e){if(typeof Buffer<`u`)return Buffer.from(e,`base64`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<n.length;++e)n[e]=t.charCodeAt(e);return n}var i=r(n.LIMITS.BYTES),a,o=new Uint32Array,s=class{constructor(){this.bandHandler=e=>1,this.modeHandler=e=>1}handle_band(e){return this.bandHandler(e)}mode_parsed(e){return this.modeHandler(e)}},c={memoryLimit:134217728,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:n.LIMITS.PALETTE_SIZE,truncate:!0};function l(e){let t=new s,n={env:{handle_band:t.handle_band.bind(t),mode_parsed:t.mode_parsed.bind(t)}};return WebAssembly.instantiate(a||i,n).then(n=>(a||=n.module,new u(e,n.instance||n,t)))}e.DecoderAsync=l;var u=class{constructor(e,r,s){if(this._PIXEL_OFFSET=n.LIMITS.MAX_WIDTH+4,this._canvas=o,this._bandWidths=[],this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},c,e),this._opts.paletteLimit>n.LIMITS.PALETTE_SIZE)throw Error(`DecoderOptions.paletteLimit must not exceed ${n.LIMITS.PALETTE_SIZE}`);if(r)s.bandHandler=this._handle_band.bind(this),s.modeHandler=this._initCanvas.bind(this);else{let e=a||=new WebAssembly.Module(i);r=new WebAssembly.Instance(e,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=r,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),n.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),n.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(e){if(e===2){let e=this.width*this.height;if(e>this._canvas.length){if(this._opts.memoryLimit&&e*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);this._canvas=new Uint32Array(e)}this._maxWidth=this._width}else if(e===1){if(this._level===2){let e=Math.min(this._rasterWidth,n.LIMITS.MAX_WIDTH)*this._rasterHeight;if(e>this._canvas.length){if(this._opts.memoryLimit&&e*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);this._canvas=new Uint32Array(e)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536))}return 0}_realloc(e,t){let n=e+t;if(n>this._canvas.length){if(this._opts.memoryLimit&&n*4>this._opts.memoryLimit)throw this.release(),Error(`image exceeds memory limit`);let e=new Uint32Array(Math.ceil(n/65536)*65536);e.set(this._canvas),this._canvas=e}}_handle_band(e){let t=this._PIXEL_OFFSET,n=this._lastOffset;if(this._mode===2){let r=this.height-this._currentHeight,i=0;for(;i<6&&r>0;)this._canvas.set(this._pSrc.subarray(t*i,t*i+e),n+e*i),i++,r--;this._lastOffset+=e*i,this._currentHeight+=i}else if(this._mode===1){this._realloc(n,e*6),this._maxWidth=Math.max(this._maxWidth,e),this._minWidth=Math.min(this._minWidth,e);for(let r=0;r<6;++r)this._canvas.set(this._pSrc.subarray(t*r,t*r+e),n+e*r);this._bandWidths.push(e),this._lastOffset+=e*6,this._currentHeight+=6}return 0}get width(){return this._mode===1?Math.max(this._maxWidth,this._wasm.current_width()):this._width}get height(){return this._mode===1?this._wasm.current_width()?this._bandWidths.length*6+this._wasm.current_height():this._bandWidths.length*6:this._height}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(e=this._opts.fillColor,t=this._opts.palette,r=this._opts.paletteLimit,i=this._opts.truncate){this._wasm.init(this._opts.sixelColor,e,r,+!!i),t&&this._palette.set(t.subarray(0,n.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(e,t=0,r=e.length){let i=t;for(;i<r;){let t=Math.min(r-i,n.LIMITS.CHUNK_SIZE);this._chunk.set(e.subarray(i,i+=t)),this._wasm.decode(0,t)}}decodeString(e,t=0,r=e.length){let i=t;for(;i<r;){let t=Math.min(r-i,n.LIMITS.CHUNK_SIZE);for(let n=0,r=i;n<t;++n,++r)this._chunk[n]=e.charCodeAt(r);i+=t,this._wasm.decode(0,t)}}get data32(){if(this._mode===0||!this.width||!this.height)return o;let e=this._wasm.current_width();if(this._mode===2){let t=this.height-this._currentHeight;if(t>0){let n=this._PIXEL_OFFSET,r=this._lastOffset,i=0;for(;i<6&&t>0;)this._canvas.set(this._pSrc.subarray(n*i,n*i+e),r+e*i),i++,t--;t&&this._canvas.fill(this._fillColor,r+e*i)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let t=!1;if(e){if(e!==this._minWidth)t=!0;else{let t=this._PIXEL_OFFSET,n=this._lastOffset;this._realloc(n,e*6);for(let r=0;r<6;++r)this._canvas.set(this._pSrc.subarray(t*r,t*r+e),n+e*r)}}if(!t)return this._canvas.subarray(0,this.width*this.height)}let t=new Uint32Array(this.width*this.height);t.fill(this._fillColor);let n=0,r=0;for(let e=0;e<this._bandWidths.length;++e){let i=this._bandWidths[e];for(let e=0;e<6;++e)t.set(this._canvas.subarray(r,r+=i),n),n+=this.width}if(e){let r=this._PIXEL_OFFSET,i=this._wasm.current_height();for(let a=0;a<i;++a)t.set(this._pSrc.subarray(r*a,r*a+e),n+this.width*a)}return t}return o}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=o,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=n.LIMITS.MAX_WIDTH,this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}};e.Decoder=u;function d(e,t){let n=new u(t);return n.init(),typeof e==`string`?n.decodeString(e):n.decode(e),{width:n.width,height:n.height,data32:n.data32,data8:n.data8}}e.decode=d;async function f(e,t){let n=await l(t);return n.init(),typeof e==`string`?n.decodeString(e):n.decode(e),{width:n.width,height:n.height,data32:n.data32,data8:n.data8}}e.decodeAsync=f})),fb=lb(),pb=db(),mb=fb.PALETTE_ANSI_256.slice();mb.set(fb.PALETTE_VT340_COLOR);var hb=200,gb=new TextEncoder,_b=`offsite-image:`;async function vb(e){let t=await(0,pb.decodeAsync)(e,{fillColor:0,palette:mb});return!t.width||!t.height?null:createImageBitmap(new ImageData(new Uint8ClampedArray(t.data8),t.width,t.height))}function yb(e,t,n){return e===void 0||e===`auto`?0:e.endsWith(`%`)?parseInt(e.slice(0,-1))*t/100:e.endsWith(`px`)?parseInt(e.slice(0,-2)):parseInt(e)*n}async function bb(e,t){let n=e.indexOf(`:`);if(n===-1)return null;let r=new Map(e.slice(0,n).split(`;`).map(e=>{let t=e.indexOf(`=`);return[e.slice(0,t),e.slice(t+1)]}));if(r.get(`inline`)!==`1`)return null;let i=Uint8Array.from(atob(e.slice(n+1)),e=>e.charCodeAt(0)),a=await createImageBitmap(new Blob([i])),o=yb(r.get(`width`),t.width,t.cellWidth),s=yb(r.get(`height`),t.height,t.cellHeight),c=[a.width,a.height];if(!o&&!s){let e=Math.min(t.width/a.width,(t.height-t.cellHeight)/a.height);e<1&&(c=[a.width*e,a.height*e])}else c=o?r.get(`preserveAspectRatio`)!==`0`||!s?[o,a.height*o/a.width]:[o,s]:[a.width*s/a.height,s];let[l,u]=c.map(e=>Math.max(1,Math.floor(e*t.pixelRatio))),d=await createImageBitmap(a,{resizeWidth:l,resizeHeight:u});return a.close(),d}function xb(e){let t=cb(e),{width:n,height:r,depth:i,channels:a}=t,o=n*r,s=new Uint8Array(o*4);if(t.palette){let e=Cee(t),i=t.palette[0].length;for(let t=0;t<o;t+=1)s.set(e.subarray(t*i,t*i+3),t*4),s[t*4+3]=i===4?e[t*i+3]:255;return{width:n,height:r,data:s}}let c=2**i-1,l=Math.ceil(n*i/8);function u(e){if(i>=8)return t.data[e];let r=e%n*i;return t.data[Math.floor(e/n)*l+(r>>3)]>>8-i-(r&7)&c}function d(e){return i===16?e>>8:i===8?e:Math.round(e*255/c)}let f=t.transparency;for(let e=0;e<o;e+=1){let t=e*4;if(a===1||a===2){let n=u(e*a);s.fill(d(n),t,t+3),s[t+3]=a===2?d(u(e*2+1)):f?.[0]===n?0:255}else if(a===3||a===4){let n=u(e*a),r=u(e*a+1),i=u(e*a+2);s[t]=d(n),s[t+1]=d(r),s[t+2]=d(i),s[t+3]=a===4?d(u(e*4+3)):f?.[0]===n&&f[1]===r&&f[2]===i?0:255}else throw Error(`unsupported PNG with ${a} channels`)}return{width:n,height:r,data:s}}var Sb=class{core;images=[];nextImage=0;constructor(e){this.core=e}place(e,t,n){let r=`${_b}${this.nextImage++}`;this.core.write(gb.encode(`\x1b]8;;${r}\x1b\\ \x1b]8;;\x1b\\\b`));let i={ref:this.core.trackCursor(),marker:r,bitmap:e,width:e.width/t,height:e.height/t,alternate:this.core.isAlternateScreen()};if(this.images.push(i),this.images.length>hb){let e=this.images.shift();e&&this.remove(e)}let a=Math.ceil(i.height/n);a>1&&this.core.write(gb.encode(`\x1BD`.repeat(a-1)))}visible(e,t,n){if(this.images.length===0)return[];let r=this.core.isAlternateScreen(),i=[],a=[];for(let o of this.images){if(o.alternate!==r){a.push(o);continue}let s=this.core.trackedPoint(o.ref);if(s===null||this.core.trackedHyperlink(o.ref)!==o.marker){this.remove(o);continue}a.push(o);let c=s.y-e;c+Math.ceil(o.height/n)<=0||c>=t||i.push({bitmap:o.bitmap,width:o.width,height:o.height,x:s.x,y:c})}return this.images=a,i}clear(){for(let e of this.images)this.remove(e);this.images=[]}remove(e){this.core.untrack(e.ref),e.bitmap.close()}},Cb=new Uint8Array([0,97,115,109,1,0,0,0,1,35,5,96,4,127,127,127,127,0,96,3,127,127,127,1,127,96,2,127,127,0,96,3,127,127,127,0,96,5,127,127,127,127,127,1,127,2,49,6,3,101,110,118,1,119,0,0,3,101,110,118,1,100,0,1,3,101,110,118,1,115,0,1,3,101,110,118,1,98,0,2,3,101,110,118,1,118,0,3,3,101,110,118,1,112,0,4,7,25,6,1,119,0,0,1,100,0,1,1,115,0,2,1,98,0,3,1,118,0,4,1,112,0,5]),wb={userdata:0,writePty:1,bell:2,xtversion:4,size:6,deviceAttributes:8},Tb=1,Eb=-3,Db={width:0,height:4,data:8,length:12},Ob=new TextDecoder,kb=new TextEncoder,Ab=class e{memory;layouts;exports;memoryView;hosts=new Map;nextHostId=1;callbacks={writePty:0,deviceAttributes:0,size:0,bell:0,xtversion:0};version={pointer:0,size:0};constructor(e){this.exports=e.exports;let t=e.exports.memory;if(!(t instanceof WebAssembly.Memory))throw Error(`libghostty-vt did not export its memory`);this.memory=t,this.memoryView=new DataView(t.buffer);let n=this.call(`ghostty_type_json`),r=new Uint8Array(t.buffer),i=n;for(;i<r.length&&r[i]!==0;)i+=1;this.layouts=JSON.parse(Ob.decode(r.subarray(n,i)))}static async load(){let t=await fetch(Vv);if(!t.ok)throw Error(`could not load libghostty-vt (${t.status})`);let n=null,r=await WebAssembly.instantiate(await t.arrayBuffer(),{env:{log:(e,t)=>{n&&console.debug(`[libghostty-vt]`,Ob.decode(new Uint8Array(n.buffer,e,t)))}}}),i=new e(r.instance);return n=i.memory,i.installCallbacks(),i}call(e,...t){let n=this.exports[e];if(typeof n!=`function`)throw Error(`libghostty-vt export is missing: ${e}`);return n(...t)}layout(e){let t=this.layouts[e];if(!t)throw Error(`libghostty-vt layout is missing: ${e}`);return t}field(e,t){let n=this.layout(e).fields[t];if(!n)throw Error(`libghostty-vt field is missing: ${e}.${t}`);return n}alloc(e){let t=this.call(`ghostty_wasm_alloc_u8_array`,e);if(t===0)throw Error(`libghostty-vt could not allocate ${e} bytes`);return new Uint8Array(this.memory.buffer,t,e).fill(0),t}free(e,t){e!==0&&this.call(`ghostty_wasm_free_u8_array`,e,t)}allocOpaque(){let e=this.call(`ghostty_wasm_alloc_opaque`);if(e===0)throw Error(`libghostty-vt could not allocate a pointer`);return new DataView(this.memory.buffer).setUint32(e,0,!0),e}freeOpaque(e){e!==0&&this.call(`ghostty_wasm_free_opaque`,e)}readPointer(e){return this.dataView().getUint32(e,!0)}check(e,t){if(t!==0)throw Error(`${e} failed with result ${t}`)}flag(e,t,n){let r=this.alloc(1),i=this.call(e,t,n,r),a=this.bytes(r,1)[0];return this.free(r,1),i===0&&a!==0}encodeOutput(e){let t=this.call(`ghostty_wasm_alloc_usize`),n=``,r=e(0,0,t),i=this.view(t,4).getUint32(0,!0);if(r===Eb&&i>0){let r=this.alloc(i),a=e(r,i,t),o=this.view(t,4).getUint32(0,!0);a===0&&(n=Ob.decode(this.bytes(r,o))),this.free(r,i)}return this.call(`ghostty_wasm_free_usize`,t),n}attachHost(e,t){let n=this.nextHostId++;this.hosts.set(n,t),this.call(`ghostty_terminal_set`,e,wb.userdata,n);for(let t of[[wb.writePty,this.callbacks.writePty],[wb.deviceAttributes,this.callbacks.deviceAttributes],[wb.size,this.callbacks.size],[wb.bell,this.callbacks.bell],[wb.xtversion,this.callbacks.xtversion]])this.call(`ghostty_terminal_set`,e,t[0],t[1]);return n}detachHost(e,t){this.call(`ghostty_terminal_set`,e,wb.xtversion,0),this.call(`ghostty_terminal_set`,e,wb.bell,0),this.call(`ghostty_terminal_set`,e,wb.size,0),this.call(`ghostty_terminal_set`,e,wb.deviceAttributes,0),this.call(`ghostty_terminal_set`,e,wb.writePty,0),this.call(`ghostty_terminal_set`,e,wb.userdata,0),this.hosts.delete(t)}view(e,t){return new DataView(this.memory.buffer,e,t)}bytes(e,t){return new Uint8Array(this.memory.buffer,e,t)}dataView(){return this.memoryView.buffer!==this.memory.buffer&&(this.memoryView=new DataView(this.memory.buffer)),this.memoryView}setField(e,t,n,r){let i=this.field(t,n),a=this.dataView(),o=e+i.offset;if(i.type===`bool`||i.type===`u8`)a.setUint8(o,r);else if(i.type===`u16`)a.setUint16(o,r,!0);else if(i.type===`i32`)a.setInt32(o,r,!0);else if(i.type===`u32`||i.type===`enum`)a.setUint32(o,r,!0);else if(i.type===`u64`)a.setBigUint64(o,BigInt(r),!0);else throw Error(`unsupported libghostty-vt field type ${i.type}`)}readField(e,t,n){let r=this.field(t,n),i=this.dataView(),a=e+r.offset;if(r.type===`bool`||r.type===`u8`)return i.getUint8(a);if(r.type===`u16`)return i.getUint16(a,!0);if(r.type===`i32`)return i.getInt32(a,!0);if(r.type===`u32`||r.type===`enum`)return i.getUint32(a,!0);if(r.type===`u64`)return Number(i.getBigUint64(a,!0));throw Error(`unsupported libghostty-vt field type ${r.type}`)}installCallbacks(){let e=new WebAssembly.Instance(new WebAssembly.Module(Cb),{env:{w:(e,t,n,r)=>{let i=this.hosts.get(t);i&&r!==0&&i.write(Ob.decode(new Uint8Array(this.memory.buffer,n,r)))},d:(e,t,n)=>this.hosts.has(t)?(this.writeDeviceAttributes(n),1):0,s:(e,t,n)=>{let r=this.hosts.get(t);if(!r)return 0;let i=r.size(),a=`GhosttySizeReportSize`;return this.setField(n,a,`rows`,i.rows),this.setField(n,a,`columns`,i.columns),this.setField(n,a,`cell_width`,i.cellWidth),this.setField(n,a,`cell_height`,i.cellHeight),1},b:(e,t)=>{this.hosts.get(t)?.bell()},v:(e,t,n)=>{let r=this.hosts.get(n);r&&this.writeVersion(e,r.version())},p:(e,t,n,r,i)=>this.decodePng(t,n,r,i)}}),t=this.exports.__indirect_function_table;if(!(t instanceof WebAssembly.Table))throw Error(`libghostty-vt did not expose its callback table`);let n=[`w`,`d`,`s`,`b`,`v`,`p`].map(n=>{let r=e.exports[n];if(typeof r!=`function`)throw Error(`libghostty-vt callback is missing: ${n}`);let i=t.length;return t.grow(1),t.set(i,r),i});if(this.callbacks={writePty:n[0],deviceAttributes:n[1],size:n[2],bell:n[3],xtversion:n[4]},this.call(`ghostty_sys_set`,Tb,n[5])!==0)throw Error(`libghostty-vt did not accept the PNG decoder`)}decodePng(e,t,n,r){let i;try{i=xb(new Uint8Array(this.memory.buffer,t,n))}catch(e){return console.warn(`could not decode a kitty PNG image`,e),0}let a=this.call(`ghostty_alloc`,e,i.data.length);if(a===0)return 0;this.bytes(a,i.data.length).set(i.data);let o=this.dataView();return o.setUint32(r+Db.width,i.width,!0),o.setUint32(r+Db.height,i.height,!0),o.setUint32(r+Db.data,a,!0),o.setUint32(r+Db.length,i.data.length,!0),1}writeVersion(e,t){let n=kb.encode(t);this.free(this.version.pointer,this.version.size);let r=this.alloc(n.length);this.bytes(r,n.length).set(n),this.version={pointer:r,size:n.length},this.dataView().setUint32(e+this.field(`GhosttyString`,`ptr`).offset,r,!0),this.setField(e,`GhosttyString`,`len`,n.length)}writeDeviceAttributes(e){let t=e+this.field(`GhosttyDeviceAttributes`,`primary`).offset,n=e+this.field(`GhosttyDeviceAttributes`,`secondary`).offset,r=e+this.field(`GhosttyDeviceAttributes`,`tertiary`).offset,i=`GhosttyDeviceAttributesPrimary`,a=`GhosttyDeviceAttributesSecondary`,o=t+this.field(i,`features`).offset,s=this.dataView(),c=[4,22];c.forEach((e,t)=>s.setUint16(o+t*2,e,!0)),this.setField(t,i,`conformance_level`,62),this.setField(t,i,`num_features`,c.length),this.setField(n,a,`device_type`,0),this.setField(n,a,`firmware_version`,276),this.setField(n,a,`rom_cartridge`,0),this.setField(r,`GhosttyDeviceAttributesTertiary`,`unit_id`,0)}},jb=null;async function Mb(){jb=await Ab.load()}function Nb(){if(!jb)throw Error(`libghostty-vt is not loaded`);return jb}var Pb=new Map(`Unidentified.Backquote.Backslash.BracketLeft.BracketRight.Comma.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Equal.IntlBackslash.IntlRo.IntlYen.KeyA.KeyB.KeyC.KeyD.KeyE.KeyF.KeyG.KeyH.KeyI.KeyJ.KeyK.KeyL.KeyM.KeyN.KeyO.KeyP.KeyQ.KeyR.KeyS.KeyT.KeyU.KeyV.KeyW.KeyX.KeyY.KeyZ.Minus.Period.Quote.Semicolon.Slash.AltLeft.AltRight.Backspace.CapsLock.ContextMenu.ControlLeft.ControlRight.Enter.MetaLeft.MetaRight.ShiftLeft.ShiftRight.Space.Tab.Convert.KanaMode.NonConvert.Delete.End.Help.Home.Insert.PageDown.PageUp.ArrowDown.ArrowLeft.ArrowRight.ArrowUp.NumLock.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadBackspace.NumpadClear.NumpadClearEntry.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEnter.NumpadEqual.NumpadMemoryAdd.NumpadMemoryClear.NumpadMemoryRecall.NumpadMemoryStore.NumpadMemorySubtract.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadSubtract.NumpadSeparator.NumpadArrowUp.NumpadArrowDown.NumpadArrowRight.NumpadArrowLeft.NumpadBegin.NumpadHome.NumpadEnd.NumpadInsert.NumpadDelete.NumpadPageUp.NumpadPageDown.Escape.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12.F13.F14.F15.F16.F17.F18.F19.F20.F21.F22.F23.F24.F25.Fn.FnLock.PrintScreen.ScrollLock.Pause.BrowserBack.BrowserFavorites.BrowserForward.BrowserHome.BrowserRefresh.BrowserSearch.BrowserStop.Eject.LaunchApp1.LaunchApp2.LaunchMail.MediaPlayPause.MediaSelect.MediaStop.MediaTrackNext.MediaTrackPrevious.Power.Sleep.AudioVolumeDown.AudioVolumeMute.AudioVolumeUp.WakeUp.Copy.Cut.Paste`.split(`.`).map((e,t)=>[e,t]));function Fb(e){return Pb.get(e)??0}var Ib=new Map([[`!`,`1`],[`@`,`2`],[`#`,`3`],[`$`,`4`],[`%`,`5`],[`^`,`6`],[`&`,`7`],[`*`,`8`],[`(`,`9`],[`)`,`0`],[`~`,"`"],[`_`,`-`],[`+`,`=`],[`{`,`[`],[`}`,`]`],[`|`,`\\`],[`:`,`;`],[`"`,`'`],[`<`,`,`],[`>`,`.`],[`?`,`/`]]),Lb;function Rb(){return Lb||(Lb=globalThis.navigator?.keyboard?.getLayoutMap().catch(()=>void 0)??Promise.resolve(void 0),Lb)}function zb(){return Lb=void 0,Rb()}function Bb(e){return!e.shiftKey||e.ctrlKey||e.altKey||e.metaKey?0:+([...e.key].length===1)}function Vb(e,t){if([...e.key].length!==1)return 0;let n=t?.get(e.code);if(n&&[...n].length===1)return n.codePointAt(0)??0;if(/^[A-Z]$/u.test(e.key))return e.key.charCodeAt(0)+32;if(e.shiftKey){let t=Ib.get(e.key);if(t)return t.codePointAt(0)??0;let n=e.key.toLowerCase();return n!==e.key&&[...n].length===1?n.codePointAt(0)??0:0}return e.key.codePointAt(0)??0}var Hb=new Map([[`Backquote`,"`"],[`Minus`,`-`],[`Equal`,`=`],[`BracketLeft`,`[`],[`BracketRight`,`]`],[`Backslash`,`\\`],[`Semicolon`,`;`],[`Quote`,`'`],[`Comma`,`,`],[`Period`,`.`],[`Slash`,`/`],[`Space`,` `]]),Ub=[...`0123456789`].map(e=>[`Digit${e}`,e]),Wb=new Map([...Ib].map(e=>[e[1],e[0]]));function Gb(e){return/^Key[A-Z]$/u.test(e)?e[3].toLowerCase():/^Digit[0-9]$/u.test(e)?e[5]:Hb.get(e)}function Kb(e){return[...Hb,...Ub].every(t=>t[0]===`Space`||e.get(t[0])===t[1])}function qb(e,t){let n=t?.get(e.code),r=n&&[...n].length===1?n:Gb(e.code);if(r===void 0)return[...e.key].length===1?null:e.key;if(!e.shiftKey)return r;let i=r.toUpperCase();return i!==r&&[...i].length===1?i:t===void 0||!Kb(t)?null:Wb.get(r)??r}var Jb=new TextEncoder,Yb=new Map([[`[`,`\x1B`],[`m`,`\r`],[`i`,` `],[`@`,`\0`]]),Xb=class{runtime=Nb();terminal;keyEncoderSlot;keyEncoder;keyEventSlot;keyEvent;mouseEncoderSlot;mouseEncoder;mouseEventSlot;mouseEvent;scratch;keyboardLayoutMap;constructor(e){let t=this.runtime;this.terminal=e,this.loadKeyboardLayout(Rb()),this.keyEncoderSlot=t.allocOpaque(),t.check(`ghostty_key_encoder_new`,t.call(`ghostty_key_encoder_new`,0,this.keyEncoderSlot)),this.keyEncoder=t.readPointer(this.keyEncoderSlot),this.keyEventSlot=t.allocOpaque(),t.check(`ghostty_key_event_new`,t.call(`ghostty_key_event_new`,0,this.keyEventSlot)),this.keyEvent=t.readPointer(this.keyEventSlot),this.mouseEncoderSlot=t.allocOpaque(),t.check(`ghostty_mouse_encoder_new`,t.call(`ghostty_mouse_encoder_new`,0,this.mouseEncoderSlot)),this.mouseEncoder=t.readPointer(this.mouseEncoderSlot),this.mouseEventSlot=t.allocOpaque(),t.check(`ghostty_mouse_event_new`,t.call(`ghostty_mouse_event_new`,0,this.mouseEventSlot)),this.mouseEvent=t.readPointer(this.mouseEventSlot),this.scratch=t.alloc(1)}encodeKey(e,t=`press`,n=!1){let r=this.runtime,i=e.key.toLowerCase(),a=Yb.get(i);if(a!==void 0&&t===`press`&&e.ctrlKey&&!e.altKey&&!e.metaKey&&!(e.shiftKey&&/^[a-z]$/u.test(i))&&!r.flag(`ghostty_terminal_get`,this.terminal,8))return a;let o=n?this.metaText(e):null,s=o??e.key;if(o!==null&&t===`press`&&!e.ctrlKey&&[...s].length===1&&(s.codePointAt(0)??0)>127&&r.flag(`ghostty_terminal_mode_get`,this.terminal,1036)&&this.isLegacyKeyboard())return`\x1b${s}`;r.call(`ghostty_key_encoder_setopt_from_terminal`,this.keyEncoder,this.terminal),r.call(`ghostty_key_event_set_action`,this.keyEvent,t===`release`?0:e.repeat?2:1),r.call(`ghostty_key_event_set_key`,this.keyEvent,Fb(e.code));let c=+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)|(e.getModifierState(`CapsLock`)?16:0)|(e.getModifierState(`NumLock`)?32:0);r.call(`ghostty_key_event_set_mods`,this.keyEvent,c),r.call(`ghostty_key_event_set_consumed_mods`,this.keyEvent,Bb(e)),r.call(`ghostty_key_event_set_composing`,this.keyEvent,+!!e.isComposing),r.call(`ghostty_key_event_set_unshifted_codepoint`,this.keyEvent,Vb({code:e.code,key:s,shiftKey:e.shiftKey},this.keyboardLayoutMap));let l=Jb.encode(s.length===1?s:``),u=l.length===0?0:r.alloc(l.length);u!==0&&r.bytes(u,l.length).set(l),r.call(`ghostty_key_event_set_utf8`,this.keyEvent,u,l.length);let d=r.encodeOutput((e,t,n)=>r.call(`ghostty_key_encoder_encode`,this.keyEncoder,this.keyEvent,e,t,n));return u!==0&&r.free(u,l.length),d}metaText(e){return qb(e,this.keyboardLayoutMap)}refreshKeyboardLayout(){this.loadKeyboardLayout(zb())}encodePaste(e){let t=this.runtime,n=Jb.encode(e);if(n.length===0)return``;let r=t.alloc(n.length);t.bytes(r,n.length).set(n);let i=+!!t.flag(`ghostty_terminal_mode_get`,this.terminal,2004),a=t.encodeOutput((e,a,o)=>t.call(`ghostty_paste_encode`,r,n.length,i,e,a,o));return t.free(r,n.length),a}encodeMouse(e){let t=this.runtime;t.call(`ghostty_mouse_encoder_setopt_from_terminal`,this.mouseEncoder,this.terminal);let n=t.layout(`GhosttyMouseEncoderSize`),r=t.alloc(n.size);for(let i of[[`size`,n.size],[`screen_width`,e.screenWidth],[`screen_height`,e.screenHeight],[`cell_width`,e.cellWidth],[`cell_height`,e.cellHeight],[`padding_top`,0],[`padding_bottom`,0],[`padding_right`,0],[`padding_left`,0]])t.setField(r,`GhosttyMouseEncoderSize`,i[0],Math.max(0,Math.round(i[1])));t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,2,r),t.free(r,n.size),t.bytes(this.scratch,1)[0]=+!!e.anyButtonPressed,t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,3,this.scratch),t.bytes(this.scratch,1)[0]=1,t.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,4,this.scratch),t.call(`ghostty_mouse_event_set_action`,this.mouseEvent,{press:0,release:1,motion:2}[e.action]),e.button===null?t.call(`ghostty_mouse_event_clear_button`,this.mouseEvent):t.call(`ghostty_mouse_event_set_button`,this.mouseEvent,e.button),t.call(`ghostty_mouse_event_set_mods`,this.mouseEvent,e.mods);let i=t.layout(`GhosttyMousePosition`),a=t.alloc(i.size),o=t.view(a,i.size);return o.setFloat32(t.field(`GhosttyMousePosition`,`x`).offset,e.x,!0),o.setFloat32(t.field(`GhosttyMousePosition`,`y`).offset,e.y,!0),t.call(`ghostty_mouse_event_set_position`,this.mouseEvent,a),t.free(a,i.size),t.encodeOutput((e,n,r)=>t.call(`ghostty_mouse_encoder_encode`,this.mouseEncoder,this.mouseEvent,e,n,r))}dispose(){let e=this.runtime;e.call(`ghostty_mouse_event_free`,this.mouseEvent),e.call(`ghostty_mouse_encoder_free`,this.mouseEncoder),e.call(`ghostty_key_event_free`,this.keyEvent),e.call(`ghostty_key_encoder_free`,this.keyEncoder),e.free(this.scratch,1),e.freeOpaque(this.mouseEventSlot),e.freeOpaque(this.mouseEncoderSlot),e.freeOpaque(this.keyEventSlot),e.freeOpaque(this.keyEncoderSlot)}async loadKeyboardLayout(e){this.keyboardLayoutMap=await e}isLegacyKeyboard(){return this.encodeKey(new KeyboardEvent(`keydown`,{key:`Tab`,code:`Tab`,shiftKey:!0}))===`\x1B[Z`}},Zb=26,Qb=30,$b=1,ex={imageId:1,placementId:2,isVirtual:3,xOffset:4,yOffset:5,columns:10,rows:11,z:12},tx={width:3,height:4,format:5,data:7,length:8},nx={size:48,pixelWidth:4,pixelHeight:8,column:20,row:24,visible:28,sourceX:32,sourceY:36,sourceWidth:40,sourceHeight:44},rx=new Map([[0,3],[1,4],[3,2],[4,1]]),ix=new Map([773,781,782,784,786,829,830,831,838,842,843,844,848,849,850,855,859,867,868,869,870,871,872,873,874,875,876,877,878,879,1155,1156,1157,1158,1159,1426,1427,1428,1429,1431,1432,1433,1436,1437,1438,1439,1440,1441,1448,1449,1451,1452,1455,1476,1552,1553,1554,1555,1556,1557,1558,1559,1623,1624,1625,1626,1627,1629,1630,1750,1751,1752,1753,1754,1755,1756,1759,1760,1761,1762,1764,1767,1768,1771,1772,1840,1842,1843,1845,1846,1850,1853,1855,1856,1857,1859,1861,1863,1865,1866,2027,2028,2029,2030,2031,2032,2033,2035,2070,2071,2072,2073,2075,2076,2077,2078,2079,2080,2081,2082,2083,2085,2086,2087,2089,2090,2091,2092,2093,2385,2387,2388,3970,3971,3974,3975,4957,4958,4959,6109,6458,6679,6773,6774,6775,6776,6777,6778,6779,6780,7019,7021,7022,7023,7024,7025,7026,7027,7376,7377,7378,7386,7387,7392,7616,7617,7619,7620,7621,7622,7623,7624,7625,7627,7628,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7678,8400,8401,8404,8405,8406,8407,8411,8412,8417,8423,8425,8432,11503,11504,11505,11744,11745,11746,11747,11748,11749,11750,11751,11752,11753,11754,11755,11756,11757,11758,11759,11760,11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,42607,42620,42621,42736,42737,43232,43233,43234,43235,43236,43237,43238,43239,43240,43241,43242,43243,43244,43245,43246,43247,43248,43249,43696,43698,43699,43703,43704,43710,43711,43713,65056,65057,65058,65059,65060,65061,65062,68111,68152,119173,119174,119175,119176,119177,119210,119211,119212,119213,119362,119363,119364].map((e,t)=>[e,t]));function ax(e,t,n){let r=Array.from(e).slice(1,4).map(e=>ix.get(e.codePointAt(0)??0)??null),i=r[2]??null;return{imageId:t,placementId:n,row:r[0]??null,column:r[1]??null,imageIdHigh:i!==null&&i<256?i:null}}function ox(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n].cells,i=null;for(let e=0;e<r.length;e+=1){let a=r[e].placeholder;i!==null&&a!==null&&a.imageId===i.imageId&&a.placementId===i.placementId&&(a.row===null||a.row===i.row)&&(a.column===null||a.column===i.column+i.width)&&(a.imageIdHigh===null||a.imageIdHigh===i.imageIdHigh)?i.width+=1:(i!==null&&t.push(sx(i)),i=a===null?null:{x:e,y:n,imageId:a.imageId,imageIdHigh:a.imageIdHigh,placementId:a.placementId,row:a.row??0,column:a.column??0,width:1})}i!==null&&t.push(sx(i))}return t}function sx(e){return{x:e.x,y:e.y,imageId:e.imageId+(e.imageIdHigh??0)*2**24,placementId:e.placementId,row:e.row,column:e.column,width:e.width}}function cx(e,t,n,r){let i=t.columns===0?Math.ceil(n.width/r.width):t.columns,a=t.rows===0?Math.ceil(n.height/r.height):t.rows,o=i*r.width,s=a*r.height,c=n.width*s>n.height*o,l=c?o/Math.max(n.width,1):s/Math.max(n.height,1),u=c?0:(o-n.width*l)/2/l,d=c?(s-n.height*l)/2/l:0,f=n.width+u*2,p=n.height+d*2,m={x:f*e.column/i,y:p*e.row/a,width:f*e.width/i,height:p/a},h=0,g=0,_=e.width*r.width,v=r.height;if(m.y<d){let e=d-m.y;m.height-=e,g=e,v-=e*l,m.y=0,m.height>n.height&&(m.height=n.height,v=n.height*l)}else m.y+m.height>p-d?(m.y-=d,m.height=p-d-m.y-d,v=m.height*l):m.y-=d;if(m.x<u){let e=u-m.x;m.width-=e,h=e,_-=e*l,m.x=0,m.width>n.width&&(m.width=n.width,_=n.width*l)}else m.x+m.width>f-u?(m.x-=u,m.width=f-u-m.x-u,_=m.width*l):m.x-=u;if(m.width<=0||m.height<=0)return null;let y={xOffset:Math.round(h*l),yOffset:Math.round(g*l),width:Math.round(_),height:Math.round(v),source:{x:Math.round(m.x),y:Math.round(m.y),width:Math.round(m.width),height:Math.round(m.height)}};return y.width===0||y.height===0?null:y}function lx(e){let t=Nb(),n=t.alloc(16),r=t.call(`ghostty_terminal_get`,e,Zb,n);return t.free(n,16),r===0}var ux=class{runtime=Nb();terminal;iteratorSlot;info;scratch;tail=[0,0];commands=0;cachedCommands=0;bitmaps=new Map;constructor(e){let t=this.runtime;this.terminal=e,this.iteratorSlot=t.allocOpaque(),t.check(`ghostty_kitty_graphics_placement_iterator_new`,t.call(`ghostty_kitty_graphics_placement_iterator_new`,0,this.iteratorSlot)),this.info=t.alloc(nx.size),this.scratch=t.alloc(16)}note(e){let t=[...this.tail,...e.subarray(0,2)],n=t.some((e,n)=>e===27&&t[n+1]===95&&t[n+2]===71),r=e.indexOf(27);for(;!n&&r!==-1;)n=e[r+1]===95&&e[r+2]===71,r=e.indexOf(27,r+1);n&&(this.commands+=1),this.tail=[...this.tail,...e.subarray(-2)].slice(-2)}images(e,t){this.commands!==this.cachedCommands&&(this.cachedCommands=this.commands,this.bitmaps.clear());let n=new Map,r=this.placements(e,t).map(e=>{let t=n.get(e.key)??this.bitmaps.get(e.key)??px(e.image);return n.set(e.key,t),{placement:e,bitmap:t}});return this.bitmaps=n,r}dispose(){let e=this.runtime;e.call(`ghostty_kitty_graphics_placement_iterator_free`,e.readPointer(this.iteratorSlot)),e.free(this.info,nx.size),e.free(this.scratch,16),e.freeOpaque(this.iteratorSlot),this.bitmaps.clear()}placements(e,t){let n=this.runtime;n.check(`ghostty_terminal_get`,n.call(`ghostty_terminal_get`,this.terminal,Qb,this.scratch));let r=n.readPointer(this.scratch);n.check(`ghostty_kitty_graphics_get`,n.call(`ghostty_kitty_graphics_get`,r,$b,this.iteratorSlot));let i=n.readPointer(this.iteratorSlot),a=[],o=[];for(;n.call(`ghostty_kitty_graphics_placement_next`,i);){let e=this.placementU32(i,ex.imageId);if(this.placementData(i,ex.isVirtual).getUint8(0)){o.push({imageId:e,placementId:this.placementU32(i,ex.placementId),columns:this.placementU32(i,ex.columns),rows:this.placementU32(i,ex.rows)});continue}let t=n.call(`ghostty_kitty_graphics_image`,r,e);if(t===0)throw Error(`kitty placement points to missing image ${e}`);n.bytes(this.info,nx.size).fill(0);let s=n.view(this.info,nx.size);s.setUint32(0,nx.size,!0),n.check(`ghostty_kitty_graphics_placement_render_info`,n.call(`ghostty_kitty_graphics_placement_render_info`,i,t,this.terminal,this.info)),s.getUint8(nx.visible)!==0&&a.push({...this.image(t,e),z:this.placementData(i,ex.z).getInt32(0,!0),column:s.getInt32(nx.column,!0),row:s.getInt32(nx.row,!0),xOffset:this.placementU32(i,ex.xOffset),yOffset:this.placementU32(i,ex.yOffset),width:s.getUint32(nx.pixelWidth,!0),height:s.getUint32(nx.pixelHeight,!0),source:{x:s.getUint32(nx.sourceX,!0),y:s.getUint32(nx.sourceY,!0),width:s.getUint32(nx.sourceWidth,!0),height:s.getUint32(nx.sourceHeight,!0)}})}if(o.length===0)return a;for(let i of ox(e)){let e=o.find(e=>e.imageId===i.imageId&&(i.placementId===0||e.placementId===i.placementId));if(e===void 0)continue;let s=n.call(`ghostty_kitty_graphics_image`,r,i.imageId);if(s===0)continue;let c=this.image(s,i.imageId),l=cx(i,e,c.image,t);l!==null&&a.push({...c,...l,z:-1,column:i.x,row:i.y})}return a}image(e,t){let n=this.imageData(e,tx.data),r=this.imageData(e,tx.length);return{key:`${t}:${n}:${r}`,image:{width:this.imageData(e,tx.width),height:this.imageData(e,tx.height),format:this.imageData(e,tx.format),pixels:this.runtime.bytes(n,r)}}}placementData(e,t){return this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_kitty_graphics_placement_get`,this.runtime.call(`ghostty_kitty_graphics_placement_get`,e,t,this.scratch)),this.runtime.view(this.scratch,4)}placementU32(e,t){return this.placementData(e,t).getUint32(0,!0)}imageData(e,t){return this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_kitty_graphics_image_get`,this.runtime.call(`ghostty_kitty_graphics_image_get`,e,t,this.scratch)),this.runtime.view(this.scratch,4).getUint32(0,!0)}};function dx(e,t,n,r,i){let a=r.width/i.width,o=r.height/i.height;for(let i of t){let t=i.placement;fx(t.z)===n&&e.drawImage(i.bitmap,t.source.x,t.source.y,t.source.width,t.source.height,t.column*r.width+t.xOffset*a,t.row*r.height+t.yOffset*o,t.width*a,t.height*o)}}function fx(e){return e<-1073741824?`belowBackground`:e<0?`belowText`:`aboveText`}function px(e){let t=rx.get(e.format);if(t===void 0)throw Error(`unsupported kitty image format ${e.format}`);let n=e.width*e.height,r=e.pixels,i=new Uint8ClampedArray(n*4);if(t===4)i.set(r.subarray(0,n*4));else for(let e=0;e<n;e+=1){let n=e*t,a=e*4;t===3?i.set(r.subarray(n,n+3),a):i.fill(r[n],a,a+3),i[a+3]=t===2?r[n+1]:255}let a=new OffscreenCanvas(e.width,e.height),o=a.getContext(`2d`);if(!o)throw Error(`could not create a canvas for a kitty image`);return o.putImageData(new ImageData(i,e.width,e.height),0,0),a}var mx=8,hx=16,gx=0,_x=1,vx=2,yx=8,bx={cols:1,rows:2,dirty:3,rowIterator:4,background:5,foreground:6,cursor:7,cursorHasValue:8,cursorStyle:10,cursorVisible:11,cursorBlinking:12,cursorInViewport:14,cursorX:15,cursorY:16},xx={dirty:1,raw:2,cells:3},Sx={raw:1,style:2,graphemesLength:3,graphemes:4,background:5,foreground:6,selected:7},Cx={keys:0,values:20,graphemesLength:40,selected:44,background:48,foreground:52,written:56,size:60},wx={narrow:0,wide:1,spacerTail:2},Tx={r:229,g:231,b:235},Ex={r:0,g:0,b:0};function Dx(e,t){return Math.floor((e*155+t*100)/255)}function Ox(e,t){return{r:Dx(e.r,t.r),g:Dx(e.g,t.g),b:Dx(e.b,t.b)}}function kx(e,t){let n=``;for(let r=0;r<t;r+=4096){let i=Math.min(4096,t-r),a=Array(i);for(let t=0;t<i;t+=1)a[t]=e.getUint32((r+t)*4,!0);n+=String.fromCodePoint(...a)}return n}function Ax(e,t){return{text:``,wide:0,foreground:e,background:t,bold:!1,italic:!1,invisible:!1,strikethrough:!1,overline:!1,underline:0,underlineColor:null,selected:!1,placeholder:null}}function jx(e,t){let n=e.dataView();return{r:n.getUint8(t),g:n.getUint8(t+1),b:n.getUint8(t+2)}}function Mx(e,t){let n=e.alloc(768);e.call(`ghostty_terminal_get`,t,21,n);let r=e.bytes(n,768),i=Array.from({length:256},(e,t)=>({r:r[t*3],g:r[t*3+1],b:r[t*3+2]}));return e.free(n,768),i}function Nx(e,t){let n=[],r=[];return e.cells.forEach((e,i)=>{if(e.wide!==2)for(let a of(e.text||` `).split(``))n.push(a),r.push({x:i,y:t})}),{text:n.join(``),points:r}}var Px=class{runtime=Nb();stateSlot;state;rowIteratorSlot;rowCellsSlot;scratch;style;cellQuery;graphemes=0;graphemeCapacity=0;rows=[];palette=[];constructor(){let e=this.runtime;this.stateSlot=e.allocOpaque(),e.check(`ghostty_render_state_new`,e.call(`ghostty_render_state_new`,0,this.stateSlot)),this.state=e.readPointer(this.stateSlot),this.rowIteratorSlot=e.allocOpaque(),e.check(`ghostty_render_state_row_iterator_new`,e.call(`ghostty_render_state_row_iterator_new`,0,this.rowIteratorSlot)),this.rowCellsSlot=e.allocOpaque(),e.check(`ghostty_render_state_row_cells_new`,e.call(`ghostty_render_state_row_cells_new`,0,this.rowCellsSlot)),this.scratch=e.alloc(16),this.style=e.alloc(e.layout(`GhosttyStyle`).size),this.cellQuery=e.alloc(Cx.size);let t=e.dataView();[[Sx.style,this.style],[Sx.graphemesLength,this.cellQuery+Cx.graphemesLength],[Sx.selected,this.cellQuery+Cx.selected],[Sx.background,this.cellQuery+Cx.background],[Sx.foreground,this.cellQuery+Cx.foreground]].forEach((e,n)=>{t.setUint32(this.cellQuery+Cx.keys+n*4,e[0],!0),t.setUint32(this.cellQuery+Cx.values+n*4,e[1],!0)})}snapshot(e,t){let n=this.runtime;n.check(`ghostty_render_state_update`,n.call(`ghostty_render_state_update`,this.state,e));let r=this.getRender(bx.cols,2),i=this.getRender(bx.rows,2),a=this.getRender(bx.dirty,4),o=this.getColor(bx.foreground,Tx),s=this.getColor(bx.background,Ex),c=this.getRender(bx.cursorHasValue,1)===0?o:this.getColor(bx.cursor,o),l=this.getRender(bx.cursorInViewport,1)!==0,u=this.getRender(bx.cursorVisible,1)!==0&&l;(this.rows.length!==i||this.rows.some(e=>e.cells.length!==r))&&(this.rows=Array.from({length:i},()=>({cells:Array.from({length:r},()=>Ax(o,s)),isWrapContinuation:!1,wrapsToNext:!1})));let d=new Set;if(a!==0){this.palette=Mx(n,e),n.check(`ghostty_render_state_get`,n.call(`ghostty_render_state_get`,this.state,bx.rowIterator,this.rowIteratorSlot));let c=n.readPointer(this.rowIteratorSlot),l=0;for(;l<i&&n.call(`ghostty_render_state_row_iterator_next`,c)!==0;)(a===2||this.getRowFlag(c,xx.dirty))&&(this.rows[l]=this.readRow(c,r,o,s,t),d.add(l),n.bytes(this.scratch,1)[0]=0,n.call(`ghostty_render_state_row_set`,c,0,this.scratch)),l+=1;n.view(this.scratch,4).setUint32(0,0,!0),n.call(`ghostty_render_state_set`,this.state,0,this.scratch)}return{cols:r,rows:i,foreground:o,background:s,cursor:c,cursorX:l?this.getRender(bx.cursorX,2):-1,cursorY:l?this.getRender(bx.cursorY,2):-1,cursorVisible:u,cursorBlinking:this.getRender(bx.cursorBlinking,1)!==0,cursorStyle:this.getRender(bx.cursorStyle,4),dirtyRows:d,rowData:this.rows}}invalidate(){this.rows=[]}dispose(){let e=this.runtime,t=e.readPointer(this.rowCellsSlot);t&&e.call(`ghostty_render_state_row_cells_free`,t);let n=e.readPointer(this.rowIteratorSlot);n&&e.call(`ghostty_render_state_row_iterator_free`,n),e.call(`ghostty_render_state_free`,this.state),e.free(this.style,e.layout(`GhosttyStyle`).size),e.free(this.cellQuery,Cx.size),e.free(this.scratch,16),e.free(this.graphemes,this.graphemeCapacity),e.freeOpaque(this.rowCellsSlot),e.freeOpaque(this.rowIteratorSlot),e.freeOpaque(this.stateSlot)}readRow(e,t,n,r,i){let a=this.runtime;a.check(`ghostty_render_state_row_get`,a.call(`ghostty_render_state_row_get`,e,xx.raw,this.scratch));let o=a.view(this.scratch,8).getBigUint64(0,!0);a.bytes(this.scratch+8,1)[0]=0,a.call(`ghostty_row_get`,o,2,this.scratch+8);let s=a.bytes(this.scratch+8,1)[0]!==0;a.bytes(this.scratch+8,1)[0]=0,a.call(`ghostty_row_get`,o,1,this.scratch+8);let c=a.bytes(this.scratch+8,1)[0]!==0;a.check(`ghostty_render_state_row_get`,a.call(`ghostty_render_state_row_get`,e,xx.cells,this.rowCellsSlot));let l=a.readPointer(this.rowCellsSlot),u=a.layout(`GhosttyStyle`),d=u.size,f=u.fields,p=[];for(;p.length<t&&a.call(`ghostty_render_state_row_cells_next`,l)!==0;){a.bytes(this.style,d).fill(0),a.setField(this.style,`GhosttyStyle`,`size`,d);let e=a.call(`ghostty_render_state_row_cells_get_multi`,l,5,this.cellQuery+Cx.keys,this.cellQuery+Cx.values,this.cellQuery+Cx.written),t=a.dataView(),o=t.getUint32(this.cellQuery+Cx.written,!0);o<3&&a.check(`ghostty_render_state_row_cells_get_multi`,e);let s=t.getUint32(this.cellQuery+Cx.graphemesLength,!0),c=t.getUint8(this.cellQuery+Cx.selected)!==0,u=o>=4?jx(a,this.cellQuery+Cx.background):r,m=o===5?jx(a,this.cellQuery+Cx.foreground):o===3?this.getCellColor(l,n):n,h=``;if(s>0){let e=s*4;if(e>this.graphemeCapacity){let t=Math.max(e,this.graphemeCapacity*2),n=a.alloc(t);a.free(this.graphemes,this.graphemeCapacity),this.graphemes=n,this.graphemeCapacity=t}a.call(`ghostty_render_state_row_cells_get`,l,Sx.graphemes,this.graphemes)===0&&(h=kx(a.view(this.graphemes,e),s))}let g=0;if(h.length===0&&p.at(-1)?.text.length){a.call(`ghostty_render_state_row_cells_get`,l,Sx.raw,this.scratch);let e=a.view(this.scratch,8).getBigUint64(0,!0);a.view(this.scratch+8,4).setUint32(0,0,!0),a.call(`ghostty_cell_get`,e,3,this.scratch+8),g=a.view(this.scratch+8,4).getUint32(0,!0)}let _=a.dataView(),v=e=>_.getUint8(this.style+f[e].offset)!==0,y=v(`bold`);if(i&&y&&_.getUint32(this.style+mx,!0)===_x){let e=_.getUint8(this.style+hx);e<8&&(m=this.palette[e+8]??m)}if(v(`inverse`)){let e=m;m=u,u=e}v(`faint`)&&(m=Ox(m,u));let b=this.style+f.underline_color.offset,x=_.getUint32(b,!0),S=b+yx,C=null;h.codePointAt(0)===1109742&&(C=ax(h,this.colorId(this.style+mx),this.colorId(b)),h=``),p.push({text:h,wide:g,foreground:m,background:u,bold:y,italic:v(`italic`),invisible:v(`invisible`),strikethrough:v(`strikethrough`),overline:v(`overline`),underline:_.getInt32(this.style+f.underline.offset,!0),underlineColor:x===_x?this.palette[_.getUint8(S)]:x===vx?jx(a,S):null,selected:c,placeholder:C})}for(;p.length<t;)p.push(Ax(n,r));return{cells:p,isWrapContinuation:s,wrapsToNext:c}}getRender(e,t){this.runtime.bytes(this.scratch,4).fill(0),this.runtime.check(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.state,e,this.scratch));let n=this.runtime.view(this.scratch,4);return t===1?n.getUint8(0):t===2?n.getUint16(0,!0):n.getUint32(0,!0)}getColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_get`,this.state,e,this.scratch)===0?jx(this.runtime,this.scratch):t}getRowFlag(e,t){return this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_render_state_row_get`,e,t,this.scratch)===0&&this.runtime.bytes(this.scratch,1)[0]!==0}getCellColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_row_cells_get`,e,Sx.foreground,this.scratch)===0?jx(this.runtime,this.scratch):t}colorId(e){let t=this.runtime.dataView(),n=t.getUint32(e,!0);if(n===gx)return 0;if(n===_x)return t.getUint8(e+yx);if(n===vx){let t=jx(this.runtime,e+yx);return t.r<<16|t.g<<8|t.b}throw Error(`unknown style color tag ${n}`)}},Fx=16,Ix=589824,Lx=381888,Rx=5e7,zx=new TextDecoder;function Bx(e){let t=[...e],n=[0,95,135,175,215,255];for(let e=16;e<232;e+=1){let r=e-16;t.push({r:n[Math.floor(r/36)],g:n[Math.floor(r/6)%6],b:n[r%6]})}for(let e=0;e<24;e+=1){let n=8+e*10;t.push({r:n,g:n,b:n})}return t}var Vx=class{encoder;kitty;runtime=Nb();terminalSlot;terminal;renderState;formatterSlot;formatter;scratch;point;scrollbar;host;hostId=0;sizeReport;disposed=!1;boldIsBright=!1;version=``;constructor(e,t,n,r,i){let a=this.runtime,o=a.layout(`GhosttyTerminalOptions`).size,s=a.alloc(o);a.setField(s,`GhosttyTerminalOptions`,`cols`,e),a.setField(s,`GhosttyTerminalOptions`,`rows`,t);let c=Math.floor(Lx/(8*(e+1)));a.setField(s,`GhosttyTerminalOptions`,`max_scrollback`,n===0?0:Math.min((Math.ceil(n/c)+1)*Ix,Rx)),this.terminalSlot=a.allocOpaque();let l=a.call(`ghostty_terminal_new`,0,this.terminalSlot,s);if(a.free(s,o),a.check(`ghostty_terminal_new`,l),this.terminal=a.readPointer(this.terminalSlot),!lx(this.terminal))throw a.call(`ghostty_terminal_free`,this.terminal),a.freeOpaque(this.terminalSlot),Error(`libghostty-vt was built without kitty graphics, build it with scripts/build-ghostty-wasm.mts`);this.sizeReport={rows:t,columns:e,cellWidth:1,cellHeight:1},this.host={write:r,size:()=>this.sizeReport,bell:i,version:()=>this.version},this.hostId=a.attachHost(this.terminal,this.host),this.renderState=new Px,this.encoder=new Xb(this.terminal),this.kitty=new ux(this.terminal);let u=`GhosttyFormatterTerminalOptions`,d=a.layout(u),f=a.alloc(d.size),p=a.field(u,`extra`),m=a.field(`GhosttyFormatterTerminalExtra`,`screen`);a.setField(f,u,`size`,d.size),a.setField(f,u,`trim`,1),a.setField(f+p.offset,`GhosttyFormatterTerminalExtra`,`size`,p.size),a.setField(f+p.offset+m.offset,`GhosttyFormatterScreenExtra`,`size`,m.size),this.formatterSlot=a.allocOpaque();let h=a.call(`ghostty_formatter_terminal_new`,0,this.formatterSlot,this.terminal,f);a.free(f,d.size),a.check(`ghostty_formatter_terminal_new`,h),this.formatter=a.readPointer(this.formatterSlot),this.scratch=a.alloc(16),this.point=a.alloc(a.layout(`GhosttyPoint`).size),this.scrollbar=a.alloc(a.layout(`GhosttyTerminalScrollbar`).size)}write(e){if(e.length===0)return;this.kitty.note(e);let t=this.runtime.alloc(e.length);this.runtime.bytes(t,e.length).set(e),this.runtime.call(`ghostty_terminal_vt_write`,this.terminal,t,e.length),this.runtime.free(t,e.length)}setReplies(e){e&&this.hostId===0?this.hostId=this.runtime.attachHost(this.terminal,this.host):!e&&this.hostId!==0&&(this.runtime.detachHost(this.terminal,this.hostId),this.hostId=0)}reset(){this.runtime.call(`ghostty_terminal_reset`,this.terminal),this.renderState.invalidate()}resize(e,t,n,r,i){this.sizeReport={rows:t,columns:e,cellWidth:Math.max(1,Math.round(n*i)),cellHeight:Math.max(1,Math.round(r*i))},this.runtime.check(`ghostty_terminal_resize`,this.runtime.call(`ghostty_terminal_resize`,this.terminal,Math.max(1,Math.min(65535,e)),Math.max(1,Math.min(65535,t)),this.sizeReport.cellWidth,this.sizeReport.cellHeight))}setColors(e){let t=this.runtime.alloc(3);for(let n of[[11,e.foreground],[12,e.background],[13,e.cursor]]){let e=n[1];this.runtime.bytes(t,3).set([e.r,e.g,e.b]),this.runtime.call(`ghostty_terminal_set`,this.terminal,n[0],t)}this.runtime.free(t,3);let n=Bx(e.palette),r=this.runtime.alloc(n.length*3);this.runtime.bytes(r,n.length*3).set(n.flatMap(e=>[e.r,e.g,e.b])),this.runtime.call(`ghostty_terminal_set`,this.terminal,14,r),this.runtime.free(r,n.length*3),this.renderState.invalidate()}setCursor(e,t){let n={bar:0,block:1,underline:2}[e];this.runtime.view(this.scratch,4).setUint32(0,n,!0),this.runtime.call(`ghostty_terminal_set`,this.terminal,22,this.scratch),this.runtime.bytes(this.scratch,1)[0]=+!!t,this.runtime.call(`ghostty_terminal_set`,this.terminal,23,this.scratch)}title(){if(this.runtime.bytes(this.scratch,8).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,12,this.scratch)!==0)return``;let e=this.runtime.view(this.scratch,8),t=e.getUint32(0,!0),n=e.getUint32(4,!0);return n===0?``:zx.decode(this.runtime.bytes(t,n))}screenText(){let e=this.runtime.alloc(8),t=this.runtime.call(`ghostty_formatter_format_alloc`,this.formatter,0,e,e+4),n=this.runtime.view(e,8),r=n.getUint32(0,!0),i=n.getUint32(4,!0);if(this.runtime.free(e,8),t!==0)return``;let a=zx.decode(this.runtime.bytes(r,i));return this.runtime.call(`ghostty_free`,0,r,i),a}scroll(e){let t=this.runtime.layout(`GhosttyTerminalScrollViewport`),n=this.runtime.alloc(t.size);this.runtime.setField(n,`GhosttyTerminalScrollViewport`,`tag`,2);let r=this.runtime.field(`GhosttyTerminalScrollViewport`,`value`);this.runtime.view(n+r.offset,r.size).setInt32(0,e,!0),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,n),this.runtime.free(n,t.size)}scrollToBottom(){let e=this.runtime.layout(`GhosttyTerminalScrollViewport`),t=this.runtime.alloc(e.size);this.runtime.setField(t,`GhosttyTerminalScrollViewport`,`tag`,1),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,t),this.runtime.free(t,e.size)}scrollbarState(){let e=this.runtime.layout(`GhosttyTerminalScrollbar`);return this.runtime.bytes(this.scrollbar,e.size).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,9,this.scrollbar)===0?{total:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`total`),offset:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`offset`),len:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`len`)}:null}isMouseTracking(){return this.flag(`ghostty_terminal_get`,11)}isMouseAnyEventTracking(){return this.flag(`ghostty_terminal_mode_get`,1003)}isFocusReporting(){return this.flag(`ghostty_terminal_mode_get`,1004)}isSynchronizedOutput(){return this.flag(`ghostty_terminal_mode_get`,2026)}endSynchronizedOutput(){this.runtime.check(`ghostty_terminal_mode_set`,this.runtime.call(`ghostty_terminal_mode_set`,this.terminal,2026,0))}currentColors(){return{foreground:this.terminalColor(18),background:this.terminalColor(19),cursor:this.terminalColor(20),palette:Mx(this.runtime,this.terminal)}}isApplicationCursorKeys(){return this.flag(`ghostty_terminal_mode_get`,1)}isKittyKeyboard(){return this.flag(`ghostty_terminal_get`,8)}isAlternateScreen(){return this.runtime.dataView().setUint32(this.scratch,0,!0),this.runtime.call(`ghostty_terminal_get`,this.terminal,6,this.scratch)===0&&this.runtime.dataView().getUint32(this.scratch,!0)===1}setSelection(e,t){let n=this.runtime.layout(`GhosttyGridRef`).size,r=this.gridRef(e.x,e.y,2);try{let e=this.gridRef(t.x,t.y,2),i=this.runtime.layout(`GhosttySelection`),a=this.runtime.alloc(i.size);this.runtime.setField(a,`GhosttySelection`,`size`,i.size);let o=this.runtime.field(`GhosttySelection`,`start`),s=this.runtime.field(`GhosttySelection`,`end`);this.runtime.bytes(a+o.offset,o.size).set(this.runtime.bytes(r,o.size)),this.runtime.bytes(a+s.offset,s.size).set(this.runtime.bytes(e,s.size)),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,a),this.runtime.free(e,n),this.runtime.free(a,i.size)}finally{this.runtime.free(r,n)}}selectWord(e){return this.selectAt(`GhosttyTerminalSelectWordOptions`,`ghostty_terminal_select_word`,e)}selectLine(e){return this.selectAt(`GhosttyTerminalSelectLineOptions`,`ghostty_terminal_select_line`,e)}clearSelection(){this.runtime.call(`ghostty_terminal_set`,this.terminal,21,0)}selectionText(){let e=this.runtime.alloc(Fx),t=this.runtime.view(e,Fx);t.setUint32(0,Fx,!0),t.setUint8(8,1),t.setUint8(9,1);let n=this.runtime.encodeOutput((t,n,r)=>this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,t,n,r));return this.runtime.free(e,Fx),n}hyperlinkAt(e,t){let n=this.gridRef(e,t,1),r=this.hyperlinkOf(n);return this.runtime.free(n,this.runtime.layout(`GhosttyGridRef`).size),r}toScreen(e){let t=this.gridRef(e.x,e.y,1),n=this.pointFromGridRef(t,2);return this.runtime.free(t,this.runtime.layout(`GhosttyGridRef`).size),n}trackCursor(){let e=this.runtime.allocOpaque(),t=this.runtime.call(`ghostty_terminal_grid_ref_track`,this.terminal,this.cursorPoint(),e),n=this.runtime.readPointer(e);return this.runtime.freeOpaque(e),this.runtime.check(`ghostty_terminal_grid_ref_track`,t),n}retrack(e){let t=this.runtime.call(`ghostty_tracked_grid_ref_set`,e,this.terminal,this.cursorPoint());this.runtime.check(`ghostty_tracked_grid_ref_set`,t)}trackedPoint(e){return this.runtime.call(`ghostty_tracked_grid_ref_point`,e,2,this.scratch)===0?{x:this.runtime.readField(this.scratch,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(this.scratch,`GhosttyPointCoordinate`,`y`)}:null}trackedHyperlink(e){let t=this.runtime.layout(`GhosttyGridRef`).size,n=this.runtime.alloc(t);this.runtime.setField(n,`GhosttyGridRef`,`size`,t);let r=this.runtime.call(`ghostty_tracked_grid_ref_snapshot`,e,n)===0?this.hyperlinkOf(n):null;return this.runtime.free(n,t),r}untrack(e){this.runtime.call(`ghostty_tracked_grid_ref_free`,e)}snapshot(){return this.renderState.snapshot(this.terminal,this.boldIsBright)}invalidate(){this.renderState.invalidate()}cellSize(){return{width:this.sizeReport.cellWidth,height:this.sizeReport.cellHeight}}dispose(){if(this.disposed)return;this.disposed=!0;let e=this.runtime;e.call(`ghostty_formatter_free`,this.formatter),this.encoder.dispose(),this.kitty.dispose(),this.renderState.dispose(),this.hostId!==0&&e.detachHost(this.terminal,this.hostId),e.call(`ghostty_terminal_free`,this.terminal),e.free(this.scrollbar,e.layout(`GhosttyTerminalScrollbar`).size),e.free(this.scratch,16),e.free(this.point,e.layout(`GhosttyPoint`).size),e.freeOpaque(this.formatterSlot),e.freeOpaque(this.terminalSlot)}hyperlinkOf(e){let t=this.runtime.encodeOutput((t,n,r)=>this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,e,t,n,r));return t===``?null:t}cursorPosition(){this.runtime.dataView().setUint32(this.scratch,0,!0),this.runtime.call(`ghostty_terminal_get`,this.terminal,3,this.scratch),this.runtime.call(`ghostty_terminal_get`,this.terminal,4,this.scratch+2);let e=this.runtime.dataView();return{x:e.getUint16(this.scratch,!0),y:e.getUint16(this.scratch+2,!0)}}cursorPoint(){let e=this.cursorPosition();return this.fillPoint(this.point,e.x,e.y,0),this.point}fillPoint(e,t,n,r){this.runtime.setField(e,`GhosttyPoint`,`tag`,r);let i=this.runtime.field(`GhosttyPoint`,`value`),a=this.runtime.dataView();a.setUint16(e+i.offset,Math.max(0,t),!0),a.setUint32(e+i.offset+4,Math.max(0,n),!0)}gridRef(e,t,n){let r=this.runtime.alloc(this.runtime.layout(`GhosttyPoint`).size);this.fillPoint(r,e,t,n);let i=this.runtime.layout(`GhosttyGridRef`).size,a=this.runtime.alloc(i);this.runtime.setField(a,`GhosttyGridRef`,`size`,i);let o=this.runtime.call(`ghostty_terminal_grid_ref`,this.terminal,r,a);return this.runtime.free(r,this.runtime.layout(`GhosttyPoint`).size),o!==0&&(this.runtime.free(a,i),this.runtime.check(`ghostty_terminal_grid_ref`,o)),a}selectAt(e,t,n){let r=this.gridRef(n.x,n.y,2),i=this.runtime.layout(e),a=this.runtime.layout(`GhosttySelection`),o=this.runtime.alloc(i.size),s=this.runtime.alloc(a.size);this.runtime.setField(o,e,`size`,i.size);let c=this.runtime.field(e,`ref`);this.runtime.bytes(o+c.offset,c.size).set(this.runtime.bytes(r,c.size)),this.runtime.setField(s,`GhosttySelection`,`size`,a.size);let l=null;if(this.runtime.call(t,this.terminal,o,s)===0){let e=this.pointFromGridRef(s+this.runtime.field(`GhosttySelection`,`start`).offset,2),t=this.pointFromGridRef(s+this.runtime.field(`GhosttySelection`,`end`).offset,2);e&&t&&(l={start:e,end:t})}return this.runtime.free(s,a.size),this.runtime.free(r,this.runtime.layout(`GhosttyGridRef`).size),this.runtime.free(o,i.size),l}pointFromGridRef(e,t){let n=this.runtime.layout(`GhosttyPointCoordinate`),r=this.runtime.alloc(n.size),i=this.runtime.call(`ghostty_terminal_point_from_grid_ref`,this.terminal,e,t,r)===0?{x:this.runtime.readField(r,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(r,`GhosttyPointCoordinate`,`y`)}:null;return this.runtime.free(r,n.size),i}flag(e,t){return this.runtime.flag(e,this.terminal,t)}terminalColor(e){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.check(`ghostty_terminal_get`,this.runtime.call(`ghostty_terminal_get`,this.terminal,e,this.scratch)),jx(this.runtime,this.scratch)}};function Hx(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=r.indexOf(i);for(;a!==-1;)n.push(a),a=r.indexOf(i,a+i.length);return n}var Ux=class{core;redraw;listeners=new Set;query=``;matches=[];activeMatch=-1;stale=!1;timer=null;constructor(e,t){this.core=e,this.redraw=t}find(e,t,n,r){let i=this.matches[this.activeMatch]??null;if(this.query=e,this.refresh(),this.matches.length===0)this.activeMatch=-1;else if(n||i===null){let e=i?.row??r,t=this.matches.findIndex(t=>t.row>=e);this.activeMatch=t===-1?this.matches.length-1:t}else{let e=this.matches.findIndex(e=>e.row===i.row&&e.index===i.index),n=e===-1?0:e,r=t?-1:1;this.activeMatch=(n+r+this.matches.length)%this.matches.length}return this.emit(),this.matches[this.activeMatch]??null}onResults(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}clear(){this.query=``,this.matches=[],this.activeMatch=-1}outputChanged(){this.query!==``&&(this.stale=!0,this.timer===null&&(this.timer=window.setTimeout(()=>{if(this.timer=null,!this.stale||this.query===``)return;let e=this.matches[this.activeMatch];this.refresh();let t=e?this.matches.findIndex(t=>t.row===e.row&&t.index===e.index):-1;this.activeMatch=t===-1?this.matches.length-1:t,this.emit(),this.redraw()},200)))}highlights(e,t){if(this.query===``)return[];let n=this.matches[this.activeMatch],r=[];return e.rowData.forEach((e,i)=>{let a=Nx(e,i);Hx(a.text,this.query).forEach((e,o)=>{let s=a.points[e],c=a.points[e+this.query.length-1];s&&c&&r.push({row:i,start:s.x,end:c.x+1,active:n?.row===t+i&&n.index===o})})}),r}dispose(){this.timer!==null&&window.clearTimeout(this.timer),this.timer=null}refresh(){this.stale=!1,this.matches=[],this.query!==``&&this.core.screenText().split(`
|
|
66
66
|
`).forEach((e,t)=>{Hx(e,this.query).forEach((e,n)=>this.matches.push({row:t,index:n}))})}emit(){let e={resultIndex:this.activeMatch,resultCount:this.matches.length};for(let t of this.listeners)t(e)}},Wx=new TextDecoder;function Gx(e){function t(e){return e.toString(16).padStart(2,`0`).repeat(2)}return`rgb:${t(e.r)}/${t(e.g)}/${t(e.b)}`}function Kx(e){return Math.min(Math.max(e,0),100)}function qx(e){return Wx.decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}function Jx(e){return e===``?`s0`:[...e].filter(e=>`cpqs01234567`.includes(e)).join(``)}function Yx(e){try{return qx(e)}catch(e){return console.warn(`invalid clipboard sequence`,e),null}}function Xx(e,t,n){let r=Array.from(new TextEncoder().encode(e),e=>String.fromCharCode(e)).join(``);return`\x1b]52;${t};${btoa(r)}${n}`}function Zx(e,t,n){let r=e===`10;?`?t.foreground:e===`11;?`?t.background:t.cursor;return`\x1b]${e.slice(0,2)};${Gx(r)}${n}`}function Qx(e,t,n){let r=e.split(`;`),i=[];for(let e=1;e+1<r.length;e+=2){if(r[e+1]!==`?`||!/^\d+$/.test(r[e]))continue;let a=t[Number(r[e])];a!==void 0&&i.push(`\x1b]4;${r[e]};${Gx(a)}${n}`)}return i}function $x(e,t){let n=e.split(`;`);if(n.length>4)return null;let r=n[2]===void 0||n[2]===``?0:Number(n[2]),i=n[3]===void 0||n[3]===``?-1:Number(n[3]);return!Number.isInteger(r)||!Number.isInteger(i)?null:r===0?{state:r,value:0}:r===1?i<0?null:{state:r,value:Kx(i)}:r===2||r===4?i<0?{state:r,value:t.value}:{state:r,value:Kx(i||t.value)}:r===3?{state:r,value:t.value}:null}function eS(e,t){if(e.startsWith(`9;`)&&!/^9;\d+(;|$)/.test(e))return{title:``,body:Wx.decode(t.subarray(2))};if(e.startsWith(`777;notify;`)){let e=Wx.decode(t).split(`;`);return{title:e[2]??``,body:e.slice(3).join(`;`)}}return null}var tS=class{pending={id:``,title:``,body:``};add(e){let t=e.indexOf(`;`,3);if(t===-1)return null;let n=new Map;for(let r of e.slice(3,t).split(`:`)){let e=r.indexOf(`=`);e!==-1&&n.set(r.slice(0,e),r.slice(e+1))}let r=n.get(`p`)??`title`;if(r===`?`||r===`close`||r===`alive`)return null;let i=e.slice(t+1);if(n.get(`e`)===`1`)try{i=qx(i)}catch(e){return console.warn(`invalid notification sequence`,e),null}let a=n.get(`i`)??``;if(a!==this.pending.id&&(this.pending={id:a,title:``,body:``}),r===`title`&&(this.pending.title+=i),r===`body`&&(this.pending.body+=i),n.get(`d`)===`0`)return null;let o=this.pending;return this.pending={id:``,title:``,body:``},o.title===``&&o.body===``?null:{title:o.title,body:o.body}}},nS=27,rS=7,iS=24,aS=26,oS=33554432,sS=class{state=`ground`;params=``;collecting=!1;chunks=[];size=0;reset(){this.state=`ground`,this.drop()}scan(e,t){let n=0;for(let r=0;r<e.length;r+=1){let i=e[r];if(i===iS||i===aS)this.state=`ground`,this.drop();else if(this.state===`ground`)i===nS&&(this.state=`escape`);else if(this.state===`escape`){if(this.params=``,i===93){this.state=`osc`,this.begin(),n=r+1;continue}if(i===80){this.state=`dcsHeader`;continue}this.state=i===nS?`escape`:`ground`}else if(this.state===`osc`){if(i===rS){if(this.state=`ground`,this.append(e,n,r),t({type:`osc`,data:this.take(),terminator:`\x07`},r+1))return r+1;continue}i===nS&&(this.state=`oscEscape`,this.append(e,n,r))}else if(this.state===`oscEscape`){if(i===92){if(this.state=`ground`,t({type:`osc`,data:this.take(),terminator:`\x1B\\`},r+1))return r+1;continue}this.drop(),this.state=`escape`,--r}else if(this.state===`dcsHeader`){if(i===nS){this.state=`dcsEscape`;continue}if(i>=32&&i<=63){this.params.length<16&&(this.params+=String.fromCharCode(i));continue}this.state=`dcs`,i===113&&/^[0-9;]*$/.test(this.params)&&(this.begin(),n=r+1)}else if(this.state===`dcs`)i===nS&&(this.state=`dcsEscape`,this.append(e,n,r));else if(i===92){if(this.state=`ground`,this.collecting&&t({type:`sixel`,data:this.take()},r+1))return r+1}else this.drop(),this.state=`escape`,--r}return(this.state===`osc`||this.state===`dcs`)&&this.append(e,n,e.length),e.length}begin(){this.collecting=!0,this.chunks=[],this.size=0}append(e,t,n){!this.collecting||n<=t||(this.size+n-t>oS?this.drop():(this.chunks.push(e.slice(t,n)),this.size+=n-t))}take(){let e=new Uint8Array(this.size),t=0;for(let n of this.chunks)e.set(n,t),t+=n.length;return this.drop(),e}drop(){this.collecting=!1,this.chunks=[],this.size=0}},cS=`0101.0202.1010.2020.........0110.0210.0120.0220.0011.0012.0021.0022.1100.1200.2100.2200.1001.1002.2001.2002.1110.1210.2110.1120.2120.2210.1220.2220.1011.1012.2011.1021.2021.2012.1022.2022.0111.0112.0211.0212.0121.0122.0221.0222.1101.1102.1201.1202.2101.2102.2201.2202.1111.1112.1211.1212.2111.1121.2121.2112.2211.1122.1221.2212.1222.2122.2221.2222`.split(`.`),lS=[`0001`,`1000`,`0100`,`0010`,`0002`,`2000`,`0200`,`0020`,`0201`,`1020`,`0102`,`2010`],uS=`0303.3030.0310.0130.0330.0013.0031.0033.1300.3100.3300.1003.3001.3003.1310.3130.3330.1013.3031.3033.0313.0131.0333.1303.3101.3303.1313.3131.3333`.split(`.`),dS=[0,0,4,4],fS=[4,0,4,4],pS=[0,4,4,4],mS=[4,4,4,4],hS=[[[0,0,8,4]],[[0,7,8,1]],[[0,6,8,2]],[[0,5,8,3]],[[0,4,8,4]],[[0,3,8,5]],[[0,2,8,6]],[[0,1,8,7]],[[0,0,8,8]],[[0,0,7,8]],[[0,0,6,8]],[[0,0,5,8]],[[0,0,4,8]],[[0,0,3,8]],[[0,0,2,8]],[[0,0,1,8]],[[4,0,4,8]],[],[],[],[[0,0,8,1]],[[7,0,1,8]],[pS],[mS],[dS],[dS,pS,mS],[dS,mS],[dS,fS,pS],[dS,fS,mS],[fS],[fS,pS],[fS,pS,mS]],gS={9617:.25,9618:.5,9619:.75},_S={9581:[1,1],9582:[-1,1],9583:[-1,-1],9584:[1,-1]};function vS(e){return e>=9472&&e<=9547?cS[e-9472]:e>=9552&&e<=9580?uS[e-9552]:e>=9588&&e<=9599?lS[e-9588]:``}function yS(e){if(e.length!==1)return!1;let t=e.charCodeAt(0);return vS(t)!==``||_S[t]!==void 0||t>=9600&&t<=9631}function bS(e){return Math.max(1,Math.round(e.height/20))}function xS(e,t,n){let[r,i,a,o]=t,s=bS(n),c=s*2,l=Math.floor(Math.max(0,n.height-s)/2),u=l+s,d=Math.floor(Math.max(0,n.height-c)/2),f=d+c,p=Math.max(0,l-s),m=u+s,h=Math.floor(Math.max(0,n.width-s)/2),g=h+s,_=Math.floor(Math.max(0,n.width-c)/2),v=_+c,y=Math.max(0,h-s),b=g+s;function x(t,r,i,a){e.fillRect(n.left+t,n.top+r,i-t,a-r)}let S=o===`2`||i===`2`?f:o!==i||a===r?o===`3`||i===`3`?m:u:o===`0`&&i===`0`?u:l,C=o===`2`||i===`2`?d:o!==i||r===a?o===`3`||i===`3`?p:l:o===`0`&&i===`0`?l:u,w=r===`2`||a===`2`?v:r!==a||o===i?r===`3`||a===`3`?b:g:r===`0`&&a===`0`?g:h,T=r===`2`||a===`2`?_:r!==a||i===o?r===`3`||a===`3`?y:h:r===`0`&&a===`0`?h:g;r===`1`&&x(h,0,g,S),r===`2`&&x(_,0,v,S),r===`3`&&(x(y,0,h,o===`3`?l:S),x(g,0,b,i===`3`?l:S)),i===`1`&&x(T,l,n.width,u),i===`2`&&x(T,d,n.width,f),i===`3`&&(x(r===`3`?g:T,p,n.width,l),x(a===`3`?g:T,u,n.width,m)),a===`1`&&x(h,C,g,n.height),a===`2`&&x(_,C,v,n.height),a===`3`&&(x(y,o===`3`?u:C,h,n.height),x(g,i===`3`?u:C,b,n.height)),o===`1`&&x(0,l,w,u),o===`2`&&x(0,d,w,f),o===`3`&&(x(0,p,r===`3`?h:w,l),x(0,u,a===`3`?h:w,m))}function SS(e,[t,n],r){let i=bS(r),a=r.left+Math.floor(Math.max(0,r.width-i)/2)+i/2,o=r.top+Math.floor(Math.max(0,r.height-i)/2)+i/2,s=t===1?r.left+r.width:r.left,c=n===1?r.top+r.height:r.top,l=Math.min(r.width,r.height)/2;e.save(),e.strokeStyle=e.fillStyle,e.lineWidth=i,e.beginPath(),e.moveTo(a,c),e.arcTo(a,o,s,o,l),e.lineTo(s,o),e.stroke(),e.restore()}function CS(e,t,n,r){e.save(),e.setTransform(1,0,0,1,0,0),wS(e,t.charCodeAt(0),{left:Math.round(n.left*r),top:Math.round(n.top*r),width:Math.round((n.left+n.width)*r)-Math.round(n.left*r),height:Math.round((n.top+n.height)*r)-Math.round(n.top*r)}),e.restore()}function wS(e,t,n){let r=vS(t);if(r!==``){xS(e,r,n);return}let i=_S[t];if(i!==void 0){SS(e,i,n);return}let a=gS[t];if(a!==void 0)e.globalAlpha=a,e.fillRect(n.left,n.top,n.width,n.height);else for(let[r,i,a,o]of hS[t-9600]){let t=n.left+Math.round(n.width*r/8),s=n.top+Math.round(n.height*i/8);e.fillRect(t,s,n.left+Math.round(n.width*(r+a)/8)-t,n.top+Math.round(n.height*(i+o)/8)-s)}}function TS(e){return`rgb(${e.r}, ${e.g}, ${e.b})`}function ES(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b}function DS(e,t){return Math.round(e*t)/t}function OS(e,t,n,r){let i=DS(e*n.width,r);return{left:i,width:DS(t*n.width,r)-i}}function kS(e,t,n,r,i){let a=i-2,o=n+r;if(t===1)e.fillRect(n,a,r,1);else if(t===2)e.fillRect(n,a,r,1),e.fillRect(n,a-2,r,1);else if(t===3){function t(e){return a-1+Math.sin(e/3*Math.PI)*1.5}e.save(),e.strokeStyle=e.fillStyle,e.lineWidth=1,e.beginPath(),e.moveTo(n,t(n));for(let r=Math.floor(n)+1;r<o;r+=1)e.lineTo(r,t(r));e.lineTo(o,t(o)),e.stroke(),e.restore()}else if(t===4)for(let t=Math.ceil(n/2)*2;t<o;t+=2)e.fillRect(t,a,1,1);else if(t===5)for(let t=Math.floor(n/5)*5;t<o;t+=5){let r=Math.max(t,n),i=Math.min(t+3,o);i>r&&e.fillRect(r,a,i-r,1)}else throw Error(`unknown underline style ${t}`)}function AS(e,t){return e.selected===t.selected&&ES(e.foreground,t.foreground)&&e.bold===t.bold&&e.italic===t.italic&&e.invisible===t.invisible}function jS(e,t){return`${e.italic?`italic`:`normal`} ${e.bold?700:400} ${t.fontSize}px ${t.fontFamily}`}function MS(e,t,n,r,i){e.font=`normal 400 ${t}px ${n}`;let a=e.measureText(`M`).width,o=e.measureText(`Mg`),s=o.fontBoundingBoxAscent||t,c=s+o.fontBoundingBoxDescent,l=Math.max(1,Math.round(c*r*i))/i;return{width:Math.max(1,Math.round(a*i))/i,height:l,baseline:DS((l-c)/2+s,i),faceWidth:a}}function NS(e){return/^[!-/:-@[-`{-~]$/.test(e)}function PS(e,t,n){return!(e===null||t<e.start.y||t>e.end.y||t===e.start.y&&n<e.start.x||t===e.end.y&&n>e.end.x)}function FS(e){let{context:t,snapshot:n,metrics:r,appearance:i,cursorOn:a,previousCursorY:o,pixelRatio:s}=e,c=e.forceFull?Array.from({length:n.rows},(e,t)=>t):[...n.dirtyRows];o!==null&&!c.includes(o)&&c.push(o),n.cursorVisible&&n.cursorY>=0&&!c.includes(n.cursorY)&&c.push(n.cursorY),e.forceFull&&(t.save(),t.resetTransform(),t.fillStyle=TS(n.background),t.fillRect(0,0,t.canvas.width,t.canvas.height),t.restore());function l(e){let t=e*r.height,n=DS(t,s);return{top:t,cellTop:n,cellHeight:DS(t+r.height,s)-n}}t.textBaseline=`alphabetic`;for(let e of c){if(!n.rowData[e])continue;let{cellTop:r,cellHeight:i}=l(e);t.fillStyle=TS(n.background),t.fillRect(0,r,t.canvas.width,i)}e.drawLayer(`belowBackground`);for(let a of c){let o=n.rowData[a];if(!o)continue;let{cellTop:c,cellHeight:u}=l(a),d=0;for(;d<o.cells.length;){let e=o.cells[d],a=d+1;for(;a<o.cells.length&&o.cells[a].selected===e.selected&&ES(o.cells[a].background,e.background);)a+=1;let{left:l,width:f}=OS(d,a,r,s);e.selected?(t.fillStyle=i.selectionBackground,t.fillRect(l,c,f,u)):ES(e.background,n.background)||(t.fillStyle=TS(e.background),t.fillRect(l,c,f,u)),d=a}for(let n of e.highlights){if(n.row!==a)continue;let{left:e,width:o}=OS(n.start,n.end,r,s);t.fillStyle=i.matchBackground,t.fillRect(e,c,o,u),n.active&&(t.strokeStyle=i.activeMatchBorder,t.strokeRect(e+.5,c+.5,o-1,u-1))}}e.drawLayer(`belowText`);for(let a of c){let o=n.rowData[a];if(!o)continue;let{top:c,cellTop:u,cellHeight:d}=l(a);t.save(),t.beginPath(),t.rect(0,u,t.canvas.width,d),t.clip();for(let e=0;e<o.cells.length;e+=1){let n=o.cells[e];if(n.invisible||n.text.trim().length===0)continue;t.fillStyle=n.selected?i.selectionForeground:TS(n.foreground);let a=e*r.width;if(yS(n.text)){CS(t,n.text,{left:a,top:c,width:r.width,height:r.height},s);continue}t.font=jS(n,i);let l=a+(r.width-r.faceWidth)/2,u=e,d=e+1;if(i.ligatures&&NS(n.text)){for(;u>e-3&&u>0&&NS(o.cells[u-1].text)&&AS(o.cells[u-1],n);)--u;for(;d<e+4&&d<o.cells.length&&NS(o.cells[d].text)&&AS(o.cells[d],n);)d+=1}d-u===1?t.fillText(n.text,l,c+r.baseline):(t.save(),t.beginPath(),t.rect(a,c,r.width,r.height),t.clip(),t.fillText(o.cells.slice(u,d).map(e=>e.text).join(``),l-(e-u)*r.faceWidth,c+r.baseline),t.restore())}t.restore();for(let n=0;n<o.cells.length;n+=1){let i=o.cells[n],l=PS(e.hoveredLink,a,n);if(i.underline===0&&!i.strikethrough&&!i.overline&&!l)continue;let{left:f,width:p}=OS(n,n+1,r,s),m=u+d;t.fillStyle=TS(i.foreground),i.strikethrough&&t.fillRect(f,c+Math.floor(r.height*.55),p,1),i.overline&&t.fillRect(f,u+1,p,1),i.underline===0?l&&kS(t,1,f,p,m):(i.underlineColor!==null&&(t.fillStyle=TS(i.underlineColor)),kS(t,i.underline,f,p,m))}}if(!a||!n.cursorVisible||n.cursorX<0||n.cursorY<0)return;let u=n.cursorY*r.height,d=DS(u,s),f=DS(u+r.height,s)-d,p=n.rowData[n.cursorY]?.cells,m=p?.[n.cursorX],h=p?.[n.cursorX+1]?.wide===wx.spacerTail?2:1,{left:g,width:_}=OS(n.cursorX,n.cursorX+h,r,s);t.fillStyle=TS(n.cursor),t.strokeStyle=TS(n.cursor),!e.focused||n.cursorStyle===3?t.strokeRect(g+.5,d+.5,_-1,f-1):n.cursorStyle===0?t.fillRect(g,d,1,f):n.cursorStyle===2?t.fillRect(g,d+f-2,_,2):(t.fillRect(g,d,_,f),m?.text&&(t.fillStyle=i.cursorText,yS(m.text)?CS(t,m.text,{left:n.cursorX*r.width,top:u,width:r.width,height:r.height},s):(t.font=jS(m,i),t.fillText(m.text,n.cursorX*r.width+(r.width-r.faceWidth)/2,u+r.baseline))))}var IS=navigator.userAgent.includes(`Mac`),LS=500,RS=/https?:\/\/[^\s"'`<>]+/g;function zS(e){return e===0?1:e===1?3:e===2?2:null}function BS(e,t){let n=Math.max(0,e.total-e.len);if(t<=0||e.len<=0||n===0)return null;let r=Math.min(t,Math.max(20,t*e.len/e.total)),i=t-r;return{thumbHeight:r,thumbTop:i*(Math.min(e.offset,n)/n),travel:i,maxOffset:n}}var VS=class{hoveredLink=null;context;linkPointer=null;mousePointer=null;mouseButton=null;lastMotion=``;selectionPointer=null;selectionMode=`cell`;selectionAnchor=null;selectionBase=null;selectionMoved=!1;selectionScroll=null;selectionScrollDelta=0;selectionClient=null;clickMove=null;clicks={count:0,time:0,x:0,y:0};touch=null;wheelRemainder=0;scrollbarDrag=null;constructor(e){this.context=e;let t=e.canvas,n=e.scrollbar;t.addEventListener(`pointerdown`,this.onPointerDown),t.addEventListener(`pointermove`,this.onPointerMove),t.addEventListener(`pointerup`,this.onPointerUp),t.addEventListener(`pointercancel`,this.onPointerUp),t.addEventListener(`pointerleave`,this.onPointerLeave),t.addEventListener(`wheel`,this.onWheel,{passive:!1}),t.addEventListener(`mousedown`,this.onMouseDown),n.addEventListener(`pointerdown`,this.onScrollbarDown),n.addEventListener(`pointermove`,this.onScrollbarMove),n.addEventListener(`pointerup`,this.onScrollbarUp),n.addEventListener(`pointercancel`,this.onScrollbarUp)}updateScrollbar(e){let t=this.context.core.scrollbarState(),n=t===null?null:BS(t,e);this.context.scrollbar.hidden=n===null,n!==null&&(this.context.thumb.style.height=`${n.thumbHeight}px`,this.context.thumb.style.transform=`translateY(${n.thumbTop}px)`)}dispose(){this.setSelectionScroll(0)}scrollRows(e,t){let n=this.context.core,r=this.wheelRemainder+e/this.context.view().metrics.height,i=Math.trunc(r);if(this.wheelRemainder=r-i,i!==0){if(this.reportsMouse(t))for(let e=0;e<Math.abs(i);e+=1)this.sendMouse(`press`,i<0?4:5,t);else if(n.isAlternateScreen()){let e=(n.isApplicationCursorKeys()?`\x1BO`:`\x1B[`)+(i<0?`A`:`B`);this.context.onData(e.repeat(Math.abs(i)))}else this.context.scrollViewport(i)}}cellAt(e,t){let n=this.context.view(),r=this.context.canvas.getBoundingClientRect();return{x:Math.max(0,Math.min(n.cols-1,Math.floor((e-r.left)/n.metrics.width))),y:Math.max(0,Math.min(n.rows-1,Math.floor((t-r.top)/n.metrics.height)))}}reportsMouse(e){return this.context.core.isMouseTracking()&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey}sendMouse(e,t,n){let r=this.context.view(),i=this.context.canvas.getBoundingClientRect(),a=window.devicePixelRatio||1,o=this.context.core.encoder.encodeMouse({action:e,button:t,mods:+!!n.shiftKey|(n.ctrlKey?2:0)|(n.altKey?4:0)|(n.metaKey?8:0),x:Math.max(0,n.clientX-i.left)*a,y:Math.max(0,n.clientY-i.top)*a,screenWidth:r.cols*r.metrics.width*a,screenHeight:r.rows*r.metrics.height*a,cellWidth:r.metrics.width*a,cellHeight:r.metrics.height*a,anyButtonPressed:n.buttons!==0});if(o.length!==0){if(e===`motion`){if(o===this.lastMotion)return;this.lastMotion=o}else this.lastMotion=``;this.context.onData(o)}}linkAt(e,t){let n=this.context.view(),r=this.context.core,i=n.snapshot;if(!i)return null;let a=this.context.canvas.getBoundingClientRect(),o=e-a.left,s=t-a.top;if(o<0||s<0||o>=n.cols*n.metrics.width||s>=n.rows*n.metrics.height)return null;let c={x:Math.floor(o/n.metrics.width),y:Math.floor(s/n.metrics.height)},l=r.hyperlinkAt(c.x,c.y);if(l!==null){if(l.startsWith(`offsite-image:`))return null;let e=c.x,t=c.x;for(;e>0&&r.hyperlinkAt(e-1,c.y)===l;)--e;for(;t<n.cols-1&&r.hyperlinkAt(t+1,c.y)===l;)t+=1;return{uri:l,range:{start:{x:e,y:c.y},end:{x:t,y:c.y}}}}let u=c.y;for(;u>0&&i.rowData[u]?.isWrapContinuation;)--u;let d=c.y;for(;d<i.rows-1&&i.rowData[d]?.wrapsToNext;)d+=1;let f=``,p=[];for(let e=u;e<=d;e+=1){let t=i.rowData[e];if(!t)break;let n=Nx(t,e);f+=n.text,p.push(...n.points)}for(let e of f.matchAll(RS)){let t=e[0].replace(/[.,;:!?)\]}'"]+$/,``),n=p[e.index],r=p[e.index+t.length-1];if(!n||!r)continue;let i={start:n,end:r};if(PS(i,c.y,c.x))return{uri:t,range:i}}return null}setHoveredLink(e){let t=this.hoveredLink;this.context.canvas.style.cursor=e?`pointer`:``,(t?.uri!==e?.uri||t?.range.start.x!==e?.range.start.x||t?.range.start.y!==e?.range.start.y)&&(this.hoveredLink=e,this.context.redraw())}beginSelection(e,t){let n=this.context.core,r=this.cellAt(e.clientX,e.clientY),i=n.toScreen(r);if(!i)return;this.selectionMoved=!1,this.selectionMode=t>=3?`line`:t===2?`word`:`cell`;let a=this.selectionMode===`line`?n.selectLine(i):this.selectionMode===`word`?n.selectWord(i):null;this.selectionAnchor=a?a.start:i,this.selectionBase=a,a?n.setSelection(a.start,a.end):(this.selectionMode=`cell`,n.setSelection(i,i)),this.context.redraw()}extendSelection(e,t){let n=this.context.core,r=this.selectionAnchor;if(!r)return;let i=this.cellAt(e,t),a=n.toScreen(i);if(!a)return;this.selectionMoved=!0;let o=this.selectionBase;if(o===null)n.setSelection(r,a);else{let e=this.selectionMode===`line`?n.selectLine(a):n.selectWord(a),t=a.y<o.start.y||a.y===o.start.y&&a.x<o.start.x;n.setSelection(t?o.end:o.start,e?t?e.start:e.end:a)}this.context.redraw()}setSelectionScroll(e){this.selectionScrollDelta=e,e===0?(this.selectionScroll!==null&&window.clearInterval(this.selectionScroll),this.selectionScroll=null):this.selectionScroll===null&&(this.selectionScroll=window.setInterval(()=>{this.context.scrollViewport(this.selectionScrollDelta);let e=this.selectionClient;e&&this.extendSelection(e.x,e.y)},80))}dragScrollbar(e){let t=this.context.core.scrollbarState(),n=this.scrollbarDrag;if(t===null||n===null)return;let r=this.context.scrollbar.getBoundingClientRect(),i=BS(t,r.height);if(i===null||i.travel===0)return;let a=Math.max(0,Math.min(e-r.top-n.offset,i.travel)),o=Math.round(a/i.travel*i.maxOffset);this.context.scrollViewport(o-t.offset)}onPointerDown=e=>{let t=this.context.canvas;if(this.context.focus(),e.pointerType===`touch`){this.touch={id:e.pointerId,y:e.clientY,moved:!1},t.setPointerCapture(e.pointerId);return}if(this.reportsMouse(e)){let n=zS(e.button);if(n===null)return;e.preventDefault(),this.mousePointer=e.pointerId,this.mouseButton=n,this.sendMouse(`press`,n,e),t.setPointerCapture(e.pointerId);return}if(e.button!==0)return;if(this.linkAt(e.clientX,e.clientY)&&(IS?e.metaKey:e.ctrlKey)){e.preventDefault(),this.linkPointer=e.pointerId;return}let n=e.timeStamp-this.clicks.time<=LS&&Math.hypot(e.clientX-this.clicks.x,e.clientY-this.clicks.y)<=4;this.clicks={count:n?this.clicks.count>=3?1:this.clicks.count+1:1,time:e.timeStamp,x:e.clientX,y:e.clientY},this.clickMove=!e.altKey&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this.context.view().clickToMoveCursor&&this.clicks.count===1?this.cellAt(e.clientX,e.clientY):null,this.selectionPointer=e.pointerId,this.beginSelection(e,this.clicks.count),t.setPointerCapture(e.pointerId)};onPointerMove=e=>{let t=this.touch;if(t?.id===e.pointerId){let n=t.y-e.clientY;if(Math.abs(n)<1)return;t.y=e.clientY,t.moved=!0,this.scrollRows(n,e)}else if(this.mousePointer===e.pointerId||this.context.core.isMouseAnyEventTracking()&&this.reportsMouse(e)){let t=e.buttons,n=t&1?1:t&4?3:t&2?2:null;this.sendMouse(`motion`,n,e)}else if(this.selectionPointer===e.pointerId){let t=this.cellAt(e.clientX,e.clientY);this.clickMove!==null&&(t.x!==this.clickMove.x||t.y!==this.clickMove.y)&&(this.clickMove=null),this.selectionClient={x:e.clientX,y:e.clientY};let n=this.context.canvas.getBoundingClientRect();this.setSelectionScroll(e.clientY<n.top?-1:+(e.clientY>n.bottom)),this.extendSelection(e.clientX,e.clientY)}else this.setHoveredLink(this.linkAt(e.clientX,e.clientY))};onPointerUp=e=>{let t=this.context.canvas;if(t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.touch?.id===e.pointerId)this.touch=null;else if(this.linkPointer===e.pointerId){this.linkPointer=null;let t=this.linkAt(e.clientX,e.clientY);t&&e.type===`pointerup`&&this.context.onLink(t.uri,e)}else if(this.mousePointer===e.pointerId)this.sendMouse(`release`,this.mouseButton,e),this.mousePointer=null,this.mouseButton=null;else if(this.selectionPointer===e.pointerId){this.selectionPointer=null,this.setSelectionScroll(0),!this.selectionMoved&&this.selectionMode===`cell`&&(this.context.core.clearSelection(),this.selectionAnchor=null,this.context.redraw());let t=this.clickMove;this.clickMove=null,t!==null&&e.type===`pointerup`&&this.context.moveCursorTo(t)}};onPointerLeave=()=>{this.lastMotion=``,this.setHoveredLink(null)};onWheel=e=>{if(e.deltaY===0)return;e.preventDefault();let t=this.context.view(),n=e.deltaMode===1?e.deltaY*t.metrics.height:e.deltaMode===2?e.deltaY*t.rows*t.metrics.height:e.deltaY;this.scrollRows(n,e)};onMouseDown=e=>{e.button===0&&e.preventDefault(),this.context.focus()};onScrollbarDown=e=>{let t=this.context.core.scrollbarState();if(e.button!==0||t===null)return;let n=this.context.scrollbar,r=n.getBoundingClientRect(),i=BS(t,r.height);i!==null&&(e.preventDefault(),e.stopPropagation(),this.scrollbarDrag={id:e.pointerId,offset:e.target===this.context.thumb?e.clientY-r.top-i.thumbTop:i.thumbHeight/2},n.setPointerCapture(e.pointerId),this.dragScrollbar(e.clientY))};onScrollbarMove=e=>{this.scrollbarDrag?.id===e.pointerId&&(e.preventDefault(),this.dragScrollbar(e.clientY))};onScrollbarUp=e=>{if(this.scrollbarDrag?.id!==e.pointerId)return;this.scrollbarDrag=null;let t=this.context.scrollbar;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}},HS=[`\r`,`
|
|
67
67
|
`,``,``,``,``,`\x1B[99;5u`,`\x1B[100;5u`,`\x1B[111;5u`,`\x1B[122;5u`];function US(e,t){return e.y<t.y||e.y===t.y&&e.x<t.x}var WS=class{shell=`unknown`;generation=0;core;native=!1;input=!1;clickEvents=!1;inputRef=null;constructor(e){this.core=e}mark(e,t){let n=e.startsWith(`133;`),r=n?4:5;if(e.length>r+1&&e[r+1]!==`;`)return;let i=e.charAt(r);if(!this.core.isAlternateScreen()){if(i===`A`){let r=e.split(`;`);if(r.includes(`k=s`)||r.includes(`k=c`))return;let i=n&&r.includes(`click_events=1`),a=this.shell===`prompt`,o=a&&!this.input&&this.native!==n;if(this.shell=`prompt`,this.native=n,t&&this.trackInput(),o){this.clickEvents=this.clickEvents||i;return}if(this.input=!1,this.clickEvents=i,a)return;this.generation+=1}else if(i===`B`)this.shell=`prompt`,this.input=!0,t&&this.trackInput();else if(i===`C`)this.shell=`command`;else if(i===`D`){if(this.shell===`prompt`&&!this.input)return;this.shell=`unknown`}}}beforeInput(e){this.shell===`prompt`&&HS.some(t=>e.includes(t))&&(this.shell=`unknown`)}reset(){this.release(),this.shell=`unknown`,this.input=!1,this.clickEvents=!1}release(){this.inputRef!==null&&this.core.untrack(this.inputRef),this.inputRef=null}moveCursorInput(e,t,n){if(this.shell!==`prompt`||this.inputRef===null||t===null||t.cursorX<0||t.cursorY<0||this.core.isAlternateScreen()||this.core.isMouseTracking())return null;let r=this.core.trackedPoint(this.inputRef);if(r===null)return null;let i={x:r.x,y:r.y-n};if(US(e,i))return null;if(this.clickEvents){let t=this.core.scrollbarState();if(t===null)return null;let r=e.y+n-(t.total-t.len);return r<0?null:`\x1b[<0;${e.x+1};${r+1}M`}if(!this.input)return null;let a={x:e.x,y:e.y};a.x>0&&t.rowData[a.y]?.cells[a.x]?.wide===wx.spacerTail&&--a.x;let o={x:t.cursorX,y:t.cursorY};if(US(a,i)||US(o,i))return null;let s=US(a,o),c=s?a:o,l=s?o:a,u=0;for(let e=c.y;e<=l.y;e+=1){let n=t.rowData[e];if(n===void 0)return null;let r=e===l.y?l.x:n.cells.length;for(let t=e===c.y?c.x:0;t<r;t+=1)n.cells[t].text!==``&&(u+=1);if(e<l.y&&!n.wrapsToNext){if(s)return null;break}}let d=s?`ArrowLeft`:`ArrowRight`,f=this.core.encoder.encodeKey(new KeyboardEvent(`keydown`,{key:d,code:d}));return u>0?f.repeat(u):``}trackInput(){this.inputRef===null?this.inputRef=this.core.trackCursor():this.core.retrack(this.inputRef)}},GS=navigator.userAgent.includes(`Mac`),KS=600,qS=1e3,JS=1e4,YS=new TextDecoder(`latin1`),XS=new TextDecoder;function ZS(e){let t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)throw Error(`unsupported color ${e}`);return{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}}function QS(e){return[...e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0).map(e=>/^(['"]).*\1$/.test(e)||/^[a-zA-Z][a-zA-Z0-9-]*$/.test(e)?e:`"${e.replaceAll(`"`,``)}"`),`monospace`].join(`, `)}async function $S(e){try{(await e)?.close()}catch(e){console.warn(`could not decode image`,e)}}var eC=class{element;cols=80;rows=24;canvas;input;context;core;scanner=new sS;handlers;observer;prompt;search;images;pointer;notifications=new tS;options;appearance;metrics;snapshot=null;sized=!1;fitted=!1;frame=0;forceFull=!0;renderFailed=!1;cursorOn=!0;cursorTimer=null;syncTimer=null;renderedCursorY=null;focused=!1;composing=!1;suppressedKeys=new Set;heldOptionKeys=new Set;backlog=[];blocked=!1;epoch=0;title=``;progress={state:0,value:0};disposed=!1;constructor(e,t){this.options=e,this.handlers=t,this.element=document.createElement(`div`),this.element.className=`relative h-full overflow-hidden`,this.canvas=document.createElement(`canvas`),this.canvas.className=`absolute top-0 left-0 cursor-text touch-none`,this.input=document.createElement(`textarea`),this.input.setAttribute(`aria-label`,`Terminal input`),this.input.autocapitalize=`off`,this.input.autocomplete=`off`,this.input.spellcheck=!1,this.input.style.cssText=`position:absolute;left:0;top:0;width:1px;height:1px;opacity:0;padding:0;border:0;resize:none;pointer-events:none;`;let n=document.createElement(`div`);n.className=`absolute top-0 right-0 bottom-0 w-2 cursor-default touch-none`,n.hidden=!0;let r=document.createElement(`div`);r.className=`bg-foreground/15 hover:bg-foreground/30 absolute inset-x-0.5 top-0 rounded-full`,n.append(r),this.element.append(this.canvas,this.input,n);let i=this.canvas.getContext(`2d`,{alpha:!1});if(!i)throw Error(`canvas 2d is unavailable`);this.context=i,this.appearance=this.appearanceFor(e),this.metrics=this.measure(),this.core=new Vx(Math.max(1,Math.floor(window.innerWidth/this.metrics.width)),this.rows,e.scrollback,t.onReply,t.onBell),this.prompt=new WS(this.core),this.search=new Ux(this.core,()=>this.redraw()),this.images=new Sb(this.core),this.pointer=new VS({canvas:this.canvas,scrollbar:n,thumb:r,core:this.core,view:()=>({cols:this.cols,rows:this.rows,metrics:this.metrics,snapshot:this.snapshot,clickToMoveCursor:this.options.clickToMoveCursor}),focus:()=>this.focus(),redraw:()=>this.redraw(),scrollViewport:e=>this.scrollViewport(e),moveCursorTo:e=>this.moveCursorTo(e),onData:t.onData,onLink:t.onLink}),this.applyTerminalOptions(),this.resizeCore(),this.installEvents(),this.observer=new ResizeObserver(()=>this.fit()),this.observer.observe(this.element)}setOptions(e){this.options=e,this.appearance=this.appearanceFor(e),this.metrics=this.measure(),e.clickToMoveCursor||this.prompt.release(),this.applyTerminalOptions(),this.resizeCore(),this.forceFull=!0,this.fit(),this.requestRender()}write(e,t){this.disposed||(this.backlog.push({data:e,replay:t}),this.blocked||this.drain())}reset(){this.epoch+=1,this.backlog=[],this.blocked=!1,this.scanner.reset(),this.prompt.reset(),this.core.reset(),this.applyTerminalOptions(),this.images.clear(),this.core.clearSelection(),this.redraw()}focus(){this.input.focus({preventScroll:!0})}isKittyKeyboard(){return this.core.isKittyKeyboard()}paste(e){let t=this.core.encoder.encodePaste(e);t.length>0&&this.sendInput(t)}presize(e,t){this.fitted||e===this.cols&&t===this.rows||(this.cols=e,this.rows=t,this.resizeCore())}fit(){if(this.disposed)return;let e=this.element.clientWidth,t=this.element.clientHeight;if(e===0||t===0){this.sized=!1;return}this.sized=!0,this.fitted=!0;let n=window.devicePixelRatio||1,r=Math.round(e*n),i=Math.round(t*n);(this.canvas.width!==r||this.canvas.height!==i)&&(this.canvas.width=r,this.canvas.height=i,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${t}px`,this.context.setTransform(n,0,0,n,0,0),this.metrics=this.measure(),this.resizeCore(),this.forceFull=!0);let a=Math.max(1,Math.floor(e/this.metrics.width)),o=Math.max(1,Math.floor(t/this.metrics.height));(a!==this.cols||o!==this.rows)&&(this.cols=a,this.rows=o,this.resizeCore(),this.forceFull=!0,this.handlers.onResize(a,o)),this.renderFrame()}find(e,t,n){let r=this.viewportTop(),i=this.search.find(e,t,n,r);i!==null&&(i.row<r||i.row>=r+this.rows)&&this.scrollViewport(i.row-r-Math.floor(this.rows/2)),this.redraw()}onFindResults(e){return this.search.onResults(e)}clearFind(){this.search.clear(),this.redraw()}replyClipboard(e,t){t.epoch!==this.epoch||t.generation!==this.prompt.generation||t.atPrompt&&this.prompt.shell!==`prompt`||this.handlers.onReply(Xx(e,t.selection,t.terminator))}beforeInput(e){this.prompt.beforeInput(e)}dispose(){this.disposed||(this.disposed=!0,this.observer.disconnect(),this.cancelRender(),this.pointer.dispose(),this.search.dispose(),window.removeEventListener(`focus`,this.onWindowFocus),document.removeEventListener(`visibilitychange`,this.onVisibilityChange),this.images.clear(),this.prompt.release(),this.core.dispose(),this.element.remove())}redraw(){this.forceFull=!0,this.requestRender()}resizeCore(){this.core.resize(this.cols,this.rows,this.metrics.width,this.metrics.height,window.devicePixelRatio||1)}appearanceFor(e){let t=e.colors;return{fontSize:e.fontSize,fontFamily:QS(e.fontFamily),ligatures:e.ligatures,cursorText:t.cursorText,selectionBackground:t.selectionBackground,selectionForeground:t.selectionForeground,matchBackground:t.palette[8],activeMatchBorder:t.palette[3]}}measure(){return MS(this.context,this.options.fontSize,this.appearance.fontFamily,this.options.lineHeight,window.devicePixelRatio||1)}applyTerminalOptions(){let e=this.options.colors;this.core.setColors({foreground:ZS(e.foreground),background:ZS(e.background),cursor:ZS(e.cursor),palette:e.palette.map(ZS)}),this.core.setCursor(this.options.cursorStyle,this.options.cursorBlink),this.core.boldIsBright=this.options.boldIsBright,this.core.version=this.options.version,this.core.invalidate()}drain(){for(;!this.blocked&&this.backlog.length>0;){let e=this.backlog.shift();e&&this.process(e)}let e=this.core.title();e!==this.title&&(this.title=e,this.handlers.onTitle(e)),this.search.outputChanged(),this.cursorOn=!0,this.requestRender()}process(e){let t=e.data,n=e.replay;this.core.setReplies(!n);let r=0,i=this.scanner.scan(t,(e,i)=>(this.core.write(t.subarray(r,i)),r=i,this.handleOutput(e,n)));this.core.write(t.subarray(r,i)),i<t.length&&this.backlog.unshift({data:t.subarray(i),replay:n})}handleOutput(e,t){if(e.type===`sixel`)return this.decodeImage(vb(e.data));let n=YS.decode(e.data);if(n.startsWith(`1337;File=`))return this.decodeImage(bb(n.slice(10),{cellWidth:this.metrics.width,cellHeight:this.metrics.height,width:this.cols*this.metrics.width,height:this.rows*this.metrics.height,pixelRatio:window.devicePixelRatio||1}));if(n.startsWith(`133;`)||n.startsWith(`6973;`))return this.prompt.mark(n,this.options.clickToMoveCursor),!1;if(n.startsWith(`52;`)){let r=n.split(`;`),i=r[2];if(t||i===void 0)return!1;if(i===`?`)return this.handlers.onClipboardRead({selection:Jx(r[1]),terminator:e.terminator,generation:this.prompt.generation,epoch:this.epoch,atPrompt:this.prompt.shell===`prompt`}),!1;let a=Yx(i);return a!==null&&this.handlers.onClipboard(a),!1}if(n===`10;?`||n===`11;?`||n===`12;?`)return t||this.handlers.onReply(Zx(n,this.core.currentColors(),e.terminator)),!1;if(n.startsWith(`4;`)){if(!t)for(let t of Qx(n,this.core.currentColors().palette,e.terminator))this.handlers.onReply(t);return!1}if(n===`9;4`||n.startsWith(`9;4;`)){let e=$x(n,this.progress);return e!==null&&(this.progress=e,this.handlers.onProgress(e)),!1}if(t)return!1;let r=n.startsWith(`99;`)?this.notifications.add(XS.decode(e.data)):eS(n,e.data);return r!==null&&this.handlers.onNotify(r.title,r.body),!1}decodeImage(e){return this.blocked=!0,this.placeImage(e,this.epoch,window.devicePixelRatio||1),!0}async placeImage(e,t,n){let r=0,i=new Promise(e=>{r=window.setTimeout(()=>e(`timeout`),JS)});try{let r=await Promise.race([e,i]);r===`timeout`?(console.warn(`image decoding took too long, skipping the image`),$S(e)):r!==null&&(t===this.epoch&&!this.disposed?this.images.place(r,n,this.metrics.height):r.close())}catch(e){console.warn(`could not decode image`,e)}window.clearTimeout(r),!(t!==this.epoch||this.disposed)&&(this.blocked=!1,this.drain())}moveCursorTo(e){if(!this.options.clickToMoveCursor)return;let t=this.prompt.moveCursorInput(e,this.snapshot,this.viewportTop());t!==null&&(t!==``&&this.sendInput(t),this.core.clearSelection(),this.redraw())}sendInput(e){this.prompt.beforeInput(e),this.core.scrollbarState()?.offset!==this.maxOffset()&&(this.core.scrollToBottom(),this.redraw()),this.handlers.onData(e)}maxOffset(){let e=this.core.scrollbarState();return e?Math.max(0,e.total-e.len):0}viewportTop(){return this.core.toScreen({x:0,y:0})?.y??0}scrollViewport(e){let t=this.core.scrollbarState(),n=Math.trunc(e);if(t!==null){let e=Math.max(0,t.total-t.len);n=Math.max(0,Math.min(t.offset+n,e))-t.offset}n!==0&&(this.core.scroll(n),this.redraw())}requestRender(){!this.disposed&&this.sized&&this.frame===0&&(this.frame=window.requestAnimationFrame(()=>{this.frame=0,this.renderFrame()}))}cancelRender(){this.frame!==0&&window.cancelAnimationFrame(this.frame),this.frame=0,this.cursorTimer!==null&&window.clearTimeout(this.cursorTimer),this.cursorTimer=null,this.syncTimer!==null&&window.clearTimeout(this.syncTimer),this.syncTimer=null}renderFrame(){if(!this.disposed&&this.sized&&this.element.isConnected){this.frame!==0&&window.cancelAnimationFrame(this.frame),this.frame=0;try{this.draw(),this.renderFailed=!1}catch(e){this.renderFailed||console.error(`could not draw the terminal`,e),this.renderFailed=!0}}}draw(){if(this.core.isSynchronizedOutput()){this.syncTimer===null&&(this.syncTimer=window.setTimeout(()=>{this.syncTimer=null,this.core.endSynchronizedOutput(),this.requestRender()},qS));return}this.syncTimer!==null&&window.clearTimeout(this.syncTimer),this.syncTimer=null;let e=this.core.snapshot();this.snapshot=e;let t=this.focused&&e.cursorBlinking&&e.cursorVisible;t||(this.cursorOn=!0);let n=this.viewportTop(),r=this.images.visible(n,this.rows,this.metrics.height),i=this.core.cellSize(),a=this.core.kitty.images(e.rowData,i);FS({context:this.context,snapshot:e,metrics:this.metrics,appearance:this.appearance,forceFull:this.forceFull||r.length>0||a.length>0,cursorOn:this.cursorOn,previousCursorY:this.renderedCursorY,focused:this.focused,hoveredLink:this.pointer.hoveredLink?.range??null,highlights:this.search.highlights(e,n),pixelRatio:window.devicePixelRatio||1,drawLayer:e=>dx(this.context,a,e,this.metrics,i)}),dx(this.context,a,`aboveText`,this.metrics,i);for(let e of r)this.context.drawImage(e.bitmap,e.x*this.metrics.width,e.y*this.metrics.height,e.width,e.height);this.forceFull=r.length>0||a.length>0,this.renderedCursorY=this.cursorOn&&e.cursorVisible&&e.cursorY>=0?e.cursorY:null,e.cursorX>=0&&e.cursorY>=0&&(this.input.style.left=`${e.cursorX*this.metrics.width}px`,this.input.style.top=`${e.cursorY*this.metrics.height}px`),this.pointer.updateScrollbar(this.element.clientHeight),this.cursorTimer!==null&&window.clearTimeout(this.cursorTimer),this.cursorTimer=null,t&&(this.cursorTimer=window.setTimeout(()=>{this.cursorTimer=null,this.cursorOn=!this.cursorOn,this.requestRender()},KS))}copySelection(){let e=this.core.selectionText();e.length!==0&&(window.isSecureContext?navigator.clipboard.writeText(e):console.warn(`copy from the terminal needs https or localhost`))}optionIsMeta(e){if(!GS||!e.altKey||e.metaKey)return!1;let t=this.options.optionAsMeta;if(t===`off`)return!1;if(t===`both`)return!0;if(t===`left`)return this.heldOptionKeys.has(`AltLeft`);if(t===`right`)return this.heldOptionKeys.has(`AltRight`);throw Error(`unknown option as meta mode ${t}`)}onKeyDown=e=>{if((e.code===`AltLeft`||e.code===`AltRight`)&&this.heldOptionKeys.add(e.code),!this.handlers.beforeKey(e)){this.suppressedKeys.add(e.code);return}let t=this.optionIsMeta(e),n=t&&this.core.encoder.metaText(e)!==null;if(e.isComposing||this.composing||!n&&(e.key===`Process`||e.keyCode===229)||GS&&this.options.optionAsMeta!==`off`&&!t&&e.altKey&&!e.ctrlKey&&!e.metaKey&&([...e.key].length===1||e.key===`Dead`)||!n&&e.getModifierState(`AltGraph`)&&[...e.key].length===1){this.suppressedKeys.add(e.code);return}let r=e.key.toLowerCase();if(GS?e.metaKey&&r===`c`:e.ctrlKey&&e.shiftKey&&r===`c`||e.ctrlKey&&!e.shiftKey&&r===`insert`){this.copySelection(),e.preventDefault(),this.suppressedKeys.add(e.code);return}if((GS?e.metaKey&&r===`v`:e.ctrlKey&&e.shiftKey&&r===`v`||e.shiftKey&&!e.ctrlKey&&r===`insert`)||GS&&e.metaKey&&r===`q`){this.suppressedKeys.add(e.code);return}let i=this.core.encoder.encodeKey(e,`press`,n);i.length!==0&&(this.suppressedKeys.delete(e.code),e.preventDefault(),e.stopPropagation(),this.core.selectionText().length>0&&!e.shiftKey&&(this.core.clearSelection(),this.forceFull=!0),this.sendInput(i))};onKeyUp=e=>{if(this.heldOptionKeys.delete(e.code),this.suppressedKeys.delete(e.code)||e.isComposing||this.composing)return;let t=this.core.encoder.encodeKey(e,`release`,this.optionIsMeta(e));t.length!==0&&(e.preventDefault(),this.handlers.onData(t))};onInput=e=>{let t=e;if(this.composing||t.isComposing)return;let n=this.input.value||t.data||``;this.input.value=``,n.length>0&&this.sendInput(n)};onCompositionStart=()=>{this.composing=!0};onCompositionEnd=e=>{this.composing=!1;let t=this.input.value||e.data;this.input.value=``,t.length>0&&this.sendInput(t)};onPaste=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`)??``;t.length>0&&this.paste(t)};onCopy=e=>{let t=this.core.selectionText();t.length!==0&&e.clipboardData&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,t))};onWindowFocus=()=>{GS&&this.options.optionAsMeta!==`off`&&this.core.encoder.refreshKeyboardLayout()};onContextRestored=()=>{let e=window.devicePixelRatio||1;this.context.setTransform(e,0,0,e,0,0),this.redraw()};onVisibilityChange=()=>{document.visibilityState===`visible`&&this.redraw()};onFocus=()=>{this.focused=!0,this.cursorOn=!0,this.requestRender(),!this.disposed&&this.core.isFocusReporting()&&this.handlers.onReply(`\x1B[I`)};onBlur=()=>{this.focused=!1,this.heldOptionKeys.clear(),this.cursorOn=!0,this.requestRender(),!this.disposed&&this.core.isFocusReporting()&&this.handlers.onReply(`\x1B[O`)};installEvents(){this.input.addEventListener(`keydown`,this.onKeyDown),this.input.addEventListener(`keyup`,this.onKeyUp),this.input.addEventListener(`input`,this.onInput),this.input.addEventListener(`compositionstart`,this.onCompositionStart),this.input.addEventListener(`compositionend`,this.onCompositionEnd),this.input.addEventListener(`paste`,this.onPaste),this.input.addEventListener(`copy`,this.onCopy),this.input.addEventListener(`focus`,this.onFocus),this.input.addEventListener(`blur`,this.onBlur),this.canvas.addEventListener(`contextrestored`,this.onContextRestored),window.addEventListener(`focus`,this.onWindowFocus),document.addEventListener(`visibilitychange`,this.onVisibilityChange)}};function tC(e){let t=Cf(R(),e.machine);B({selection:e,loaded:e.sessionId===null,items:[],earlier:[],before:null,partial:``,requests:[],queue:[],settings:(e.sessionId===null?null:fr(Af(e)))??Kf(t.composer,R().sessions.find(t=>t.machine===e.machine&&t.id===e.sessionId)?.provider??t.composer?.provider??`claude`),context:null,paletteOpen:!1,unseen:R().unseen.filter(t=>e.sessionId===null||t!==Sr(e.machine,e.sessionId))}),hr(),(t.claudeAccounts.length>0||t.codexAccounts.length>0||t.openCode.available)&&Jf(e.machine,{claudeAccounts:t.claudeAccounts,codexAccounts:t.codexAccounts,openCode:t.openCode}),Xf(),e.sessionId!==null&&t.status===`online`&&F(e.machine,`sessions.open`,{projectId:e.projectId,sessionId:e.sessionId}).catch(V)}async function nC(e,t){let n=R().selection;if(n===null)throw Error(`no session selected`);`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission(),B({sentAt:Date.now()}),await F(n.machine,`sessions.send`,{sessionId:n.sessionId,projectId:n.projectId,prompt:e,settings:R().settings,delivery:t})}function rC(e){let t=R().selection;t!==null&&t.sessionId!==null&&F(t.machine,`sessions.unqueue`,{sessionId:t.sessionId,id:e}).catch(V)}function iC(e){let t=R().selection;t!==null&&t.sessionId!==null&&F(t.machine,`sessions.steer`,{sessionId:t.sessionId,id:e}).catch(V)}function aC(){let e=R().selection;e!==null&&e.sessionId!==null&&F(e.machine,`sessions.interrupt`,{sessionId:e.sessionId}).catch(V)}function oC(e,t,n){F(e,`sessions.stopTask`,{sessionId:t,taskId:n}).catch(V)}function sC(e,t,n){let r=R().selection;r!==null&&r.sessionId!==null&&F(r.machine,`sessions.respond`,{sessionId:r.sessionId,requestId:e,decision:t,answers:n}).catch(V)}async function cC(e){let t=R().selection;if(t!==null&&t.sessionId!==null)try{let n=await F(t.machine,`sessions.fork`,{sessionId:t.sessionId,projectId:t.projectId,messageId:e});tC({...t,sessionId:n.sessionId})}catch(e){V(e)}}async function lC(){let e=R().selection,t=R().before;if(e!==null&&e.sessionId!==null&&t!==null)try{let n=await F(e.machine,`sessions.earlier`,{sessionId:e.sessionId,before:t});if(R().selection!==e||R().before!==t)return;B({earlier:[...n.items,...R().earlier],before:n.before})}catch(e){V(e)}}async function uC(e,t){let n=R().selection;if(n!==null&&n.sessionId!==null)try{let r=await F(n.machine,`sessions.agent`,{sessionId:n.sessionId,projectId:n.projectId,agentId:t,parent:e});if(R().selection!==n)return;let i=new Set(r.map(e=>e.id)),a=R().items;B({items:[...a.filter(t=>t.parent!==e),...r,...a.filter(t=>t.parent===e&&!i.has(t.id))]})}catch(e){V(e)}}async function dC(e,t,n){B({sessions:R().sessions.map(r=>r.machine===e&&r.id===t?{...r,...n}:r)});let r=R().selection;if(n.status===`inactive`&&r?.machine===e&&r.sessionId===t){let e=R().sessions.filter(e=>e.status===`pinned`||e.status===`active`).sort((e,t)=>t.updatedAt-e.updatedAt).at(0);tC(e===void 0?{...r,sessionId:null}:{machine:e.machine,projectId:e.projectId,sessionId:e.id})}try{await F(e,`sessions.update`,{id:t,patch:n})}catch(e){V(e)}}async function fC(e,t){B({sessions:R().sessions.filter(n=>n.machine!==e||n.id!==t)}),ur(Sr(e,t));let n=R().selection;n?.machine===e&&n.sessionId===t&&tC({...n,sessionId:null});try{await F(e,`sessions.remove`,{id:t})}catch(e){V(e)}}var pC=new Map,mC=new Map,hC=new Map,gC=new Set,_C=null,vC=0,yC=!1;function bC(e){return Cw().open&&Ew()?.project?.activeTab===e&&!document.hidden&&document.hasFocus()}function xC(e){if(bC(e))return!1;let t=Cw();return t.alerts.includes(e)||ww({alerts:[...t.alerts,e]}),!0}function SC(e){if(!xC(e)||mC.has(e))return;let t=pC.get(e);t!==void 0&&performance.now()-t<5e3||mC.set(e,window.setTimeout(()=>{mC.delete(e),!bC(e)&&(pC.set(e,performance.now()),wC(e,``,`Bell`))},500))}function CC(e,t,n){xC(e)&&(window.clearTimeout(mC.get(e)),mC.delete(e),pC.set(e,performance.now()),wC(e,t,n))}function wC(e,t,n){let r=Dw(e),i=r?.project.tabs.find(t=>t.id===e);r&&i&&hp(t||Ow(i),n,{machine:xw(),project:r.projectId,tabId:e}).catch(e=>console.error(`could not show a notification`,e))}function TC(){let e=performance.now();if(e-vC<150)return;vC=e,_C??=new AudioContext,_C.state===`suspended`&&_C.resume();let t=_C.createOscillator(),n=_C.createGain(),r=_C.currentTime;t.frequency.value=880,n.gain.setValueAtTime(.1,r),n.gain.exponentialRampToValueAtTime(.001,r+.15),t.connect(n).connect(_C.destination),t.start(r),t.stop(r+.15)}function EC(e){let t=Cw();return{alerts:t.alerts.filter(t=>e(t)&&!bC(t)),quiet:t.quiet.filter(e)}}function DC(){let e=Cw().status===`active`;if(e&&!yC)for(let e of hC.keys())OC(e);yC=e}function OC(e){window.clearTimeout(hC.get(e)),gC.delete(e);let t=Date.now();hC.set(e,window.setTimeout(()=>{Cw().status===`active`&&(Date.now()-t>15e3?OC(e):(gC.add(e),kC()))},1e4))}async function kC(){await $t(xw())&&jC()}function AC(e){hC.delete(e),gC.delete(e),xC(e)&&wC(e,``,`No output for 10 seconds`)}function jC(){if(Cw().status===`active`)for(let e of gC)AC(e)}function MC(e){let t=Cw();t.quiet.includes(e)?(window.clearTimeout(hC.get(e)),hC.delete(e),gC.delete(e),ww({quiet:t.quiet.filter(t=>t!==e)})):ww({quiet:[...t.quiet,e]})}function NC(e){Cw().quiet.includes(e)&&OC(e)}function PC(e){window.clearTimeout(mC.get(e)),mC.delete(e),pC.delete(e),window.clearTimeout(hC.get(e)),hC.delete(e),gC.delete(e)}var FC=`3.6.8`,IC=`1.3.1`,LC=[{family:`FiraCode Nerd Font`,label:`Fira Code`},{family:`JetBrainsMono Nerd Font`,label:`JetBrains Mono`},{family:`CaskaydiaCove Nerd Font`,label:`Cascadia Code`},{family:`Hack Nerd Font`,label:`Hack`}],RC=[{value:`macos`,label:`macOS`},{value:`linux`,label:`Linux`},{value:`windows`,label:`Windows`}];async function zC(e){let t=`${e.font.size}px ${e.font.family}`;await Promise.all([document.fonts.load(t),document.fonts.load(`bold ${t}`)]);let n=document.documentElement.style;n.setProperty(`--pad-top`,`${e.padding.top}px`),n.setProperty(`--pad-right`,`${e.padding.right}px`),n.setProperty(`--pad-bottom`,`${e.padding.bottom}px`),n.setProperty(`--pad-left`,`${e.padding.left}px`)}function BC(e,t){let n=gf();return{fontFamily:e.font.family,fontSize:e.font.size,lineHeight:e.font.lineHeight,ligatures:e.font.ligatures,cursorStyle:e.cursor.style,cursorBlink:e.cursor.blink,scrollback:e.scrollback,boldIsBright:e.boldIsBright,colors:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorText:n.background,selectionBackground:n.selectionBackground,selectionForeground:n.foreground,palette:n.palette},version:VC(t),clickToMoveCursor:e.behavior.clickToMoveCursor,optionAsMeta:e.behavior.optionAsMeta}}function VC(e){if(e===`offsite`)return`offsite 0.0.0`;if(e===`ghostty`)return`ghostty ${IC}`;if(e===`iterm2`)return`iTerm2 ${FC}`;throw Error(`unknown terminal identity ${e}`)}var HC=52428800;async function UC(e,t){if(t.size>HC)throw Error(`File is larger than 50 MB`);return F(e,`files.upload`,{name:t.name,data:await WC(t)})}function WC(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=String(r.result);t(e.slice(e.indexOf(`,`)+1))},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}var GC=new Set,KC=null,qC=null;function JC(e){qC!==null&&clearTimeout(qC),KC=e,qC=window.setTimeout(()=>{qC=null,KC=null;for(let e of GC)e()},3e3);for(let e of GC)e()}function YC(e){return GC.add(e),()=>{GC.delete(e)}}function XC(){let e=(0,P.useSyncExternalStore)(YC,()=>KC);return e===null?null:(0,H.jsx)(`div`,{className:`bg-popover text-popover-foreground fixed right-4 bottom-4 z-50 rounded-md border px-3 py-2 shadow-md`,children:e})}var ZC=1048576;function QC(e){window.isSecureContext?navigator.clipboard.writeText(e).catch(e=>{console.warn(`could not copy to the clipboard`,e),JC(`Could not copy to the clipboard`)}):console.warn(`copy from the terminal needs https or localhost`)}async function $C(e){if(!window.isSecureContext){console.warn(`programs can read the clipboard only over https or localhost`),JC(`Programs can read the clipboard only over https or localhost`);return}let t;try{t=await navigator.clipboard.readText()}catch(e){console.warn(`could not read the clipboard`,e),JC(`Could not read the clipboard`);return}new TextEncoder().encode(t).length>ZC?(console.warn(`the clipboard is over 1 MiB, not replying`),JC(`The clipboard is too large to share (over 1 MiB)`)):e(t)}var ew={macos:{label:`Ctrl+V`,ctrl:!0,alt:!1,data:``},linux:{label:`Ctrl+V`,ctrl:!0,alt:!1,data:``},windows:{label:`Alt+V`,ctrl:!1,alt:!0,data:`\x1Bv`}};function tw(e,t){let n=ew[t];return e.key.toLowerCase()===`v`&&e.ctrlKey===n.ctrl&&e.altKey===n.alt&&!e.shiftKey&&!e.metaKey}async function nw(e,t){let n=[];for(let e of await navigator.clipboard.read()){let t=e.types.find(e=>e.startsWith(`image/`));t&&n.push(await e.getType(t))}return n.length===0?(JC(`No image in the clipboard`),!1):(await rw(e,t,n),!0)}async function rw(e,t,n){let r=[];for(let t of n){let n=await F(e,`terminal.paste`,{type:t.type,data:await WC(t)});r.push(/\s/.test(n)?`"${n}"`:n)}t.paste(r.join(` `))}function iw(e){console.error(`could not paste image`,e),JC(`Could not paste the image`)}function aw(e){return e.key===`Enter`&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey}function ow(e){let t=new eC(bw(),{onData:t=>{Cw().status===`active`&&Mw(e,sw(t))},onReply:t=>{t===`\x1B[I`||t===`\x1B[O`?Mw(e,t):Nw(e,t)},onResize:(t,n)=>jw({type:`resize`,id:e,cols:t,rows:n}),onTitle:t=>ww({titles:{...Cw().titles,[e]:t}}),onProgress:t=>ww({progress:{...Cw().progress,[e]:t}}),onBell:()=>{let n=Tw().behavior;n.bellSound&&TC(),n.bellFlash&&t.element.isConnected&&!document.hidden&&t.element.animate([{opacity:.4},{opacity:1}],{duration:200,easing:`ease-out`}),SC(e)},onNotify:(t,n)=>CC(e,t,n),onClipboard:QC,onClipboardRead:n=>{bC(e)&&$C(e=>t.replyClipboard(e,n))},onLink:e=>window.open(e,`_blank`,`noopener`),beforeKey:n=>{if(n.type!==`keydown`)return!0;let r=Tw(),i=Cf(R(),xw()).system;if(i===null)throw Error(`the terminal machine is not connected`);let a=i.platform;if(Cw().status===`active`&&r.behavior.modernizeShiftEnter&&aw(n)&&!t.isKittyKeyboard())return n.preventDefault(),t.beforeInput(`\x1B\r`),Mw(e,`\x1B\r`),!1;if(Cw().status===`active`&&r.behavior.pasteBrowserImages&&window.isSecureContext&&tw(n,a)){n.preventDefault();let r=ew[a].data;return t.beforeInput(r),nw(xw(),t).then(t=>{t||Mw(e,r)}).catch(t=>{iw(t),Mw(e,r)}),!1}return!Vw(n)||(n.preventDefault(),ww({finding:e}),document.querySelector(`[data-find]`)?.select(),!1)}});return t.element.addEventListener(`paste`,e=>{if(!e.clipboardData||e.clipboardData.getData(`text/plain`)!==``)return;let n=[...e.clipboardData.files].filter(e=>e.type.startsWith(`image/`));n.length!==0&&(e.preventDefault(),e.stopPropagation(),rw(xw(),t,n).catch(iw))},!0),t}function sw(e){if(!Cw().ctrl||(ww({ctrl:!1}),e.length!==1))return e;let t=e.toUpperCase().charCodeAt(0);return t>=64&&t<=95?String.fromCharCode(t-64):e}function cw(){return{titles:{},progress:{},alerts:[],finding:null,quiet:[]}}var lw=new TextEncoder,uw=new Map,dw=new Set,fw=new Set,pw={status:`connecting`,failure:null,loaded:!1,open:!1,instance:null,layout:{},ctrl:!1,...cw()},mw=null,hw=null,gw=!1;async function _w(){try{await Promise.all([Mb(),zC(Tw())]),ww({loaded:!0})}catch(e){console.error(`could not start the terminal`,e),ww({failure:D(e)});return}Yt({close:e=>{e===hw&&ww({status:`connecting`})},terminal:(e,t)=>{e===hw&&(zw(t),jC())},frame:(e,t)=>{e===hw&&Rw(t)}}),vw(),document.addEventListener(`visibilitychange`,()=>ww({})),window.addEventListener(`focus`,()=>{ww({}),mw!==null&&Hw(mw,Uw(mw))}),window.addEventListener(`blur`,()=>ww({})),`serviceWorker`in navigator&&navigator.serviceWorker.addEventListener(`message`,e=>{e.data.type===`select`&&Aw(e.data.machine,e.data.project,e.data.tabId)});let e=R().prefs,t=yw();Sf(()=>{vw();let n=R().prefs,r=yw(),i=n.theme!==e.theme||n.terminal!==e.terminal||r!==t;e=n,t=r,i&&Eee()}),Dee()}function vw(){let e=R().selection?.machine??null;if(e!==hw&&(hw!==null&&gw&&jw({type:`detach`}),Bw({}),dw.clear(),hw=e,gw=!1,ww({status:`connecting`,instance:null,layout:{},...cw()})),hw===null)return;let t=Cf(R(),hw).status===`online`;t&&!gw&&(gw=!0,jw({type:`attach`})),t||(gw=!1)}function yw(){return hw===null?null:Cf(R(),hw).config?.terminal.behavior.terminalIdentity??null}function bw(){if(hw===null)throw Error(`the terminal has no machine`);let e=Cf(R(),hw);if(e.config===null||e.system===null)throw Error(`${e.name} is not connected`);return BC(Tw(),e.config.terminal.behavior.terminalIdentity)}function xw(){if(hw===null)throw Error(`the terminal has no machine`);return hw}function Sw(e){return fw.add(e),()=>{fw.delete(e)}}function Cw(){return pw}function ww(e){pw={...pw,...e},pw={...pw,...EC(e=>uw.has(e))},DC();for(let e of fw)e()}function Tw(){return R().prefs.terminal}function Ew(){let e=R().selection?.projectId;return e===void 0?null:{projectId:e,project:pw.layout[e]??null}}function Dw(e){for(let[t,n]of Object.entries(pw.layout))if(n.tabs.some(t=>t.id===e))return{projectId:t,project:n};return null}function Ow(e){return(e.customName??pw.titles[e.id])||`Terminal`}function kw(e){ww({open:e})}function Aw(e,t,n){let r=R().selection;(r?.machine!==e||r.projectId!==t)&&tC({machine:e,projectId:t,sessionId:null}),ww({open:!0}),jw({type:`select`,projectId:t,tabId:n})}function jw(e){hw!==null&&Xt(hw)&&F(hw,`terminal`,e).catch(e=>console.error(`terminal request failed`,e))}function Mw(e,t){hw!==null&&Qt(hw,0,e,typeof t==`string`?lw.encode(t):t)}function Nw(e,t){hw!==null&&Qt(hw,1,e,lw.encode(t))}function Pw(e,t,n,r){Uw(e).find(t,n,r)}function Fw(e,t){return Uw(e).onFindResults(t)}function Iw(e){let t=Uw(e);t.clearFind(),ww({finding:null}),t.focus()}function Lw(){ww({ctrl:!pw.ctrl})}function Rw(e){let t=uw.get(e.id);if(!t)return;let n=e.kind===3,r=n&&dw.delete(e.id);r&&t.reset(),t.write(e.data,n),r&&dw.size===0&&ww({status:`active`}),n||NC(e.id),jC()}function zw(e){let t=e.type===`active`&&e.instance!==pw.instance;if(t&&Bw({}),Bw(e.layout),e.type===`active`){dw.clear(),uw.forEach((e,t)=>{dw.add(t),e.element.isConnected&&Hw(t,e)}),ww({...t&&{instance:e.instance,...cw()},status:dw.size===0?`active`:`connecting`,layout:e.layout});return}for(let e of dw)uw.has(e)||dw.delete(e);let n=R().selection?.projectId,r=n!==void 0&&(pw.layout[n]?.tabs.length??0)>0&&e.layout[n]?.tabs.length===0;ww({status:dw.size===0?`active`:`connecting`,layout:e.layout,...r&&{open:!1}})}function Bw(e){let t=new Set(Object.values(e).flatMap(e=>e.tabs.map(e=>e.id)));uw.forEach((e,n)=>{t.has(n)||(e.dispose(),uw.delete(n),PC(n))});for(let e of t)uw.has(e)||uw.set(e,ow(e))}function Vw(e){return e.key.toLowerCase()===`f`?l?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey:!1}function Hw(e,t){jw({type:`resize`,id:e,cols:t.cols,rows:t.rows})}function Uw(e){let t=uw.get(e);if(!t)throw Error(`terminal ${e} does not exist`);return t}function Tee(e,t){let n=Uw(e);t.append(n.element),n.fit();for(let e of uw.values())e.presize(n.cols,n.rows);return mw=e,Hw(e,n),n.focus(),()=>{n.element.remove(),mw===e&&(mw=null)}}async function Eee(){if(await zC(Tw()),uw.size>0){let e=bw();for(let t of uw.values())t.setOptions(e)}ww({})}function Dee(){let e=new URLSearchParams(location.search),t=e.get(`machine`),n=e.get(`project`),r=e.get(`terminal`);if(t===null||n===null||r===null)return;e.delete(`terminal`),history.replaceState(null,``,`/?${e}`);let i=Sw(()=>{pw.status===`active`&&hw===t&&(i(),Aw(t,n,Number(r)))})}var Ww=[[`path`,{d:`M12.001 5.00003V19.002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19.002 12.002L4.99998 12.002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Gw=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 8V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 15.75H12M12.25 15.75C12.25 15.8881 12.1381 16 12 16C11.8619 16 11.75 15.8881 11.75 15.75C11.75 15.6119 11.8619 15.5 12 15.5C12.1381 15.5 12.25 15.6119 12.25 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Kw=[[`path`,{d:`M5.92089 5.92089C8.15836 3.68342 9.2771 2.56468 10.5857 2.19562C11.5105 1.93479 12.4895 1.93479 13.4143 2.19562C14.7229 2.56468 15.8416 3.68342 18.0791 5.92089C20.3166 8.15836 21.4353 9.2771 21.8044 10.5857C22.0652 11.5105 22.0652 12.4895 21.8044 13.4143C21.4353 14.7229 20.3166 15.8416 18.0791 18.0791C15.8416 20.3166 14.7229 21.4353 13.4143 21.8044C12.4895 22.0652 11.5105 22.0652 10.5857 21.8044C9.2771 21.4353 8.15836 20.3166 5.92089 18.0791C3.68342 15.8416 2.56468 14.7229 2.19562 13.4143C1.93479 12.4895 1.93479 11.5105 2.19562 10.5857C2.56468 9.2771 3.68342 8.15836 5.92089 5.92089Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 8V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 15.75H12M12.25 15.75C12.25 15.8881 12.1381 16 12 16C11.8619 16 11.75 15.8881 11.75 15.75C11.75 15.6119 11.8619 15.5 12 15.5C12.1381 15.5 12.25 15.6119 12.25 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],qw=[[`path`,{d:`M15 19L15 6.65856C15 5.65277 15 5.14987 15.3087 5.02472C15.6173 4.89956 15.9806 5.25517 16.7071 5.96637L19 8.21091`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 5L9 17.3414C9 18.3472 9 18.8501 8.69134 18.9753C8.38268 19.1004 8.01942 18.7448 7.29289 18.0336L5 15.7891`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Jw=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Oee=[[`path`,{d:`M12 18.502V5.00195`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 13.002C18 13.002 13.5811 19.0019 12 19.002C10.4188 19.002 6 13.002 6 13.002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],kee=[[`path`,{d:`M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Yw=[[`path`,{d:`M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Aee=[[`path`,{d:`M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Xw=[[`path`,{d:`M12 5.5V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 11C18 11 13.5811 5.00001 12 5C10.4188 4.99999 6 11 6 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],jee=[[`path`,{d:`M15.6 8.40033V12.9003C15.6 14.3915 16.8088 15.6003 18.3 15.6003C19.7912 15.6003 21 14.3915 21 12.9003V12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C14.0265 21 15.8965 20.3302 17.4009 19.2M15.6 12.0003C15.6 13.9886 13.9882 15.6003 12 15.6003C10.0118 15.6003 8.4 13.9886 8.4 12.0003C8.4 10.0121 10.0118 8.40033 12 8.40033C13.9882 8.40033 15.6 10.0121 15.6 12.0003Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}]],Mee=[[`path`,{d:`M16.998 7.12652C17.3182 7.04393 17.654 7 18 7C20.2091 7 22 8.79086 22 11C22 13.2091 20.2091 15 18 15C17.6451 15 17.3009 14.9538 16.9733 14.867M16.998 7.12652C16.9993 7.08451 17 7.04233 17 7C17 4.79086 15.2091 3 13 3C11.0824 3 9.47994 4.34939 9.09041 6.15043M16.998 7.12652C16.9769 7.80763 16.7854 8.44584 16.4649 9M16.9733 14.867C16.9909 14.7472 17 14.6247 17 14.5C17 13.2905 16.1411 12.2816 15 12.05M16.9733 14.867C16.7957 16.0737 15.756 17 14.5 17H14C11.7909 17 10 18.7909 10 21M9.09041 6.15043C8.74377 6.05243 8.37801 6 8 6C5.79086 6 4 7.79086 4 10C4 10.3886 4.05542 10.7643 4.15878 11.1195M9.09041 6.15043C10.1015 6.43625 10.9498 7.10965 11.4649 8M4.15878 11.1195C2.9114 11.4832 2 12.6352 2 14C2 15.6569 3.34315 17 5 17C6.30622 17 7.41746 16.1652 7.82929 15M4.15878 11.1195C4.24921 11.4303 4.37632 11.7255 4.53513 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.8361 11.7435C11.3257 12.2353 10.453 12.3202 9.70713 11.9008C8.9612 11.4814 8.58031 10.6917 8.73535 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],Nee=[[`path`,{d:`M16 10L18.1494 10.6448C19.5226 11.0568 20.2092 11.2628 20.6046 11.7942C21 12.3256 21 13.0425 21 14.4761V22`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 9L11 9M8 13L11 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 22V19C12 18.0572 12 17.5858 11.7071 17.2929C11.4142 17 10.9428 17 10 17H9C8.05719 17 7.58579 17 7.29289 17.2929C7 17.5858 7 18.0572 7 19V22`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M2 22L22 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M3 22V6.71724C3 4.20649 3 2.95111 3.79118 2.32824C4.58237 1.70537 5.74742 2.04355 8.07752 2.7199L13.0775 4.17122C14.4836 4.57937 15.1867 4.78344 15.5933 5.33965C16 5.89587 16 6.65344 16 8.16857V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],Zw=[[`path`,{d:`M18 6L6.00081 17.9992M17.9992 18L6 6.00085`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Pee=[[`path`,{d:`M9 9L5 5M16 12H22M12 16V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],Fee=[[`path`,{d:`M11.7453 14.85L6.90436 12V7C6.90436 4.79086 8.72949 3 10.9809 3C12.3782 3 13.6113 3.6898 14.3458 4.74128`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.59961 19.1791C10.3266 20.2757 11.5866 21.0008 13.0192 21.0008C15.2707 21.0008 17.0958 19.21 17.0958 17.0008V12.0008L12.1612 9.0957`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M9.45166 13.5L9.45123 7.66938L13.8642 5.16938C15.814 4.06481 18.3072 4.72031 19.4329 6.63348C20.1593 7.86806 20.1388 9.32466 19.5089 10.4995`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M4.48963 13.4993C3.8595 14.6742 3.83887 16.131 4.56539 17.3657C5.6911 19.2789 8.18428 19.9344 10.1341 18.8298L14.5471 16.3298L14.643 10.7344`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M17.0959 17.6309C18.4415 17.5734 19.7295 16.8634 20.4529 15.634C21.5786 13.7209 20.9106 11.2745 18.9608 10.1699L14.5478 7.66992L9.48907 10.4255`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M6.90454 6.36938C5.55865 6.42662 4.27032 7.13672 3.54684 8.3663C2.42113 10.2795 3.08917 12.7258 5.03896 13.8304L9.45196 16.3304L14.5 13.5807`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],Qw=[[`path`,{d:`M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Iee=[[`path`,{d:`M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 12.5L10.5 15L16 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],$w=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],eT=[[`path`,{d:`M9.00005 18C9.00005 18 15 13.5811 15 12C15 10.4188 9 6 9 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],Lee=[[`path`,{d:`M18 15C18 15 13.5811 9.00001 12 9C10.4188 8.99999 6 15 6 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],tT=[[`path`,{d:`M7 19C7 19 10.6824 14 12 14C13.3176 14 17 19 17 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 5.00004C7 5.00004 10.6824 9.99999 12 10C13.3176 10 17 5 17 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],nT=[[`path`,{d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 12.5L10 14.5L15.5 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],rT=[[`path`,{d:`M9.50293 21.6846C10.302 21.8902 11.1397 21.9996 12.0029 21.9996C12.8662 21.9996 13.7039 21.8902 14.5029 21.6846`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.5029 2.31504C13.7039 2.10938 12.8662 2 12.0029 2C11.1397 2 10.302 2.10938 9.50293 2.31504`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.37109 14.6777C2.59251 15.4726 2.91663 16.2527 3.34826 17.0003C3.77988 17.7479 4.29346 18.4187 4.87109 19.0079`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M21.6451 9.32261C21.4237 8.52778 21.0996 7.74762 20.668 7.00002C20.2363 6.25243 19.7228 5.58165 19.1451 4.99248`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M21.6436 14.6777C21.4221 15.4726 21.098 16.2527 20.6664 17.0003C20.2348 17.7479 19.7212 18.4187 19.1436 19.0079`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M2.36952 9.32261C2.59093 8.52778 2.91506 7.74762 3.34668 7.00002C3.7783 6.25243 4.29188 5.58165 4.86952 4.99248`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],Ree=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],zee=[[`path`,{d:`M17.4776 8.00005C17.485 8.00002 17.4925 8 17.5 8C19.9853 8 22 10.0147 22 12.5C22 14.9853 19.9853 17 17.5 17H7C4.23858 17 2 14.7614 2 12C2 9.40034 3.98398 7.26407 6.52042 7.0227M17.4776 8.00005C17.4924 7.83536 17.5 7.66856 17.5 7.5C17.5 4.46243 15.0376 2 12 2C9.12324 2 6.76233 4.20862 6.52042 7.0227M17.4776 8.00005C17.3753 9.1345 16.9286 10.1696 16.2428 11M6.52042 7.0227C6.67826 7.00768 6.83823 7 7 7C8.12582 7 9.16474 7.37209 10.0005 8`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14 20.75V20.5C14 19.9477 13.5523 19.5 13 19.5H12M14 20.75V21C14 21.5523 13.5523 22 13 22H11C10.4477 22 10 21.5523 10 21V20.75M14 20.75H19M10 20.75V20.5C10 19.9477 10.4477 19.5 11 19.5H12M10 20.75H5M12 19.5V17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],iT=[[`path`,{d:`M17.4776 9.01106C17.485 9.01102 17.4925 9.01101 17.5 9.01101C19.9853 9.01101 22 11.0294 22 13.5193C22 15.8398 20.25 17.7508 18 18M17.4776 9.01106C17.4924 8.84606 17.5 8.67896 17.5 8.51009C17.5 5.46695 15.0376 3 12 3C9.12324 3 6.76233 5.21267 6.52042 8.03192M17.4776 9.01106C17.3753 10.1476 16.9286 11.1846 16.2428 12.0165M6.52042 8.03192C3.98398 8.27373 2 10.4139 2 13.0183C2 15.4417 3.71776 17.4632 6 17.9273M6.52042 8.03192C6.67826 8.01687 6.83823 8.00917 7 8.00917C8.12582 8.00917 9.16474 8.38194 10.0005 9.01101`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 13L12 21M12 13C11.2998 13 9.99153 14.9943 9.5 15.5M12 13C12.7002 13 14.0085 14.9943 14.5 15.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Bee=[[`path`,{d:`M18.2505 10.5H19.6403C21.4918 10.5 22.0421 10.7655 21.9975 12.0838C21.9237 14.2674 20.939 16.8047 17 17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.94627 20.6145C2.57185 18.02 2.07468 14.3401 2.00143 10.5001C1.96979 8.8413 2.45126 8.5 4.65919 8.5H15.3408C17.5487 8.5 18.0302 8.8413 17.9986 10.5001C17.9253 14.3401 17.4281 18.02 14.0537 20.6145C13.0934 21.3528 12.2831 21.5 10.9194 21.5H9.08064C7.71686 21.5 6.90658 21.3528 5.94627 20.6145Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.3089 2.5C10.7622 2.83861 10.0012 4 10.0012 5.5M7.53971 4C7.53971 4 7 4.5 7 5.5M14.0012 4C13.7279 4.1693 13.5 5 13.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],aT=[[`path`,{d:`M14 4H10C6.22876 4 4.34315 4 3.17157 5.17157C2 6.34315 2 8.22876 2 12C2 15.7712 2 17.6569 3.17157 18.8284C4.34315 20 6.22876 20 10 20H14C17.7712 20 19.6569 20 20.8284 18.8284C22 17.6569 22 15.7712 22 12C22 8.22876 22 6.34315 20.8284 5.17157C19.6569 4 17.7712 4 14 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 9L8.83981 10.5858C9.61327 11.2525 10 11.5858 10 12C10 12.4142 9.61327 12.7475 8.83981 13.4142L7 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13 16H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],oT=[[`path`,{d:`M14 21H16M14 21C13.1716 21 12.5 20.3284 12.5 19.5V17L12 17M14 21H10M10 21H8M10 21C10.8284 21 11.5 20.3284 11.5 19.5V17L12 17M12 17V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16 3H8C5.17157 3 3.75736 3 2.87868 3.87868C2 4.75736 2 6.17157 2 9V11C2 13.8284 2 15.2426 2.87868 16.1213C3.75736 17 5.17157 17 8 17H16C18.8284 17 20.2426 17 21.1213 16.1213C22 15.2426 22 13.8284 22 11V9C22 6.17157 22 4.75736 21.1213 3.87868C20.2426 3 18.8284 3 16 3Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Vee=[[`path`,{d:`M7.5 7.5L8.72654 8.55719C9.24218 9.00163 9.5 9.22386 9.5 9.5C9.5 9.77614 9.24218 9.99836 8.72654 10.4428L7.5 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.5 12.5H15.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 21C15.7497 21 17.6246 21 18.9389 20.0451C19.3634 19.7367 19.7367 19.3634 20.0451 18.9389C21 17.6246 21 15.7497 21 12C21 8.25027 21 6.3754 20.0451 5.06107C19.7367 4.6366 19.3634 4.26331 18.9389 3.95491C17.6246 3 15.7497 3 12 3C8.25027 3 6.3754 3 5.06107 3.95491C4.6366 4.26331 4.26331 4.6366 3.95491 5.06107C3 6.3754 3 8.25027 3 12C3 15.7497 3 17.6246 3.95491 18.9389C4.26331 19.3634 4.6366 19.7367 5.06107 20.0451C6.3754 21 8.25027 21 12 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],sT=[[`path`,{d:`M7 11V9C7 5.70017 7 4.05025 8.02513 3.02513C9.05025 2 10.7002 2 14 2C17.2998 2 18.9497 2 19.9749 3.02513C21 4.05025 21 5.70017 21 9V11C21 14.2998 21 15.9497 19.9749 16.9749C18.9497 18 17.2998 18 14 18C10.7002 18 9.05025 18 8.02513 16.9749C7 15.9497 7 14.2998 7 11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 6V15C3 18.2998 3 19.9497 4.02513 20.9749C5.05025 22 6.70017 22 10 22H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],cT=[[`path`,{d:`M4 12C4 8.22876 4 6.34315 5.17157 5.17157C6.34315 4 8.22876 4 12 4C15.7712 4 17.6569 4 18.8284 5.17157C20 6.34315 20 8.22876 20 12C20 15.7712 20 17.6569 18.8284 18.8284C17.6569 20 15.7712 20 12 20C8.22876 20 6.34315 20 5.17157 18.8284C4 17.6569 4 15.7712 4 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.5 2V4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M14.5 2V4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M9.5 20V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M14.5 20V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M13 9L9 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M15 13L13 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}],[`path`,{d:`M22 14.5L20 14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`7`}],[`path`,{d:`M4 9.5L2 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`8`}],[`path`,{d:`M4 14.5L2 14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`9`}],[`path`,{d:`M22 9.5L20 9.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`10`}]],lT=[[`path`,{d:`M19.5 5.5L18.8803 15.5251C18.7219 18.0864 18.6428 19.3671 18.0008 20.2879C17.6833 20.7431 17.2747 21.1273 16.8007 21.416C15.8421 22 14.559 22 11.9927 22C9.42312 22 8.1383 22 7.17905 21.4149C6.7048 21.1257 6.296 20.7408 5.97868 20.2848C5.33688 19.3626 5.25945 18.0801 5.10461 15.5152L4.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 5.5H21M16.0557 5.5L15.3731 4.09173C14.9196 3.15626 14.6928 2.68852 14.3017 2.39681C14.215 2.3321 14.1231 2.27454 14.027 2.2247C13.5939 2 13.0741 2 12.0345 2C10.9688 2 10.436 2 9.99568 2.23412C9.8981 2.28601 9.80498 2.3459 9.71729 2.41317C9.32164 2.7167 9.10063 3.20155 8.65861 4.17126L8.05292 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M9.5 16.5L9.5 10.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M14.5 16.5L14.5 10.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}]],uT=[[`path`,{d:`M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],dT=[[`path`,{d:`M16 6C16 6.55228 15.5523 7 15 7C14.4477 7 14 6.55228 14 6C14 5.44772 14.4477 5 15 5C15.5523 5 16 5.44772 16 6Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10 6C10 6.55228 9.55228 7 9 7C8.44772 7 8 6.55228 8 6C8 5.44772 8.44772 5 9 5C9.55228 5 10 5.44772 10 6Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M16 18C16 18.5523 15.5523 19 15 19C14.4477 19 14 18.5523 14 18C14 17.4477 14.4477 17 15 17C15.5523 17 16 17.4477 16 18Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11C15.5523 11 16 11.4477 16 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M10 18C10 18.5523 9.55228 19 9 19C8.44772 19 8 18.5523 8 18C8 17.4477 8.44772 17 9 17C9.55228 17 10 17.4477 10 18Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11C9.55228 11 10 11.4477 10 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],fT=[[`path`,{d:`M12 12H12.5M19 12H19.5M5 12H5.5M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13ZM19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11C18.4477 11 18 11.4477 18 12C18 12.5523 18.4477 13 19 13ZM5 13C5.55228 13 6 12.5523 6 12C6 11.4477 5.55228 11 5 11C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],pT=[[`path`,{d:`M8 7L16 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 11L12 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13 21.5V21C13 18.1716 13 16.7574 13.8787 15.8787C14.7574 15 16.1716 15 19 15H19.5M20 13.3431V10C20 6.22876 20 4.34315 18.8284 3.17157C17.6569 2 15.7712 2 12 2C8.22877 2 6.34315 2 5.17157 3.17157C4 4.34314 4 6.22876 4 10L4 14.5442C4 17.7892 4 19.4117 4.88607 20.5107C5.06508 20.7327 5.26731 20.9349 5.48933 21.1139C6.58831 22 8.21082 22 11.4558 22C12.1614 22 12.5141 22 12.8372 21.886C12.9044 21.8623 12.9702 21.835 13.0345 21.8043C13.3436 21.6564 13.593 21.407 14.0919 20.9081L18.8284 16.1716C19.4065 15.5935 19.6955 15.3045 19.8478 14.9369C20 14.5694 20 14.1606 20 13.3431Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],mT=[[`path`,{d:`M5.9925 12V18M9 14.9925L3 14.9925`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 22H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13 22C16.7712 22 18.6569 22 19.8284 20.8284C21 19.6569 21 17.7712 21 14V10.6569C21 9.83935 21 9.4306 20.8478 9.06306C20.6955 8.69552 20.4065 8.40649 19.8284 7.82843L15.0919 3.09188C14.593 2.593 14.3436 2.34355 14.0345 2.19575C13.9702 2.165 13.9044 2.13772 13.8372 2.11401C13.5141 2 13.1614 2 12.4558 2C9.21082 2 7.58831 2 6.48933 2.88607C6.26732 3.06508 6.06508 3.26731 5.88608 3.48933C5.14374 4.41003 5.02332 5.69818 5.00378 8M14 2.5V3C14 5.82843 14 7.24264 14.8787 8.12132C15.7574 9 17.1716 9 20 9H20.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],hT=[[`path`,{d:`M4.5 13V9.45584C4.5 6.21082 4.5 4.58831 5.38607 3.48933C5.56508 3.26731 5.76731 3.06508 5.98933 2.88607C7.08831 2 8.71082 2 11.9558 2C12.6614 2 13.0141 2 13.3372 2.11401C13.4044 2.13772 13.4702 2.165 13.5345 2.19575C13.8436 2.34355 14.093 2.593 14.5919 3.09188L19.3284 7.82843C19.9065 8.40649 20.1955 8.69552 20.3478 9.06306C20.5 9.4306 20.5 9.83935 20.5 10.6569V14C20.5 17.7712 20.5 19.6569 19.3284 20.8284C18.1569 22 16.2712 22 12.5 22C12.1508 22 11.8178 22 11.5 21.9991M13.5 2.5V3C13.5 5.82843 13.5 7.24264 14.3787 8.12132C15.2574 9 16.6716 9 19.5 9H20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3.5 22V20.6611C3.5 20.0548 3.74082 19.4735 4.16947 19.0448L8.81022 14.4041C9.06894 14.1453 9.41983 14 9.78571 14C10.1516 14 10.5025 14.1453 10.7612 14.4041L11.0959 14.7388C11.3547 14.9975 11.5 15.3484 11.5 15.7143C11.5 16.0802 11.3547 16.4311 11.0959 16.6898L6.45518 21.3305C6.02653 21.7592 5.44515 22 4.83894 22H3.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],gT=[[`path`,{d:`M8 7H16.75C18.8567 7 19.91 7 20.6667 7.50559C20.9943 7.72447 21.2755 8.00572 21.4944 8.33329C22 9.08996 22 10.1433 22 12.25C22 15.7612 22 17.5167 21.1573 18.7779C20.7926 19.3238 20.3238 19.7926 19.7779 20.1573C18.5167 21 16.7612 21 13.25 21H12C7.28595 21 4.92893 21 3.46447 19.5355C2 18.0711 2 15.714 2 11V7.94427C2 6.1278 2 5.21956 2.38032 4.53806C2.65142 4.05227 3.05227 3.65142 3.53806 3.38032C4.21956 3 5.1278 3 6.94427 3C8.10802 3 8.6899 3 9.19926 3.19101C10.3622 3.62712 10.8418 4.68358 11.3666 5.73313L12 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}]],_T=[[`path`,{d:`M2 13C2.06427 12.3499 2.20951 11.9124 2.53777 11.5858C3.12654 11 4.07416 11 5.9694 11H18.0306C19.9258 11 20.8735 11 21.4622 11.5858C21.7905 11.9124 21.9357 12.3499 22 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 7H16.75C18.8567 7 19.91 7 20.6667 7.50559C20.9943 7.72447 21.2755 8.00572 21.4944 8.33329C22 9.08996 22 10.1433 22 12.25C22 15.7612 22 17.5167 21.1573 18.7779C20.7926 19.3238 20.3238 19.7926 19.7779 20.1573C18.5167 21 16.7612 21 13.25 21H12C7.28595 21 4.92893 21 3.46447 19.5355C2 18.0711 2 15.714 2 11V7.94427C2 6.1278 2 5.21956 2.38032 4.53806C2.65142 4.05227 3.05227 3.65142 3.53806 3.38032C4.21956 3 5.1278 3 6.94427 3C8.10802 3 8.6899 3 9.19926 3.19101C10.3622 3.62712 10.8418 4.68358 11.3666 5.73313L12 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],vT=[[`path`,{d:`M7 19H13C15.8284 19 17.2426 19 18.1213 18.1213C19 17.2426 19 15.8284 19 13V10M19 10C19.7002 10 21.0085 11.9943 21.5 12.5M19 10C18.2998 10 16.9915 11.9943 16.5 12.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5 7L5 17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`5`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`3`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`4`}]],yT=[[`circle`,{cx:`12`,cy:`12`,r:`3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 12H3M15 12H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],bT=[[`path`,{d:`M19 17L19 11C19 8.17157 19 6.75736 18.1213 5.87868C17.2426 5 15.8284 5 13 5H10M10 5C10 4.29977 11.9943 2.99153 12.5 2.5M10 5C10 5.70023 11.9943 7.00847 12.5 7.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5 7.5L5 13.5C5 16.3284 5 17.7426 5.87868 18.6213C6.75736 19.5 8.17157 19.5 11 19.5H14M14 19.5C14 20.2002 12.0057 21.5085 11.5 22M14 19.5C14 18.7998 12.0057 17.4915 11.5 17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`19`,cy:`19`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`circle`,{cx:`5`,cy:`5`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`3`}]],xT=[[`path`,{d:`M6 8C7.10457 8 8 7.10457 8 6C8 4.89543 7.10457 4 6 4C4.89543 4 4 4.89543 4 6C4 7.10457 4.89543 8 6 8Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 20C13.1046 20 14 19.1046 14 18C14 16.8954 13.1046 16 12 16C10.8954 16 10 16.8954 10 18C10 19.1046 10.8954 20 12 20Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M18 8C19.1046 8 20 7.10457 20 6C20 4.89543 19.1046 4 18 4C16.8954 4 16 4.89543 16 6C16 7.10457 16.8954 8 18 8Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M6.01734 8.74067C6.01734 10.4142 5.77537 12.1995 9.22051 11.9855H12.0053M17.9929 8.57617C18.1259 11.9855 16.9199 11.7648 15.7861 11.9855H12.0053M12.0053 15.7001V11.9855`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],ST=[[`path`,{d:`M6 8L6 16`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 16V12C18 9.17156 18 7.75735 17.1213 6.87867C16.2426 5.99999 14.8284 5.99999 12 5.99999L11 5.99999M11 5.99999C11 5.29976 12.9943 3.99152 13.5 3.49999M11 5.99999C11 6.70022 12.9943 8.00846 13.5 8.49999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`6`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}],[`circle`,{cx:`6`,cy:`6`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`3`}],[`circle`,{cx:`18`,cy:`18`,r:`2`,stroke:`currentColor`,strokeWidth:`1.5`,key:`4`}]],CT=[[`path`,{d:`M10 20.5675C6.57143 21.7248 3.71429 20.5675 2 17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10 22V18.7579C10 18.1596 10.1839 17.6396 10.4804 17.1699C10.6838 16.8476 10.5445 16.3904 10.1771 16.2894C7.13394 15.4528 5 14.1077 5 9.64606C5 8.48611 5.38005 7.39556 6.04811 6.4464C6.21437 6.21018 6.29749 6.09208 6.31748 5.9851C6.33746 5.87813 6.30272 5.73852 6.23322 5.45932C5.95038 4.32292 5.96871 3.11619 6.39322 2.02823C6.39322 2.02823 7.27042 1.74242 9.26698 2.98969C9.72282 3.27447 9.95075 3.41686 10.1515 3.44871C10.3522 3.48056 10.6206 3.41384 11.1573 3.28041C11.8913 3.09795 12.6476 3 13.5 3C14.3524 3 15.1087 3.09795 15.8427 3.28041C16.3794 3.41384 16.6478 3.48056 16.8485 3.44871C17.0493 3.41686 17.2772 3.27447 17.733 2.98969C19.7296 1.74242 20.6068 2.02823 20.6068 2.02823C21.0313 3.11619 21.0496 4.32292 20.7668 5.45932C20.6973 5.73852 20.6625 5.87813 20.6825 5.9851C20.7025 6.09207 20.7856 6.21019 20.9519 6.4464C21.6199 7.39556 22 8.48611 22 9.64606C22 14.1077 19.8661 15.4528 16.8229 16.2894C16.4555 16.3904 16.3162 16.8476 16.5196 17.1699C16.8161 17.6396 17 18.1596 17 18.7579V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],wT=[[`path`,{d:`M12.5 19L12.5 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M10.5 22H14.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`7`,cy:`7`,r:`7`,transform:`matrix(-1 0 0 1 20.5 2)`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M8.5 4C9.15431 4.0385 9.49236 4.35899 10.0735 4.97301C11.1231 6.08206 12.1727 6.1746 12.8724 5.80492C13.922 5.2504 13.04 4.35221 14.2719 3.86409C15.0748 3.54595 15.1868 2.68026 14.7399 2`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M20 10C18.5 10 18.2338 11.2468 17 11C14.5 10.5 13.7916 11.0589 13.7916 12.2511C13.7916 13.4432 13.7916 13.4432 13.2717 14.3373C12.9335 14.9189 12.8153 15.5004 13.4894 16`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M6.5 2C4.64864 3.79995 3.5 6.3082 3.5 9.08251C3.5 14.5598 7.97715 19 13.5 19C16.2255 19 18.6962 17.9187 20.5 16.165`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`5`}]],TT=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.5 9.5C9.5 8.11929 10.6193 7 12 7C13.3807 7 14.5 8.11929 14.5 9.5C14.5 10.3569 14.0689 11.1131 13.4117 11.5636C12.7283 12.0319 12 12.6716 12 13.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],ET=[[`path`,{d:`M3 11.9896V14.5C3 17.7998 3 19.4497 4.02513 20.4749C5.05025 21.5 6.70017 21.5 10 21.5H14C17.2998 21.5 18.9497 21.5 19.9749 20.4749C21 19.4497 21 17.7998 21 14.5V11.9896C21 10.3083 21 9.46773 20.6441 8.74005C20.2882 8.01237 19.6247 7.49628 18.2976 6.46411L16.2976 4.90855C14.2331 3.30285 13.2009 2.5 12 2.5C10.7991 2.5 9.76689 3.30285 7.70242 4.90855L5.70241 6.46411C4.37533 7.49628 3.71179 8.01237 3.3559 8.74005C3 9.46773 3 10.3083 3 11.9896Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],DT=[[`path`,{d:`M12.8924 2.80982L21.4876 9.59547C21.8112 9.85095 22 10.2405 22 10.6528C22 11.3969 21.3969 12 20.6528 12H20V15.5C20 18.3284 20 19.7426 19.1213 20.6213C18.2426 21.5 16.8284 21.5 14 21.5H10C7.17157 21.5 5.75736 21.5 4.87868 20.6213C4 19.7426 4 18.3284 4 15.5V12H3.34716C2.60315 12 2 11.3969 2 10.6528C2 10.2405 2.1888 9.85095 2.5124 9.59547L11.1076 2.80982C11.3617 2.60915 11.6761 2.5 12 2.5C12.3239 2.5 12.6383 2.60915 12.8924 2.80982Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.5 21.5V17C14.5 16.0654 14.5 15.5981 14.299 15.25C14.1674 15.022 13.978 14.8326 13.75 14.701C13.4019 14.5 12.9346 14.5 12 14.5C11.0654 14.5 10.5981 14.5 10.25 14.701C10.022 14.8326 9.83261 15.022 9.70096 15.25C9.5 15.5981 9.5 16.0654 9.5 17V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],OT=[[`circle`,{cx:`7.5`,cy:`7.5`,r:`1.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],kT=[[`path`,{d:`M15.5 8C15.7761 8 16 7.77614 16 7.5C16 7.22386 15.7761 7 15.5 7M15.5 8C15.2239 8 15 7.77614 15 7.5C15 7.22386 15.2239 7 15.5 7M15.5 8V7`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2 2L22 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M17.2997 21.2997C16.0187 21.5 14.3303 21.5 12 21.5C7.77027 21.5 5.6554 21.5 4.25276 20.302C4.05358 20.1319 3.86808 19.9464 3.69797 19.7472C2.5 18.3446 2.5 16.2297 2.5 12C2.5 9.66971 2.5 7.98134 2.70033 6.70033M20.0355 20.0355C20.1281 19.943 20.217 19.8468 20.302 19.7472C21.5 18.3446 21.5 16.2297 21.5 12C21.5 7.77027 21.5 5.6554 20.302 4.25276C20.1319 4.05358 19.9464 3.86808 19.7472 3.69797C18.3446 2.5 16.2297 2.5 12 2.5C7.77027 2.5 5.6554 2.5 4.25276 3.69797C4.15317 3.78303 4.057 3.87193 3.96447 3.96447`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 16L7.50036 11.5004M21 16L18.5303 13.5303C18.1908 13.1908 17.7302 13 17.25 13C16.7698 13 16.3092 13.1908 15.9697 13.5303L14.75 14.75`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],AT=[[`path`,{d:`M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M21.5 13.5H16.5743C15.7322 13.5 15.0706 14.2036 14.6995 14.9472C14.2963 15.7551 13.4889 16.5 12 16.5C10.5111 16.5 9.70373 15.7551 9.30054 14.9472C8.92942 14.2036 8.26777 13.5 7.42566 13.5H2.5`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],jT=[[`circle`,{cx:`12`,cy:`11.9999`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 15.9999L12 11.9999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.875 8.24994L12 8.24994M11.75 8.24994C11.75 8.11187 11.8619 7.99994 12 7.99994C12.1381 7.99994 12.25 8.11187 12.25 8.24994C12.25 8.38801 12.1381 8.49994 12 8.49994C11.8619 8.49994 11.75 8.38801 11.75 8.24994Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],MT=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 16V12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 8.25H12M12.25 8.25C12.25 8.11193 12.1381 8 12 8C11.8619 8 11.75 8.11193 11.75 8.25C11.75 8.38807 11.8619 8.5 12 8.5C12.1381 8.5 12.25 8.38807 12.25 8.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],NT=[[`path`,{d:`M20.4999 16.5V8.5C20.4999 6.14298 20.4999 4.96447 19.7676 4.23223C19.0354 3.5 17.8569 3.5 15.4999 3.5H8.49988C6.14286 3.5 4.96434 3.5 4.23211 4.23223C3.49988 4.96447 3.49988 6.14298 3.49988 8.5V16.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M21.9841 20.5H2.01567C1.63273 20.5 1.38367 20.1088 1.55493 19.7764L3.49988 16.5H20.4999L22.4448 19.7764C22.6161 20.1088 22.367 20.5 21.9841 20.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],PT=[[`path`,{d:`M8.64298 3.14559L6.93816 3.93362C4.31272 5.14719 3 5.75397 3 6.75C3 7.74603 4.31272 8.35281 6.93817 9.56638L8.64298 10.3544C10.2952 11.1181 11.1214 11.5 12 11.5C12.8786 11.5 13.7048 11.1181 15.357 10.3544L17.0618 9.56638C19.6873 8.35281 21 7.74603 21 6.75C21 5.75397 19.6873 5.14719 17.0618 3.93362L15.357 3.14559C13.7048 2.38186 12.8786 2 12 2C11.1214 2 10.2952 2.38186 8.64298 3.14559Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20.788 11.0972C20.9293 11.2959 21 11.5031 21 11.7309C21 12.7127 19.6873 13.3109 17.0618 14.5072L15.357 15.284C13.7048 16.0368 12.8786 16.4133 12 16.4133C11.1214 16.4133 10.2952 16.0368 8.64298 15.284L6.93817 14.5072C4.31272 13.3109 3 12.7127 3 11.7309C3 11.5031 3.07067 11.2959 3.212 11.0972`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M20.3767 16.2661C20.7922 16.5971 21 16.927 21 17.3176C21 18.2995 19.6873 18.8976 17.0618 20.0939L15.357 20.8707C13.7048 21.6236 12.8786 22 12 22C11.1214 22 10.2952 21.6236 8.64298 20.8707L6.93817 20.0939C4.31272 18.8976 3 18.2995 3 17.3176C3 16.927 3.20778 16.5971 3.62334 16.2661`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],FT=[[`path`,{d:`M3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2.5V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],IT=[[`path`,{d:`M15.4812 16.9043C15.48 16.7344 15.4793 16.6494 15.4796 16.6252C15.4889 15.5876 15.6101 15.2943 16.3363 14.553C16.3532 14.5357 16.5411 14.35 16.917 13.9785C18.2007 12.7095 18.9961 10.9476 18.9961 9C18.9961 5.13401 15.8621 2 11.9961 2C8.1301 2 4.99609 5.13401 4.99609 9C4.99609 10.948 5.79184 12.7102 7.07601 13.9792C7.46075 14.3594 7.65312 14.5495 7.67314 14.5701C8.38589 15.3019 8.50393 15.5845 8.52348 16.6059C8.52402 16.6345 8.52402 16.7241 8.52402 16.9033C8.52402 16.9931 8.52402 17.038 8.52547 17.0759C8.56516 18.1209 9.40314 18.9589 10.4481 18.9986C10.486 19 10.5309 19 10.6207 19H13.4004C13.4759 19 13.5137 19 13.5456 18.999C14.6056 18.9652 15.4549 18.1098 15.4812 17.0495C15.482 17.0176 15.4817 16.9799 15.4812 16.9043Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.99609 19V20C9.99609 21.1046 10.8915 22 11.9961 22C13.1007 22 13.9961 21.1046 13.9961 20V19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M8.49609 16H15.4961`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],LT=[[`path`,{d:`M9.14339 10.691L9.35031 10.4841C11.329 8.50532 14.5372 8.50532 16.5159 10.4841C18.4947 12.4628 18.4947 15.671 16.5159 17.6497L13.6497 20.5159C11.671 22.4947 8.46279 22.4947 6.48405 20.5159C4.50532 18.5372 4.50532 15.329 6.48405 13.3503L6.9484 12.886`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M17.0516 11.114L17.5159 10.6497C19.4947 8.67095 19.4947 5.46279 17.5159 3.48405C15.5372 1.50532 12.329 1.50532 10.3503 3.48405L7.48405 6.35031C5.50532 8.32904 5.50532 11.5372 7.48405 13.5159C9.46279 15.4947 12.671 15.4947 14.6497 13.5159L14.8566 13.309`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],RT=[[`path`,{d:`M3 5H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 12H11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M15 12.0009H21M17.995 15.0059L17.995 9.00586`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 19H17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],zT=[[`path`,{d:`M12.9961 6L20.9961 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.9961 12L20.9961 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.9961 18L20.9961 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M4.23073 19.3478C4.59827 19.5 5.06421 19.5 5.99609 19.5C6.92798 19.5 7.39392 19.5 7.76146 19.3478C8.25152 19.1448 8.64086 18.7554 8.84385 18.2654C8.99609 17.8978 8.99609 17.4319 8.99609 16.5C8.99609 15.5681 8.99609 15.1022 8.84385 14.7346C8.64086 14.2446 8.25152 13.8552 7.76146 13.6522C7.39392 13.5 6.92798 13.5 5.99609 13.5C5.06421 13.5 4.59827 13.5 4.23073 13.6522C3.74067 13.8552 3.35132 14.2446 3.14833 14.7346C2.99609 15.1022 2.99609 15.5681 2.99609 16.5C2.99609 17.4319 2.99609 17.8978 3.14833 18.2654C3.35132 18.7554 3.74067 19.1448 4.23073 19.3478Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M2.99609 7.16667C2.99609 7.16667 3.74609 7.16667 4.49609 8.5C4.49609 8.5 6.87845 5.16667 8.99609 4.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],BT=[[`path`,{d:`M19.9264 22.2516V20.691C19.9264 20.288 20.0525 19.8966 20.2639 19.5531C21.7583 17.1245 22.2279 14.5196 21.9002 13.505C20.857 11.3418 17.3758 10.4907 15.76 10.2878L16.7966 5.12292C16.9705 4.30387 16.3513 3.47938 15.4135 3.28136C14.4758 3.08334 13.5746 3.58679 13.4007 4.40583L11.3462 14.0815L8.77462 12.4424C8.77462 12.4424 7.47969 11.406 6.44041 12.4424C5.40114 13.4788 6.44041 14.7701 6.44041 14.7701L10.3488 19.7776C10.6003 20.0997 10.7468 20.4908 10.7688 20.8984L10.8401 22.2177`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7.32936 1.85194C7.32936 1.85194 9.54861 1.58797 9.867 1.90156C10.1124 2.14335 9.867 4.36134 9.867 4.36134M9.867 1.90156L6.89808 4.84002M4.6477 9.59694C4.6477 9.59694 2.42845 9.86092 2.11005 9.54732C1.86463 9.30553 2.11005 7.08754 2.11005 7.08754M2.11005 9.54732L5.07898 6.60886`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],VT=[[`path`,{d:`M7.86292 12.6614L9.99786 14.4926L12.6639 4.26536C12.8615 3.5074 13.5456 2.97852 14.3283 2.97852C15.4379 2.97852 16.2572 4.01415 16.0026 5.09485L14.801 10.1953L16.489 10.4653C18.4186 10.755 19.3835 10.8997 20.063 11.3072C21.1856 11.9802 21.9988 12.9908 21.9988 14.4662C21.9988 15.4938 21.745 16.1833 21.128 18.0356C20.7365 19.211 20.5407 19.7988 20.2215 20.2639C19.6959 21.0299 18.9205 21.589 18.0283 21.8459C17.4863 22.0017 16.8673 22.0017 15.6292 22.0017H14.5798C12.9337 22.0017 12.1107 22.0017 11.3781 21.6995C11.2467 21.6453 11.1182 21.5841 10.9934 21.5163C10.2969 21.1378 9.77798 20.4986 8.74003 19.2203L5.37984 15.0816C4.86348 14.4458 4.86004 13.5355 5.37157 12.8957C5.98639 12.1266 7.11568 12.0204 7.86292 12.6614Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7.33204 2.10402C7.33204 2.10402 9.55241 1.83972 9.87097 2.1537C10.1165 2.39578 9.87097 4.61648 9.87097 4.61648M9.87097 2.1537L6.90055 5.09574M4.64903 9.85845C4.64903 9.85845 2.42866 10.1227 2.11011 9.80877C1.86456 9.56668 2.11011 7.34599 2.11011 7.34599M2.11011 9.80877L5.08053 6.86673`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],HT=[[`path`,{d:`M21.4961 12C21.4961 17.2467 17.2428 21.5 11.9961 21.5C10.368 21.5 8.83549 21.0904 7.49609 20.3687C5.62786 19.362 4.37071 20.2979 3.26202 20.4658C3.09383 20.4913 2.92634 20.4302 2.80606 20.31C2.6235 20.1274 2.58875 19.8451 2.6896 19.6074C3.12475 18.5818 3.5243 16.6382 2.9795 15C2.6659 14.057 2.49609 13.0483 2.49609 12C2.49609 6.75329 6.74939 2.5 11.9961 2.5C17.2428 2.5 21.4961 6.75329 21.4961 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.49609 9.5C9.49609 8.11929 10.6154 7 11.9961 7C13.3768 7 14.4961 8.11929 14.4961 9.5C14.4961 10.3569 14.0649 11.1131 13.4078 11.5636C12.7244 12.0319 11.9961 12.6716 11.9961 13.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.1211 16.75H11.9961M12.2461 16.75C12.2461 16.8881 12.1342 17 11.9961 17C11.858 17 11.7461 16.8881 11.7461 16.75C11.7461 16.6119 11.858 16.5 11.9961 16.5C12.1342 16.5 12.2461 16.6119 12.2461 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],UT=[[`path`,{d:`M1.99609 10.5C1.99609 9.72921 2.00956 8.97679 2.03519 8.2503C2.11892 5.87683 2.16078 4.69009 3.12616 3.71745C4.09154 2.74481 5.31179 2.6926 7.75229 2.58819C9.09126 2.5309 10.517 2.5 11.9961 2.5C13.4752 2.5 14.9009 2.5309 16.2399 2.58819C18.6804 2.6926 19.9006 2.74481 20.866 3.71745C21.8314 4.69009 21.8733 5.87683 21.957 8.2503C21.9826 8.97679 21.9961 9.72921 21.9961 10.5C21.9961 11.2708 21.9826 12.0232 21.957 12.7497C21.8733 15.1232 21.8314 16.3099 20.866 17.2826C19.9006 18.2552 18.6804 18.3074 16.2398 18.4118C15.5059 18.4432 14.7459 18.4667 13.9654 18.4815C13.2242 18.4955 12.8537 18.5026 12.5281 18.6266C12.2025 18.7506 11.9285 18.9855 11.3806 19.4553L9.20113 21.3242C9.06882 21.4376 8.90029 21.5 8.726 21.5C8.32289 21.5 7.99609 21.1732 7.99609 20.7701V18.4219C7.91451 18.4186 7.83324 18.4153 7.75229 18.4118C5.31179 18.3074 4.09154 18.2552 3.12616 17.2825C2.16078 16.3099 2.11892 15.1232 2.03519 12.7497C2.00956 12.0232 1.99609 11.2708 1.99609 10.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.9961 10.5V6.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.1211 14.25H11.9961M12.2461 14.25C12.2461 14.3881 12.1342 14.5 11.9961 14.5C11.858 14.5 11.7461 14.3881 11.7461 14.25C11.7461 14.1119 11.858 14 11.9961 14C12.1342 14 12.2461 14.1119 12.2461 14.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],WT=[[`path`,{d:`M7.87124 12.6711L10.0051 14.5001L12.6698 4.28528C12.8673 3.52824 13.5511 3 14.3334 3C15.4424 3 16.2613 4.03438 16.0068 5.11376L14.8058 10.208L16.493 10.4777C18.4216 10.767 19.386 10.9116 20.0652 11.3186C21.1872 11.9907 22 13.0001 22 14.4737C22 15.5001 21.7463 16.1887 21.1296 18.0388C20.7383 19.2128 20.5426 19.7998 20.2236 20.2644C19.6983 21.0294 18.9233 21.5879 18.0315 21.8444C17.4898 22.0001 16.8711 22.0001 15.6336 22.0001H14.5847C12.9395 22.0001 12.1169 22.0001 11.3846 21.6982C11.2533 21.6441 11.1249 21.583 11.0001 21.5152C10.304 21.1372 9.78533 20.4988 8.74791 19.222L5.38941 15.0884C4.87331 14.4533 4.86987 13.5442 5.38114 12.9051C5.99565 12.137 7.12437 12.0309 7.87124 12.6711Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.95596 2.49064C6.95596 2.49064 6.70432 4.76405 6.95596 5.01188M6.95596 5.01188C7.28241 5.33331 9.55781 5.06274 9.55781 5.06274M6.95596 5.01188L10 2M5.04404 9.50936C5.04404 9.50936 5.29568 7.23595 5.04404 6.98812M5.04404 6.98812C4.71759 6.66669 2.44219 6.93726 2.44219 6.93726M5.04404 6.98812L2 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],GT=[[`path`,{d:`M2.46186 20.4697C2.16896 20.7626 2.16896 21.2374 2.46186 21.5303C2.75475 21.8232 3.22962 21.8232 3.52252 21.5303L2.99219 21L2.46186 20.4697ZM10.0225 15.0303C10.3154 14.7374 10.3154 14.2626 10.0225 13.9697C9.72962 13.6768 9.25475 13.6768 8.96186 13.9697L9.49219 14.5L10.0225 15.0303ZM2.99219 21L3.52252 21.5303L10.0225 15.0303L9.49219 14.5L8.96186 13.9697L2.46186 20.4697L2.99219 21Z`,fill:`currentColor`,key:`0`}],[`path`,{d:`M21.5225 3.53033C21.8154 3.23744 21.8154 2.76256 21.5225 2.46967C21.2296 2.17678 20.7548 2.17678 20.4619 2.46967L20.9922 3L21.5225 3.53033ZM13.9619 8.96967C13.669 9.26256 13.669 9.73744 13.9619 10.0303C14.2548 10.3232 14.7296 10.3232 15.0225 10.0303L14.4922 9.5L13.9619 8.96967ZM20.9922 3L20.4619 2.46967L13.9619 8.96967L14.4922 9.5L15.0225 10.0303L21.5225 3.53033L20.9922 3Z`,fill:`currentColor`,key:`1`}],[`path`,{d:`M14.2688 5.00098C14.2688 5.00098 13.6464 9.10202 14.2688 9.72438C14.8911 10.3467 18.9922 9.72436 18.9922 9.72436`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M9.71561 19.001C9.71561 19.001 10.3379 14.8999 9.71558 14.2776C9.09323 13.6552 4.99219 14.2776 4.99219 14.2776`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],KT=[[`path`,{d:`M16 12H8`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}]],qT=[[`path`,{d:`M6.00449 12.5V12M18.0045 12.5V12M12.0045 12.5V12M7.00449 12.5C7.00449 11.9477 6.55677 11.5 6.00449 11.5C5.4522 11.5 5.00449 11.9477 5.00449 12.5C5.00449 13.0523 5.4522 13.5 6.00449 13.5C6.55677 13.5 7.00449 13.0523 7.00449 12.5ZM19.0045 12.5C19.0045 11.9477 18.5568 11.5 18.0045 11.5C17.4522 11.5 17.0045 11.9477 17.0045 12.5C17.0045 13.0523 17.4522 13.5 18.0045 13.5C18.5568 13.5 19.0045 13.0523 19.0045 12.5ZM13.0045 12.5C13.0045 11.9477 12.5568 11.5 12.0045 11.5C11.4522 11.5 11.0045 11.9477 11.0045 12.5C11.0045 13.0523 11.4522 13.5 12.0045 13.5C12.5568 13.5 13.0045 13.0523 13.0045 12.5Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],JT=[[`path`,{d:`M15.5 18C15.5 19.933 13.933 21.5 12 21.5C10.067 21.5 8.5 19.933 8.5 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19.2311 18H4.76887C3.79195 18 3 17.208 3 16.2311C3 15.762 3.18636 15.3121 3.51809 14.9803L4.12132 14.3771C4.68393 13.8145 5 13.0514 5 12.2558V9.5C5 5.63401 8.13401 2.5 12 2.5C15.866 2.5 19 5.634 19 9.5V12.2558C19 13.0514 19.3161 13.8145 19.8787 14.3771L20.4819 14.9803C20.8136 15.3121 21 15.762 21 16.2311C21 17.208 20.208 18 19.2311 18Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],YT=[[`path`,{d:`M11.9922 8L11.9922 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.1172 15.75L11.9922 15.75M12.2422 15.75C12.2422 15.8881 12.1303 16 11.9922 16C11.8541 16 11.7422 15.8881 11.7422 15.75C11.7422 15.6119 11.8541 15.5 11.9922 15.5C12.1303 15.5 12.2422 15.6119 12.2422 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M13.5067 2C14.733 2 15.3461 2 15.8974 2.22836C16.4487 2.45672 16.8823 2.89027 17.7494 3.75736L20.2346 6.24264C21.1017 7.10973 21.5353 7.54328 21.7636 8.09459C21.992 8.6459 21.992 9.25903 21.992 10.4853V13.5147C21.992 14.741 21.992 15.3541 21.7636 15.9054C21.5353 16.4567 21.1017 16.8903 20.2346 17.7574L17.7494 20.2426C16.8823 21.1097 16.4487 21.5433 15.8974 21.7716C15.3461 22 14.733 22 13.5067 22H10.4773C9.25105 22 8.63792 22 8.08659 21.7716C7.53527 21.5433 7.10172 21.1097 6.23462 20.2426L3.74948 17.7573C2.88242 16.8903 2.44889 16.4567 2.22054 15.9054C1.99219 15.3541 1.99219 14.741 1.99219 13.5148V10.4852C1.99219 9.259 1.99219 8.64589 2.22054 8.09458C2.44889 7.54328 2.88242 7.10974 3.74948 6.24265L6.23463 3.75743C7.10172 2.8903 7.53527 2.45674 8.08659 2.22837C8.63792 2 9.25105 2 10.4773 2H13.5067Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],XT=[[`path`,{d:`M21 11C21 7.22876 21 5.34315 19.8284 4.17157C18.6569 3 16.7712 3 13 3H11C7.22876 3 5.34315 3 4.17157 4.17157C3 5.34315 3 7.22876 3 11V13C3 16.7712 3 18.6569 4.17157 19.8284C5.34315 21 7.22876 21 11 21H13C16.7712 21 18.6569 21 19.8284 19.8284C21 18.6569 21 16.7712 21 13V11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 3V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M14 9L15.1082 9.87868C16.3694 10.8787 17 11.3787 17 12C17 12.6213 16.3694 13.1213 15.1082 14.1213L14 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],ZT=[[`path`,{d:`M13 3H11C7.22876 3 5.34315 3 4.17157 4.17157C3 5.34315 3 7.22876 3 11V13C3 16.7712 3 18.6569 4.17157 19.8284C5.34315 21 7.22876 21 11 21H13C16.7712 21 18.6569 21 19.8284 19.8284C21 18.6569 21 16.7712 21 13V11C21 7.22876 21 5.34315 19.8284 4.17157C18.6569 3 16.7712 3 13 3Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9 3V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],QT=[[`path`,{d:`M18.1688 12L19.713 10.4558C21.4186 8.75022 21.4186 5.98485 19.713 4.27922C18.0073 2.57359 15.242 2.57359 13.5363 4.27922L4.27141 13.5442C2.56578 15.2498 2.56578 18.0152 4.27141 19.7208C5.97704 21.4264 8.7424 21.4264 10.448 19.7208L13.9224 16.2464C14.9884 15.1804 14.9884 13.4521 13.9224 12.386C12.8564 11.32 11.128 11.32 10.062 12.386L8.1318 14.3162`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],$T=[[`path`,{d:`M16.4249 4.60509L17.4149 3.6151C18.2351 2.79497 19.5648 2.79497 20.3849 3.6151C21.205 4.43524 21.205 5.76493 20.3849 6.58507L19.3949 7.57506M16.4249 4.60509L9.76558 11.2644C9.25807 11.772 8.89804 12.4078 8.72397 13.1041L8 16L10.8959 15.276C11.5922 15.102 12.228 14.7419 12.7356 14.2344L19.3949 7.57506M16.4249 4.60509L19.3949 7.57506`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18.9999 13.5C18.9999 16.7875 18.9999 18.4312 18.092 19.5376C17.9258 19.7401 17.7401 19.9258 17.5375 20.092C16.4312 21 14.7874 21 11.4999 21H11C7.22876 21 5.34316 21 4.17159 19.8284C3.00003 18.6569 3 16.7712 3 13V12.5C3 9.21252 3 7.56879 3.90794 6.46244C4.07417 6.2599 4.2599 6.07417 4.46244 5.90794C5.56879 5 7.21252 5 10.5 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],eE=[[`path`,{d:`M6 22V13.6944C6 12.1287 6 11.3459 6.21454 10.6077C6.42908 9.86948 6.84589 9.21812 7.6795 7.91542L10.3359 3.76419C11.0885 2.58806 11.4648 2 12 2C12.5352 2 12.9115 2.58806 13.6641 3.76419L16.3205 7.91542C17.1541 9.21812 17.5709 9.86948 17.7855 10.6077C18 11.3459 18 12.1287 18 13.6944V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 11C7.63152 11.3231 8.4887 11.9732 9.28009 11.9991C10.2988 12.0324 10.9868 11.1372 12 11.1372C13.0132 11.1372 13.7012 12.0324 14.7199 11.9991C15.5113 11.9732 16.3685 11.3231 17 11`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 12L12 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M10 5H14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],tE=[[`path`,{d:`M7.5 8C6.95863 8.1281 6.49932 8.14239 5.99268 8.45891C5.07234 9.03388 4.85108 9.71674 5.08821 10.7612C5.94028 14.5139 9.48599 18.0596 13.2388 18.9117C14.2834 19.1489 14.9661 18.928 15.5416 18.0077C15.8411 17.5288 15.8716 17.0081 16 16.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 7.79915C12.1776 7.77794 12.3182 7.74034 12.4295 7.68235C13.3997 7.17686 13.9291 5.53361 14.4498 4.60009C14.9311 3.73715 15.1718 3.30567 15.7379 3.10227C16.3041 2.89888 16.6448 3.02205 17.3262 3.26839C18.9197 3.8445 20.1555 5.08032 20.7316 6.6738C20.9779 7.35521 21.1011 7.69591 20.8977 8.26204C20.6943 8.82817 20.2628 9.06884 19.3999 9.55018C18.4608 10.074 16.7954 10.6108 16.2905 11.5898C16.2345 11.6983 16.1978 11.8327 16.1769 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M3 21L8 16`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 3L21 21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],nE=[[`path`,{d:`M3 21L8 16`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M13.2585 18.8714C9.51516 18.0215 5.97844 14.4848 5.12853 10.7415C4.99399 10.1489 4.92672 9.85266 5.12161 9.37197C5.3165 8.89129 5.55457 8.74255 6.03071 8.44509C7.10705 7.77265 8.27254 7.55888 9.48209 7.66586C11.1793 7.81598 12.0279 7.89104 12.4512 7.67048C12.8746 7.44991 13.1622 6.93417 13.7376 5.90269L14.4664 4.59604C14.9465 3.73528 15.1866 3.3049 15.7513 3.10202C16.316 2.89913 16.6558 3.02199 17.3355 3.26771C18.9249 3.84236 20.1576 5.07505 20.7323 6.66449C20.978 7.34417 21.1009 7.68401 20.898 8.2487C20.6951 8.8134 20.2647 9.05346 19.4039 9.53358L18.0672 10.2792C17.0376 10.8534 16.5229 11.1406 16.3024 11.568C16.0819 11.9955 16.162 12.8256 16.3221 14.4859C16.4399 15.7068 16.2369 16.88 15.5555 17.9697C15.2577 18.4458 15.1088 18.6839 14.6283 18.8786C14.1477 19.0733 13.8513 19.006 13.2585 18.8714Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],rE=[[`path`,{d:`M18.8906 12.846C18.5371 14.189 16.8667 15.138 13.5257 17.0361C10.296 18.8709 8.6812 19.7884 7.37983 19.4196C6.8418 19.2671 6.35159 18.9776 5.95624 18.5787C5 17.6139 5 15.7426 5 12C5 8.2574 5 6.3861 5.95624 5.42132C6.35159 5.02245 6.8418 4.73288 7.37983 4.58042C8.6812 4.21165 10.296 5.12907 13.5257 6.96393C16.8667 8.86197 18.5371 9.811 18.8906 11.154C19.0365 11.7084 19.0365 12.2916 18.8906 12.846Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],iE=[[`path`,{d:`M15.5 2V6M8.5 6V2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.00446 7.61331C5.93719 6.74273 6.63957 6 7.53014 6H16.4699C17.3604 6 18.0628 6.74273 17.9955 7.61331L17.8117 9.99197C17.6796 11.7019 17.1011 13.3498 16.132 14.7773L15.5312 15.6622C14.9638 16.4979 14.0077 17 12.9838 17H11.0162C9.99228 17 9.03617 16.4979 8.46881 15.6622L7.86803 14.7773C6.89885 13.3498 6.32041 11.7019 6.18827 9.99197L6.00446 7.61331Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 17V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M11 9H13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],aE=[[`path`,{d:`M11.9922 8.99988L9.49219 11.4999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M14.9922 11.9999L12.4922 14.4999`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M4.99219 18.9999L2.99237 21.0002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M7.19135 9.52039L14.4716 16.8006`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M7.71255 10.0399L6.15251 11.6C5.32501 12.4275 4.86013 13.5498 4.86013 14.72C4.86013 14.8523 4.80343 14.9876 4.70894 15.1227C4.03073 16.0921 3.71818 17.2257 4.55476 18.0623L5.93031 19.4378C6.76675 20.2743 7.90038 19.9622 8.86953 19.2839C9.00474 19.1893 9.14021 19.1325 9.2726 19.1325C10.4429 19.1325 11.5652 18.6676 12.3927 17.8401L13.9527 16.2801L7.71255 10.0399Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M18.9922 2.99988L17.4072 4.84909C16.7965 5.56152 16.4912 5.91773 16.625 6.20881C16.7589 6.49988 17.2281 6.49988 18.1664 6.49988H18.5398C19.5813 6.49988 20.1021 6.49988 20.229 6.81109C20.3559 7.12229 19.9836 7.48644 19.2391 8.21474L17.4141 9.99988`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],oE=[[`path`,{d:`M20.4879 15C19.2524 18.4956 15.9187 21 12 21C7.02943 21 3 16.9706 3 12C3 7.02943 7.02943 3 12 3C15.7292 3 18.9286 5.26806 20.2941 8.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15 9H18C19.4142 9 20.1213 9 20.5607 8.56066C21 8.12132 21 7.41421 21 6V3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],sE=[[`path`,{d:`M3.04712 13C3.01082 12.6717 2.99219 12.338 2.99219 12C2.99219 7.02944 7.02162 3 11.9922 3C14.8195 3 17.3422 4.30367 18.9922 6.34267M20.9373 11C20.9736 11.3283 20.9922 11.662 20.9922 12C20.9922 16.9706 16.9628 21 11.9922 21C9.16492 21 6.64214 19.6963 4.99219 17.6573`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15.9922 7H16.9922C18.4064 7 19.1135 7 19.5528 6.56066C19.9922 6.12132 19.9922 5.41421 19.9922 4V3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M7.99219 17H6.99219C5.57797 17 4.87087 17 4.43153 17.4393C3.99219 17.8787 3.99219 18.5858 3.99219 20V21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],cE=[[`path`,{d:`M2.49219 15.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 8.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],lE=[[`path`,{d:`M17 17L21 21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],uE=[[`path`,{d:`M19 4H5C4.06812 4 3.60218 4 3.23463 4.15224C2.74458 4.35523 2.35523 4.74458 2.15224 5.23463C2 5.60218 2 6.06812 2 7C2 7.93188 2 8.39782 2.15224 8.76537C2.35523 9.25542 2.74458 9.64477 3.23463 9.84776C3.60218 10 4.06812 10 5 10H19C19.9319 10 20.3978 10 20.7654 9.84776C21.2554 9.64477 21.6448 9.25542 21.8478 8.76537C22 8.39782 22 7.93188 22 7C22 6.06812 22 5.60218 21.8478 5.23463C21.6448 4.74458 21.2554 4.35523 20.7654 4.15224C20.3978 4 19.9319 4 19 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19 14H5C4.06812 14 3.60218 14 3.23463 14.1522C2.74458 14.3552 2.35523 14.7446 2.15224 15.2346C2 15.6022 2 16.0681 2 17C2 17.9319 2 18.3978 2.15224 18.7654C2.35523 19.2554 2.74458 19.6448 3.23463 19.8478C3.60218 20 4.06812 20 5 20H19C19.9319 20 20.3978 20 20.7654 19.8478C21.2554 19.6448 21.6448 19.2554 21.8478 18.7654C22 18.3978 22 17.9319 22 17C22 16.0681 22 15.6022 21.8478 15.2346C21.6448 14.7446 21.2554 14.3552 20.7654 14.1522C20.3978 14 19.9319 14 19 14Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M6.125 7H6M6.25 7C6.25 7.13807 6.13807 7.25 6 7.25C5.86193 7.25 5.75 7.13807 5.75 7C5.75 6.86193 5.86193 6.75 6 6.75C6.13807 6.75 6.25 6.86193 6.25 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M10.125 7H10M10.25 7C10.25 7.13807 10.1381 7.25 10 7.25C9.86193 7.25 9.75 7.13807 9.75 7C9.75 6.86193 9.86193 6.75 10 6.75C10.1381 6.75 10.25 6.86193 10.25 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M6.125 17H6M6.25 17C6.25 17.1381 6.13807 17.25 6 17.25C5.86193 17.25 5.75 17.1381 5.75 17C5.75 16.8619 5.86193 16.75 6 16.75C6.13807 16.75 6.25 16.8619 6.25 17Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M10.125 17H10M10.25 17C10.25 17.1381 10.1381 17.25 10 17.25C9.86193 17.25 9.75 17.1381 9.75 17C9.75 16.8619 9.86193 16.75 10 16.75C10.1381 16.75 10.25 16.8619 10.25 17Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],dE=[[`path`,{d:`M21.3175 7.14139L20.8239 6.28479C20.4506 5.63696 20.264 5.31305 19.9464 5.18388C19.6288 5.05472 19.2696 5.15664 18.5513 5.36048L17.3311 5.70418C16.8725 5.80994 16.3913 5.74994 15.9726 5.53479L15.6357 5.34042C15.2766 5.11043 15.0004 4.77133 14.8475 4.37274L14.5136 3.37536C14.294 2.71534 14.1842 2.38533 13.9228 2.19657C13.6615 2.00781 13.3143 2.00781 12.6199 2.00781H11.5051C10.8108 2.00781 10.4636 2.00781 10.2022 2.19657C9.94085 2.38533 9.83106 2.71534 9.61149 3.37536L9.27753 4.37274C9.12465 4.77133 8.84845 5.11043 8.48937 5.34042L8.15249 5.53479C7.73374 5.74994 7.25259 5.80994 6.79398 5.70418L5.57375 5.36048C4.85541 5.15664 4.49625 5.05472 4.17867 5.18388C3.86109 5.31305 3.67445 5.63696 3.30115 6.28479L2.80757 7.14139C2.45766 7.74864 2.2827 8.05227 2.31666 8.37549C2.35061 8.69871 2.58483 8.95918 3.05326 9.48012L4.0843 10.6328C4.3363 10.9518 4.51521 11.5078 4.51521 12.0077C4.51521 12.5078 4.33636 13.0636 4.08433 13.3827L3.05326 14.5354C2.58483 15.0564 2.35062 15.3168 2.31666 15.6401C2.2827 15.9633 2.45766 16.2669 2.80757 16.8741L3.30114 17.7307C3.67443 18.3785 3.86109 18.7025 4.17867 18.8316C4.49625 18.9608 4.85542 18.8589 5.57377 18.655L6.79394 18.3113C7.25263 18.2055 7.73387 18.2656 8.15267 18.4808L8.4895 18.6752C8.84851 18.9052 9.12464 19.2442 9.2775 19.6428L9.61149 20.6403C9.83106 21.3003 9.94085 21.6303 10.2022 21.8191C10.4636 22.0078 10.8108 22.0078 11.5051 22.0078H12.6199C13.3143 22.0078 13.6615 22.0078 13.9228 21.8191C14.1842 21.6303 14.294 21.3003 14.5136 20.6403L14.8476 19.6428C15.0004 19.2442 15.2765 18.9052 15.6356 18.6752L15.9724 18.4808C16.3912 18.2656 16.8724 18.2055 17.3311 18.3113L18.5513 18.655C19.2696 18.8589 19.6288 18.9608 19.9464 18.8316C20.264 18.7025 20.4506 18.3785 20.8239 17.7307L21.3175 16.8741C21.6674 16.2669 21.8423 15.9633 21.8084 15.6401C21.7744 15.3168 21.5402 15.0564 21.0718 14.5354L20.0407 13.3827C19.7887 13.0636 19.6098 12.5078 19.6098 12.0077C19.6098 11.5078 19.7888 10.9518 20.0407 10.6328L21.0718 9.48012C21.5402 8.95918 21.7744 8.69871 21.8084 8.37549C21.8423 8.05227 21.6674 7.74864 21.3175 7.14139Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15.5195 12C15.5195 13.933 13.9525 15.5 12.0195 15.5C10.0865 15.5 8.51953 13.933 8.51953 12C8.51953 10.067 10.0865 8.5 12.0195 8.5C13.9525 8.5 15.5195 10.067 15.5195 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}]],fE=[[`path`,{d:`M11.9922 8L11.9922 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.1172 15.75L11.9922 15.75M12.2422 15.75C12.2422 15.8881 12.1303 16 11.9922 16C11.8541 16 11.7422 15.8881 11.7422 15.75C11.7422 15.6119 11.8541 15.5 11.9922 15.5C12.1303 15.5 12.2422 15.6119 12.2422 15.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M20.9922 11.1835V8.28041C20.9922 6.64041 20.9922 5.82041 20.5881 5.28541C20.184 4.75042 19.2703 4.49068 17.4429 3.97122C16.1944 3.61632 15.0938 3.18875 14.2145 2.79841C13.0156 2.26622 12.4161 2.00012 11.9922 2.00012C11.5682 2.00012 10.9688 2.26622 9.7699 2.79841C8.89057 3.18875 7.79002 3.61632 6.54152 3.97122C4.71411 4.49068 3.80041 4.75042 3.3963 5.28541C2.99219 5.82041 2.99219 6.64041 2.99219 8.28041V11.1835C2.99219 16.8086 8.05496 20.1836 10.5861 21.5195C11.1932 21.8399 11.4968 22.0001 11.9922 22.0001C12.4876 22.0001 12.7911 21.8399 13.3982 21.5195C15.9294 20.1836 20.9922 16.8086 20.9922 11.1835Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}]],pE=[[`path`,{d:`M20.9922 11.1833V8.28029C20.9922 6.64029 20.9922 5.82028 20.5881 5.28529C20.184 4.75029 19.2703 4.49056 17.4429 3.9711C16.1944 3.6162 15.0938 3.18863 14.2145 2.79829C13.0156 2.2661 12.4161 2 11.9922 2C11.5682 2 10.9688 2.2661 9.7699 2.79829C8.89057 3.18863 7.79002 3.61619 6.54152 3.9711C4.71411 4.49056 3.80041 4.75029 3.3963 5.28529C2.99219 5.82028 2.99219 6.64029 2.99219 8.28029V11.1833C2.99219 16.8085 8.05496 20.1835 10.5861 21.5194C11.1932 21.8398 11.4968 22 11.9922 22C12.4876 22 12.7911 21.8398 13.3982 21.5194C15.9294 20.1835 20.9922 16.8085 20.9922 11.1833Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8.49219 11.8333C8.49219 11.8333 9.36719 11.8333 10.2422 13.5C10.2422 13.5 13.0216 9.33333 15.4922 8.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],mE=[[`path`,{d:`M20.5455 14C20.8286 13.133 20.9922 12.1945 20.9922 11.1833V8.28029C20.9922 6.64029 20.9922 5.82028 20.5881 5.28529C20.184 4.75029 19.2703 4.49056 17.4429 3.9711C16.1944 3.6162 15.0938 3.18863 14.2145 2.79829C13.0156 2.2661 12.4161 2 11.9922 2C11.5682 2 10.9688 2.2661 9.7699 2.79829C9.52703 2.9061 9.26727 3.01676 8.99219 3.12793`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M17.9922 18.1221C16.4419 19.7483 14.6235 20.8728 13.3982 21.5194C12.7911 21.8398 12.4876 22 11.9922 22C11.4968 22 11.1932 21.8398 10.5861 21.5194C8.05496 20.1836 2.99219 16.8085 2.99219 11.1834V8.28033C2.99219 6.64032 2.99219 5.82032 3.3963 5.28533C3.60583 5.00794 3.95235 4.80455 4.49219 4.60059`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M1.99219 2L21.9922 22`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}]],hE=[[`path`,{d:`M9.5 9C9.5 7.61929 10.6193 6.5 12 6.5C13.3807 6.5 14.5 7.61929 14.5 9C14.5 9.85691 14.0689 10.6131 13.4117 11.0636C12.7283 11.5319 12 12.1716 12 13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.125 16.25H12M12.25 16.25C12.25 16.3881 12.1381 16.5 12 16.5C11.8619 16.5 11.75 16.3881 11.75 16.25C11.75 16.1119 11.8619 16 12 16C12.1381 16 12.25 16.1119 12.25 16.25Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M18.7088 3.49534C16.8165 2.55382 14.5009 2 12 2C9.4991 2 7.1835 2.55382 5.29116 3.49534C4.36318 3.95706 3.89919 4.18792 3.4496 4.91378C3 5.63965 3 6.34248 3 7.74814V11.2371C3 16.9205 7.54236 20.0804 10.173 21.4338C10.9067 21.8113 11.2735 22 12 22C12.7265 22 13.0933 21.8113 13.8269 21.4338C16.4576 20.0804 21 16.9205 21 11.2371L21 7.74814C21 6.34249 21 5.63966 20.5504 4.91378C20.1008 4.18791 19.6368 3.95706 18.7088 3.49534Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],gE=[[`path`,{d:`M15 2L15.5387 4.39157C15.9957 6.42015 17.5798 8.00431 19.6084 8.46127L22 9L19.6084 9.53873C17.5798 9.99569 15.9957 11.5798 15.5387 13.6084L15 16L14.4613 13.6084C14.0043 11.5798 12.4202 9.99569 10.3916 9.53873L8 9L10.3916 8.46127C12.4201 8.00431 14.0043 6.42015 14.4613 4.39158L15 2Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 12L7.38481 13.7083C7.71121 15.1572 8.84275 16.2888 10.2917 16.6152L12 17L10.2917 17.3848C8.84275 17.7112 7.71121 18.8427 7.38481 20.2917L7 22L6.61519 20.2917C6.28879 18.8427 5.15725 17.7112 3.70827 17.3848L2 17L3.70827 16.6152C5.15725 16.2888 6.28879 15.1573 6.61519 13.7083L7 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],_E=[[`path`,{d:`M7.99219 16L8.71615 13.1041C8.89023 12.4078 9.25026 11.772 9.75776 11.2644L16.4171 4.60509L17.4071 3.6151C18.2272 2.79497 19.557 2.79497 20.3771 3.6151C21.1972 4.43524 21.1972 5.76493 20.3771 6.58507L19.3871 7.57506L12.7277 14.2344C12.2202 14.7419 11.5843 15.102 10.888 15.276L7.99219 16Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18.9921 13.5C18.9921 16.7875 18.9921 18.4312 18.0842 19.5376C17.918 19.7401 17.7322 19.9258 17.5297 20.092C16.4234 21 14.7796 21 11.4921 21H10.9922C7.22095 21 5.33535 21 4.16378 19.8284C2.99222 18.6569 2.99219 16.7712 2.99219 13V12.5C2.99219 9.21252 2.99219 7.56879 3.90013 6.46244C4.06636 6.2599 4.25208 6.07417 4.45463 5.90794C5.56098 5 7.20471 5 10.4922 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],vE=[[`path`,{d:`M7.99219 16L15.9922 8`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],yE=[[`path`,{d:`M7.49219 7.5L8.71873 8.55719C9.23437 9.00163 9.49219 9.22386 9.49219 9.5C9.49219 9.77614 9.23437 9.99836 8.71873 10.4428L7.49219 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.4922 12.5H15.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.9922 21C15.7419 21 17.6168 21 18.9311 20.0451C19.3556 19.7367 19.7289 19.3634 20.0373 18.9389C20.9922 17.6246 20.9922 15.7497 20.9922 12C20.9922 8.25027 20.9922 6.3754 20.0373 5.06107C19.7289 4.6366 19.3556 4.26331 18.9311 3.95491C17.6168 3 15.7419 3 11.9922 3C8.24246 3 6.36759 3 5.05326 3.95491C4.62879 4.26331 4.2555 4.6366 3.9471 5.06107C2.99219 6.3754 2.99219 8.25027 2.99219 12C2.99219 15.7497 2.99219 17.6246 3.9471 18.9389C4.2555 19.3634 4.62879 19.7367 5.05326 20.0451C6.36759 21 8.24246 21 11.9922 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],bE=[[`path`,{d:`M14.4961 2.00027H9.49609C8.66767 2.00027 7.99609 2.67184 7.99609 3.50027C7.99609 4.32869 8.66767 5.00027 9.49609 5.00027H14.4961C15.3245 5.00027 15.9961 4.32869 15.9961 3.50027C15.9961 2.67184 15.3245 2.00027 14.4961 2.00027Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M15.9961 3.50027C17.5496 3.54708 18.4761 3.72034 19.1174 4.36163C19.9961 5.24031 19.9961 6.6545 19.9961 9.4829L19.9961 15.9997C19.9961 18.8282 19.9961 20.2424 19.1174 21.1211C18.2387 21.9997 16.8245 21.9997 13.9961 21.9997L9.99609 21.9997C7.16767 21.9997 5.75346 21.9997 4.87478 21.1211C3.9961 20.2424 3.9961 18.8282 3.99609 15.9998L3.99611 9.48295C3.9961 6.65452 3.9961 5.2403 4.87478 4.36162C5.51606 3.72033 6.44261 3.54708 7.99599 3.50027`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M7.49609 11.0003L8.49609 12.0003L10.4961 9.50027`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M13.5 17.0003H16.5M13.5 11.0003H16.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M8.625 17.0003H8.5M8.75 17.0003C8.75 17.1383 8.63807 17.2503 8.5 17.2503C8.36193 17.2503 8.25 17.1383 8.25 17.0003C8.25 16.8622 8.36193 16.7503 8.5 16.7503C8.63807 16.7503 8.75 16.8622 8.75 17.0003Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}]],xE=[[`path`,{d:`M3 3H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 15H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M3 21H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M3 9H16.5C18.9853 9 21 11.0147 21 13.5C21 15.9853 18.9853 18 16.5 18H12M12 18C12 17.1597 14.3932 15.5898 15 15M12 18C12 18.8403 14.3932 20.4102 15 21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],SE=[[`path`,{d:`M5 14L8.5 17.5L19 6.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],CE=[[`path`,{d:`M13.9248 21H10.0752C5.44476 21 3.12955 21 2.27636 19.4939C1.42317 17.9879 2.60736 15.9914 4.97574 11.9985L6.90057 8.75333C9.17559 4.91778 10.3131 3 12 3C13.6869 3 14.8244 4.91777 17.0994 8.75332L19.0243 11.9985C21.3926 15.9914 22.5768 17.9879 21.7236 19.4939C20.8704 21 18.5552 21 13.9248 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 9V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],wE=[[`path`,{d:`M5.25 5L19.25 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M22.25 12C22.25 6.47715 17.7728 2 12.25 2C6.72715 2 2.25 6.47715 2.25 12C2.25 17.5228 6.72715 22 12.25 22C17.7728 22 22.25 17.5228 22.25 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}]],TE=[[`path`,{d:`M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],EE=[[`path`,{d:`M5.25 21H18.75C18.9822 21 19.0983 21 19.196 20.9904C20.1456 20.8968 20.8968 20.1456 20.9904 19.196C21 19.0983 21 18.9822 21 18.75C21 18.5178 21 18.4017 20.9904 18.304C20.8968 17.3544 20.1456 16.6032 19.196 16.5096C19.0983 16.5 18.9822 16.5 18.75 16.5H17.0607C16.8324 16.5 16.7182 16.5 16.6087 16.5121C16.2317 16.5538 15.8742 16.7018 15.5781 16.939C15.4921 17.0079 15.4114 17.0886 15.25 17.25C15.0886 17.4114 15.0079 17.4921 14.9219 17.561C14.6258 17.7982 14.2683 17.9462 13.8913 17.9879C13.7818 18 13.6676 18 13.4393 18H10.5607C10.3324 18 10.2182 18 10.1087 17.9879C9.73165 17.9462 9.37423 17.7982 9.07814 17.561C8.99213 17.4921 8.91142 17.4114 8.75 17.25C8.58858 17.0886 8.50787 17.0079 8.42186 16.939C8.12577 16.7018 7.76835 16.5538 7.3913 16.5121C7.28177 16.5 7.16763 16.5 6.93934 16.5H5.25C5.01783 16.5 4.90175 16.5 4.80397 16.5096C3.85441 16.6032 3.10315 17.3544 3.00963 18.304C3 18.4017 3 18.5178 3 18.75C3 18.9822 3 19.0983 3.00963 19.196C3.10315 20.1456 3.85441 20.8968 4.80397 20.9904C4.90175 21 5.01783 21 5.25 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16.5 7.49996C16.5 7.49996 13.1858 3.00001 12 3C10.8141 2.99999 7.5 7.5 7.5 7.5M12 4V15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],DE=[[`path`,{d:`M11 13.5C10.6446 13.5097 10.3134 13.5226 10.0008 13.5379C6.3 13.7193 3.28417 16.8058 3 20.5002`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19.6709 16.2593C19.8803 16.6249 20 17.0485 20 17.5C20 17.9514 19.8804 18.3749 19.671 18.7404C19.2402 19.493 18.4293 20 17.5 20M15.3291 16.2593C15.1197 16.6249 15 17.0485 15 17.5C15 17.9514 15.1196 18.3749 15.329 18.7404C15.7598 19.493 16.5707 20 17.5 20M17.5 20L17.5 21.5M17.5 15C18.4292 15 19.24 15.5069 19.6709 16.2593M17.5 15C16.5708 15 15.76 15.5069 15.3291 16.2593M17.5 15L17.5 13.5M21 15.4998L19.6709 16.2593M14 19.4998L15.329 18.7404M21 19.4998L19.671 18.7404M14 15.4998L15.3291 16.2593`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`circle`,{cx:`11`,cy:`6.5`,r:`4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],OE=[[`path`,{d:`M2.00189 1.99988L21.9772 21.9999`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16.8516 16.8677C16.7224 17.8061 16.4665 18.4668 15.9595 18.9744C14.9356 19.9996 13.2877 19.9996 9.992 19.9996H8.99323C5.69749 19.9996 4.04961 19.9996 3.02575 18.9744C2.00189 17.9493 2.00189 16.2994 2.00189 12.9996V10.9996C2.00189 7.69971 2.00189 6.04979 3.02575 5.02466C3.36827 4.68172 3.78062 4.45351 4.30114 4.30164`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M8.23627 4.0004C8.47815 3.99988 8.72995 3.99988 8.99217 3.99988H9.99093C13.2867 3.99988 14.9346 3.99988 15.9584 5.02501C16.9822 6.05013 16.9822 7.70005 16.9822 10.9999V12.7573M16.9822 9.2313L19.3018 7.52901C20.7729 6.54061 21.4489 7.17184 21.6674 7.64835C22.1191 8.92801 21.9768 11.3935 21.9768 14.5416C21.8703 16.5549 21.5952 16.7718 21.3137 16.9938L21.3107 16.9961`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],kE=[`shift`,`alt`,`meta`,`mod`,`ctrl`,`control`];function AE(){return typeof navigator>`u`?!1:/mac/i.test(navigator.userAgent)&&!/iphone|ipad|ipod/i.test(navigator.userAgent)}var jE={esc:`escape`,return:`enter`,left:`arrowleft`,right:`arrowright`,up:`arrowup`,down:`arrowdown`,ShiftLeft:`shift`,ShiftRight:`shift`,AltLeft:`alt`,AltRight:`alt`,MetaLeft:`meta`,MetaRight:`meta`,OSLeft:`meta`,OSRight:`meta`,ControlLeft:`ctrl`,ControlRight:`ctrl`};function ME(e){return(jE[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,``)}function NE(e){return kE.includes(e)}function PE(e,t=`,`){return e.toLowerCase().split(t)}function FE(e,t=`+`,n=`>`,r=!1,i,a){let o=[],s=!1;e=e.trim(),e.includes(n)?(s=!0,o=e.toLocaleLowerCase().split(n).map(e=>ME(e))):o=e.toLocaleLowerCase().split(t).map(e=>ME(e));let c={alt:o.includes(`alt`),ctrl:o.includes(`ctrl`)||o.includes(`control`),shift:o.includes(`shift`),meta:o.includes(`meta`),mod:o.includes(`mod`),useKey:r},l=o.filter(e=>!kE.includes(e));return{...c,keys:l,description:i,isSequence:s,hotkey:e,metadata:a}}typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.code!==void 0&&zE([ME(e.code)])}),document.addEventListener(`keyup`,e=>{e.code!==void 0&&BE([ME(e.code)])})),typeof window<`u`&&(window.addEventListener(`blur`,()=>{IE.clear()}),window.addEventListener(`focus`,()=>{IE.clear()}),window.addEventListener(`contextmenu`,()=>{setTimeout(()=>{IE.clear()},0)})),typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{IE.clear()});var IE=new Set;function LE(e){return Array.isArray(e)}function RE(e,t=`,`){return(LE(e)?e:e.split(t)).every(e=>IE.has(e.trim().toLowerCase()))}function zE(e){let t=Array.isArray(e)?e:[e];IE.has(`meta`)&&IE.forEach(e=>{NE(e)||IE.delete(e.toLowerCase())}),t.forEach(e=>{IE.add(e.toLowerCase())})}function BE(e){e===`meta`?IE.clear():(Array.isArray(e)?e:[e]).forEach(e=>{IE.delete(e.toLowerCase())})}function VE(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function HE(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}var UE=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`];function WE(e){return GE(e,UE)}function GE(e,t=!1){let{target:n,composed:r}=e,i,a;return KE(n)&&r?(i=e.composedPath()[0]&&e.composedPath()[0].tagName,a=e.composedPath()[0]&&e.composedPath()[0].role):(i=n&&n.tagName,a=n&&n.role),LE(t)?!!(i&&t?.some(e=>e.toLowerCase()===i.toLowerCase()||e===a)):!!(i&&t&&t)}function KE(e){return!!e.tagName&&!e.tagName.startsWith(`-`)&&e.tagName.includes(`-`)}function qE(e,t){return e.length===0&&t?!1:!t||e.some(e=>t.includes(e))||e.includes(`*`)}var JE=(e,t,n=!1)=>{let{alt:r,meta:i,mod:a,shift:o,ctrl:s,keys:c,useKey:l}=t,{code:u,key:d,ctrlKey:f,metaKey:p,shiftKey:m,altKey:h}=e,g=ME(u),_=typeof e.getModifierState==`function`&&e.getModifierState(`AltGraph`);if(!l&&!c?.includes(g)&&![`ctrl`,`control`,`unknown`,`meta`,`alt`,`shift`,`os`].includes(g))return!1;if(!n){if(r!==h&&g!==`alt`||o!==m&&g!==`shift`)return!1;if(a){if(AE()?!p:!f)return!1}else if(i!==p&&g!==`meta`&&g!==`os`||s!==f&&g!==`ctrl`&&g!==`control`)return!1;if(_&&!r&&!s&&!a&&![`alt`,`ctrl`,`control`].includes(g))return!1}return l&&c?.length===1&&c.includes(d.toLowerCase())||c&&c.length===1&&c.includes(g)?!0:c&&c.length>0?c.includes(g)?RE(c):!1:!c||c.length===0},YE=(0,P.createContext)(void 0),XE=()=>(0,P.useContext)(YE);function ZE(e,t){return e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&ZE(e[r],t[r]),!0):e===t}var QE=(0,P.createContext)({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),$E=()=>(0,P.useContext)(QE);function eD(e){let t=(0,P.useRef)(void 0);return ZE(t.current,e)||(t.current=e),t.current}var tD=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},nD=typeof window<`u`?P.useLayoutEffect:P.useEffect;function rD(e){if(!e)return;let{enabled:t,preventDefault:n,ignoreEventWhen:r,...i}=e;return typeof t==`function`?i:{...i,enabled:t}}function iD(e,t,n,r){let[i,a]=(0,P.useState)(null),o=(0,P.useCallback)(e=>(a(e),()=>a(null)),[]),s=(0,P.useRef)(!1),c=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=LE(e)?e.join(c?.delimiter):e,u=Array.isArray(n)?n:Array.isArray(r)?r:void 0,d=(0,P.useCallback)(t,u??[]),f=(0,P.useRef)(d);f.current=u?d:t;let p=eD(rD(c)),m=(0,P.useRef)(c?.enabled);m.current=c?.enabled;let h=(0,P.useRef)(c?.preventDefault);h.current=c?.preventDefault;let g=(0,P.useRef)(c?.ignoreEventWhen);g.current=c?.ignoreEventWhen;let{activeScopes:_}=$E(),v=XE();return nD(()=>{if(m.current===!1||!qE(_,p?.scopes))return;let e=[],t,n=(n,r=!1)=>{if(!WE(n)||GE(n,p?.enableOnFormTags)){if(i!==null){let e=i.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&e.activeElement!==i&&!i.contains(e.activeElement)){tD(n);return}}n.target?.isContentEditable&&!p?.enableOnContentEditable||PE(l,p?.delimiter).forEach(i=>{if(i.includes(p?.splitKey??`+`)&&i.includes(p?.sequenceSplitKey??`>`)){console.warn(`Hotkey ${i} contains both ${p?.splitKey??`+`} and ${p?.sequenceSplitKey??`>`} which is not supported.`);return}let a=FE(i,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata);if(a.isSequence){t=setTimeout(()=>{e=[]},p?.sequenceTimeoutMs??1e3);let r=a.useKey?n.key:ME(n.code);if(NE(r.toLowerCase()))return;if(e.push(r),r!==a.keys?.[e.length-1]){e=[],t&&clearTimeout(t);return}e.length===a.keys?.length&&(f.current(n,a),t&&clearTimeout(t),e=[])}else if(JE(n,a,p?.ignoreModifiers)||a.keys?.includes(`*`)){if(g.current?.(n)||r&&s.current||(VE(n,a,h.current),!HE(n,a,m.current)))return;f.current(n,a),r||(s.current=!0)}})}},r=e=>{e.code!==void 0&&(zE(ME(e.code)),(p?.keydown===void 0&&p?.keyup!==!0||p?.keydown)&&n(e))},a=e=>{e.code!==void 0&&(BE(ME(e.code)),s.current=!1,p?.keyup&&n(e,!0))},o=i||c?.document||document;return o.addEventListener(`keyup`,a,c?.eventListenerOptions),o.addEventListener(`keydown`,r,c?.eventListenerOptions),v&&PE(l,p?.delimiter).forEach(e=>{v.addHotkey(FE(e,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata))}),()=>{o.removeEventListener(`keyup`,a,c?.eventListenerOptions),o.removeEventListener(`keydown`,r,c?.eventListenerOptions),v&&PE(l,p?.delimiter).forEach(e=>{v.removeHotkey(FE(e,p?.splitKey,p?.sequenceSplitKey,p?.useKey,p?.description,p?.metadata))}),e=[],t&&clearTimeout(t)}},[i,p,_,l]),o}function aD(e,t){return z(n=>wf(n,e,t)?.name??``)}async function oD(e,t){return await F(e,`projects.add`,{path:t})}async function sD(e,t,n){await F(e,`projects.update`,{id:t,patch:n})}async function cD(e,t){await F(e,`projects.remove`,{id:t})}var lD={computer:oT,laptop:NT,server:uE,cloud:zee,terminal:Vee,cpu:cT,home:ET,office:Nee},uD=[`text-gray-600 dark:text-gray-400`,`text-red-600 dark:text-red-400`,`text-orange-600 dark:text-orange-400`,`text-amber-600 dark:text-amber-400`,`text-yellow-600 dark:text-yellow-400`,`text-lime-600 dark:text-lime-400`,`text-green-600 dark:text-green-400`,`text-emerald-600 dark:text-emerald-400`,`text-teal-600 dark:text-teal-400`,`text-cyan-600 dark:text-cyan-400`,`text-sky-600 dark:text-sky-400`,`text-blue-600 dark:text-blue-400`,`text-indigo-600 dark:text-indigo-400`,`text-violet-600 dark:text-violet-400`,`text-purple-600 dark:text-purple-400`,`text-fuchsia-600 dark:text-fuchsia-400`,`text-pink-600 dark:text-pink-400`,`text-rose-600 dark:text-rose-400`];function dD(e){let t=z(t=>wf(t,e.machine,e.projectId));return(0,H.jsx)(fD,{name:t?.name??``,logo:t?.logo??null,className:e.className})}function fD(e){let t=e.name.normalize(`NFKC`).trim(),n=t.match(/[\p{L}\p{N}]+/gu)??[],r=Array.from(n[0]??`P`),i=r.slice(1).find(e=>/\p{N}/u.test(e))??(n.length>1?Array.from(n.at(-1)??``)[0]:r.at(-1))??r[0],a=Array.from(`${r[0]}${i}`.toUpperCase()).slice(0,2).join(``),o=0;for(let e of t.toLowerCase())o=(o*31+(e.codePointAt(0)??0))%uD.length;return(0,H.jsx)(`span`,{"aria-hidden":`true`,className:c(`inline-flex size-4 shrink-0 items-center justify-center`,e.className),children:e.logo===null?(0,H.jsx)(`svg`,{viewBox:`0 0 16 16`,className:c(`size-full overflow-hidden rounded-[25%] font-mono select-none`,uD[o]),style:{backgroundColor:`color-mix(in srgb, currentColor 14%, transparent)`},children:(0,H.jsx)(`text`,{x:`8`,y:`10.8`,textAnchor:`middle`,fill:`currentColor`,fontSize:`8.25`,fontWeight:`700`,textLength:a.length===1?6:12,lengthAdjust:`spacingAndGlyphs`,children:a})}):(0,H.jsx)(`img`,{src:e.logo,alt:``,className:`size-full rounded-[25%] object-cover`})})}function pD(e){switch(e.provider){case`claude`:return(0,H.jsx)(hD,{className:e.className});case`codex`:return(0,H.jsx)(w,{icon:Fee,className:e.className});case`opencode`:return(0,H.jsx)(mD,{className:e.className})}}function mD(e){return(0,H.jsxs)(`svg`,{viewBox:`0 0 240 300`,"aria-hidden":`true`,className:c(`fill-current`,e.className),children:[(0,H.jsx)(`path`,{d:`M180 240H60V120H180V240Z`,opacity:`0.4`}),(0,H.jsx)(`path`,{d:`M180 60H60V240H180V60ZM240 300H0V0H240V300Z`})]})}function hD(e){return(0,H.jsx)(`svg`,{viewBox:`0 0 256 257`,preserveAspectRatio:`xMidYMid`,"aria-hidden":`true`,className:c(`fill-[#d97757]`,e.className),children:(0,H.jsx)(`path`,{d:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`})})}var gD=(0,P.lazy)(async()=>({default:(await Ae(async()=>{let{ImageViewer:e}=await import(`./image-viewer-DnE3hPpr.js`);return{ImageViewer:e}},__vite__mapDeps([0,1,2,3,4,5]))).ImageViewer}));function _D(e){let[t,n]=(0,P.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":e.alt===``?`View image`:`View ${e.alt}`,className:c(`focus-visible:ring-ring cursor-zoom-in rounded-lg outline-none focus-visible:ring-2`,e.className),onClick:()=>n(!0),children:(0,H.jsx)(`img`,{src:e.src,alt:e.alt,loading:`lazy`,decoding:`async`,className:e.imageClassName,onError:e.onError})}),t&&(0,H.jsx)(P.Suspense,{children:(0,H.jsx)(gD,{src:e.src,alt:e.alt,name:e.name,onClose:()=>n(!1)})})]})}function vD(e){let t=cr(e.draftKey).images;return(0,H.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-2 px-3 sm:px-4`,children:t.map(t=>(0,H.jsxs)(`div`,{className:`border-border/80 bg-background relative size-16 overflow-hidden rounded-lg border`,children:[(0,H.jsx)(_D,{src:`data:${t.mediaType};base64,${t.data}`,alt:``,name:`Image #${t.number}`,className:`block size-full`,imageClassName:`size-full object-cover`}),(0,H.jsx)(`button`,{className:`absolute top-1 right-1 grid size-5 cursor-pointer place-items-center rounded-full bg-black/60 text-white`,title:`Remove image`,onClick:()=>lr(e.draftKey,e=>({...e,text:e.text.replace(RegExp(`\\[Image #${t.number}\\] ?`),``),images:e.images.filter(e=>e.number!==t.number)})),children:(0,H.jsx)(w,{icon:xe,className:`size-3`})})]},t.number))})}function yD(e,t){let n=0;for(let r of[...t,...e.flatMap(e=>e.parent===null?e.kind===`user`?[e.text]:e.kind===`question`&&e.answers!==null?Object.values(e.answers):[]:[])])for(let e of r.matchAll(/\[Image #(\d+)\]/g))n=Math.max(n,Number(e[1]));return n}function bD(e){let t=[...new Set([...e.text.matchAll(/\[Image #(\d+)\]/g)].map(e=>Number(e[1])))].sort((e,t)=>e-t);if(t.length===e.images.length)return{text:e.text,images:e.images.map((e,n)=>({...e,number:t[n]}))};let n=Math.max(0,...t)+1,r=e.images.map((e,t)=>({...e,number:n+t}));return{text:`${r.map(e=>`[Image #${e.number}] `).join(``)}${e.text}`,images:r}}function xD(e){let t=(0,P.useRef)(null);return(0,P.useLayoutEffect)(()=>{t.current?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})},[e.active]),(0,H.jsx)(`div`,{ref:t,className:`composer-glass mx-auto -mb-[calc(1rem+1px)] max-h-72 w-[calc(100%-2.75rem)] overflow-y-auto rounded-t-2xl border border-b-0 border-(--composer-outline) p-1 pb-[calc(1rem+1px+0.25rem)]`,children:e.items.map((t,n)=>(0,H.jsxs)(`button`,{"data-active":n===e.active,className:c(`flex min-h-7 w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left`,n===e.active&&`bg-accent`),onMouseEnter:()=>e.onHover(n),onMouseDown:n=>{n.preventDefault(),e.onPick(t)},children:[(0,H.jsx)(w,{icon:t.insert.startsWith(`/`)?vE:pT,className:`text-muted-foreground size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:t.label}),(0,H.jsx)(`span`,{className:`text-secondary-label min-w-0 truncate text-xs`,children:t.description})]},t.key))})}function SD({...e}){return(0,H.jsx)(Ig,{"data-slot":`dropdown-menu`,...e})}function CD({...e}){return(0,H.jsx)(zg,{"data-slot":`dropdown-menu-portal`,...e})}function wD({...e}){return(0,H.jsx)(Rg,{"data-slot":`dropdown-menu-trigger`,...e})}function TD({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,H.jsx)(zg,{children:(0,H.jsx)(Vg,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:c(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg dropdown-glass p-1 text-popover-foreground shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)] duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function ED({className:e,inset:t,variant:n=`default`,...r}){return(0,H.jsx)(Ug,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:c(`group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function DD({className:e,children:t,checked:n,inset:r,...i}){return(0,H.jsxs)(Wg,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:c(`relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...i,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,H.jsx)(qg,{children:(0,H.jsx)(w,{icon:Qw})})}),t]})}function OD({...e}){return(0,H.jsx)(Gg,{"data-slot":`dropdown-menu-radio-group`,...e})}function kD({className:e,children:t,inset:n,...r}){return(0,H.jsxs)(Kg,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:c(`relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,H.jsx)(qg,{children:(0,H.jsx)(w,{icon:Qw})})}),t]})}function AD({className:e,inset:t,...n}){return(0,H.jsx)(Hg,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:c(`px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function jD({className:e,...t}){return(0,H.jsx)(Jg,{"data-slot":`dropdown-menu-separator`,className:c(`-mx-1 my-1 h-px bg-border`,e),...t})}function MD({...e}){return(0,H.jsx)(Yg,{"data-slot":`dropdown-menu-sub`,...e})}function ND({className:e,inset:t,children:n,...r}){return(0,H.jsxs)(Xg,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:c(`flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,H.jsx)(w,{icon:eT,className:`ml-auto`})]})}function PD({className:e,...t}){return(0,H.jsx)(Zg,{"data-slot":`dropdown-menu-sub-content`,className:c(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}var FD={claude:[{value:`default`,label:`Ask before edits`,icon:pE},{value:`acceptEdits`,label:`Accept edits`,icon:hT},{value:`plan`,label:`Plan mode`,icon:zT},{value:`auto`,label:`Auto mode`,icon:gE},{value:`bypassPermissions`,label:`Bypass permissions`,icon:mE}],codex:[{value:`read-only`,label:`Read only`,icon:pE},{value:`auto`,label:`Auto`,icon:hT},{value:`full-access`,label:`Full access`,icon:mE}]};function ID(e,t){return e===`opencode`?(t?.agents??[]).map(e=>({value:e.id,label:e.name,icon:e.id===`plan`?zT:hT})):FD[e]}function LD(){let e=z(e=>e.settings),t=z(e=>e.context),n=z(e=>e.capabilities),r=ID(e.provider,n),i=r.find(t=>t.value===e.mode),a=e.provider===`opencode`?`Agent`:`Permission mode`;return(0,H.jsxs)(SD,{children:[(0,H.jsx)(wD,{asChild:!0,children:(0,H.jsx)(y,{variant:`ghost`,size:`icon-sm`,title:`More`,"aria-label":`More composer controls`,children:(0,H.jsx)(w,{icon:qT})})}),(0,H.jsxs)(TD,{className:`w-72`,side:`top`,align:`end`,onCloseAutoFocus:e=>{e.preventDefault(),document.querySelector(`[data-composer]`)?.focus()},children:[(0,H.jsxs)(MD,{children:[(0,H.jsxs)(ND,{children:[(0,H.jsx)(w,{icon:i?.icon??pE}),(0,H.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:a}),(0,H.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate text-xs`,children:i?.label??`Default`})]}),(0,H.jsx)(CD,{children:(0,H.jsxs)(PD,{className:`w-56`,children:[(0,H.jsxs)(AD,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{children:a}),(0,H.jsx)(`span`,{children:`Shift+Tab`})]}),(0,H.jsx)(OD,{value:e.mode??``,children:r.map(e=>(0,H.jsxs)(kD,{value:e.value,onSelect:()=>qf({mode:e.value}),children:[(0,H.jsx)(w,{icon:e.icon}),e.label]},e.value))})]})})]}),e.provider===`codex`&&(0,H.jsxs)(DD,{checked:e.plan,onCheckedChange:e=>qf({plan:e}),children:[(0,H.jsx)(w,{icon:zT}),`Plan first`]}),t!==null&&(0,H.jsxs)(`div`,{className:`flex min-h-7 items-center gap-2 px-2 py-1 text-sm [&_svg]:size-4`,children:[(0,H.jsx)(w,{icon:Pee}),(0,H.jsx)(`span`,{className:`flex-1`,children:`Context`}),(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs tabular-nums`,children:t.window===null?np(t.tokens):`${np(t.tokens)} / ${np(t.window)}`}),(0,H.jsx)(y,{variant:`outline`,size:`xs`,onClick:()=>nC({text:`/compact`,images:[]},`queue`).catch(V),children:`Compact`})]})]})]})}var RD=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zD=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BD={};function VD(e,t){return((t||BD).jsx?zD:RD).test(e)}var HD={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`},UD=r(((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;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
68
68
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),WD=r((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(UD());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}})),GD=r((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))}})),KD=r(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(WD()),r=GD();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})),qD=YD(`end`),JD=YD(`start`);function YD(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 XD(e){let t=JD(e),n=qD(e);if(t&&n)return{start:t,end:n}}function ZD(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?$D(e.position):`start`in e||`end`in e?$D(e):`line`in e||`column`in e?QD(e):``}function QD(e){return eO(e&&e.line)+`:`+eO(e&&e.column)}function $D(e){return QD(e&&e.start)+`-`+QD(e&&e.end)}function eO(e){return e&&typeof e==`number`?e:1}var tO=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=ZD(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}};tO.prototype.file=``,tO.prototype.name=``,tO.prototype.reason=``,tO.prototype.message=``,tO.prototype.stack=``,tO.prototype.column=void 0,tO.prototype.line=void 0,tO.prototype.ancestors=void 0,tO.prototype.cause=void 0,tO.prototype.fatal=void 0,tO.prototype.place=void 0,tO.prototype.ruleId=void 0,tO.prototype.source=void 0;var nO=e(KD(),1),rO={}.hasOwnProperty,iO=new Map,aO=/[A-Z]/g,oO=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),sO=new Set([`td`,`th`]),cO=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function lO(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=bO(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=yO(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`?dt:Ve,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=uO(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function uO(e,t,n){if(t.type===`element`)return dO(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return fO(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return mO(e,t,n);if(t.type===`mdxjsEsm`)return pO(e,t);if(t.type===`root`)return hO(e,t,n);if(t.type===`text`)return gO(e,t)}function dO(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=EO(e,t.tagName,!1),o=xO(e,t),s=CO(e,t);return oO.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!et(e)})),_O(e,o,a,t),vO(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function fO(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)}DO(e,t.position)}function pO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);DO(e,t.position)}function mO(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:EO(e,t.name,!0),o=SO(e,t),s=CO(e,t);return _O(e,o,a,t),vO(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function hO(e,t,n){let r={};return vO(r,CO(e,t)),e.create(t,e.Fragment,r,n)}function gO(e,t){return t.value}function _O(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vO(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function yO(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 bO(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=JD(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 xO(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&rO.call(t.properties,i)){let a=wO(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&sO.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 SO(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 DO(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 DO(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function CO(e,t){let n=[],r=-1,i=e.passKeys?new Map:iO;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=uO(e,a,o);s!==void 0&&n.push(s)}return n}function wO(e,t,n){let r=Be(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?qe(n):Le(n)),r.property===`style`){let t=typeof n==`object`?n:TO(e,String(n));return e.stylePropertyNameCase===`css`&&(t=OO(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?HD[r.property]||r.property:r.attribute,n]}}function TO(e,t){try{return(0,nO.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new tO("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=cO+`#cannot-parse-style-attribute`,r}}function EO(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=VD(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=VD(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return rO.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);DO(e)}function DO(e,t){let n=new tO("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=cO+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function OO(e){let t={},n;for(n in e)rO.call(e,n)&&(t[kO(n)]=e[n]);return t}function kO(e){let t=e.replace(aO,AO);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function AO(e){return`-`+e.toLowerCase()}var jO={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`]},MO={};function NO(e,t){let n=t||MO;return PO(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function PO(e,t,n){if(IO(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 FO(e.children,t,n)}return Array.isArray(e)?FO(e,t,n):``}function FO(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=PO(e[i],t,n);return r.join(``)}function IO(e){return!!(e&&typeof e==`object`)}var LO=document.createElement(`i`);function RO(e){let t=`&`+e+`;`;LO.innerHTML=t;let n=LO.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function zO(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 BO(e,t){return e.length>0?(zO(e,e.length,0,t),e):t}var VO={}.hasOwnProperty;function HO(e){let t={},n=-1;for(;++n<e.length;)UO(t,e[n]);return t}function UO(e,t){let n;for(n in t){let r=(VO.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){VO.call(r,a)||(r[a]=[]);let e=i[a];WO(r[a],Array.isArray(e)?e:e?[e]:[])}}}function WO(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);zO(e,0,0,r)}function GO(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 KO(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var qO=ik(/[A-Za-z]/),JO=ik(/[\dA-Za-z]/),YO=ik(/[#-'*+\--9=?A-Z^-~]/);function XO(e){return e!==null&&(e<32||e===127)}var ZO=ik(/\d/),QO=ik(/[\dA-Fa-f]/),$O=ik(/[!-/:-@[-`{-~]/);function U(e){return e!==null&&e<-2}function ek(e){return e!==null&&(e<0||e===32)}function tk(e){return e===-2||e===-1||e===32}var nk=ik(/\p{P}|\p{S}/u),rk=ik(/\s/);function ik(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ak(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&JO(e.charCodeAt(n+1))&&JO(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 ok(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return tk(r)?(e.enter(n),s(r)):t(r)}function s(r){return tk(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function sk(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&tk(t)?(e.enter(r),c(t)):l(t)}function c(t){return tk(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var ck={tokenize:lk};function lk(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),ok(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);else return U(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var uk=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){dk(this,e,t,n,!1)}addBefore(e,t,n){dk(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function dk(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var fk={tokenize:mk},pk={tokenize:hk};function mk(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++;let c=new uk;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),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(pk,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(pk,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);else 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);else return U(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++;let l=new uk;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}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 hk(e,t,n){return ok(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function gk(e){if(e===null||ek(e)||rk(e))return 1;if(nk(e))return 2}function _k(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 vk={name:`attention`,resolveAll:yk,tokenize:bk};function yk(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};xk(o,-a),xk(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=BO(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=BO(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=BO(r,_k(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=BO(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=BO(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),zO(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function bk(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=gk(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=gk(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function xk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Sk={name:`autolink`,tokenize:Ck};function Ck(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 qO(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||JO(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||JO(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||XO(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):YO(t)?(e.consume(t),l):n(t)}function u(e){return JO(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||JO(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var wk={partial:!0,tokenize:Tk};function Tk(e,t,n){return r;function r(t){return tk(t)?ok(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||U(e)?t(e):n(e)}}var Ek={continuation:{tokenize:Ok},exit:kk,name:`blockQuote`,tokenize:Dk};function Dk(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 tk(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Ok(e,t,n){let r=this;return i;function i(t){return tk(t)?ok(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Ek,t,n)(r)}}function kk(e){e.exit(`blockQuote`)}var Ak={name:`characterEscape`,tokenize:jk};function jk(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 $O(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Mk={name:`characterReference`,tokenize:Nk};function Nk(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=JO,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=QO,u):(e.enter(`characterReferenceValue`),a=7,o=ZO,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===JO&&!RO(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 Pk={partial:!0,tokenize:Fk};function Fk(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 Ik={concrete:!0,name:`codeFenced`,tokenize:Lk};function Lk(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`),tk(t)?ok(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||U(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Pk,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||U(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):tk(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),ok(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||U(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||U(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&&tk(t)?ok(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||U(t)?e.check(Pk,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||U(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`),tk(t)?ok(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`),tk(t)?ok(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||U(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var Rk={name:`codeIndented`,tokenize:Bk},zk={partial:!0,tokenize:Vk};function Bk(e,t,n){return r;function r(t){return e.enter(`codeIndented`),sk(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):U(t)?e.attempt(zk,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||U(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function Vk(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):U(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):sk(e,t,a,`linePrefix`,4,4)(o)}function a(e){return U(e)?i(e):n(e)}}var Hk={name:`codeText`,previous:Wk,resolve:Uk,tokenize:Gk};function Uk(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 Wk(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Gk(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)):U(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||U(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 Kk=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&&qk(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),qk(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qk(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);qk(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);qk(this.left,t.reverse())}}}};function qk(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 Jk(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Kk(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,Yk(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 zO(e,0,1/0,u.slice(0)),!l}function Yk(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 Xk={resolve:Qk,tokenize:$k},Zk={partial:!0,tokenize:eA};function Qk(e){return Jk(e),e}function $k(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):U(t)?e.check(Zk,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 eA(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ok(e,a,`linePrefix`)}function a(i){if(i===null||U(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 tA(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||XO(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||U(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||ek(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||XO(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 nA(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):U(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||U(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!tk(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function rA(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):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ok(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||U(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 iA(e,t){let n;return r;function r(i){return U(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):tk(i)?ok(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var aA={name:`definition`,tokenize:sA},oA={partial:!0,tokenize:cA};function sA(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return nA.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=KO(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 ek(t)?iA(e,l)(t):l(t)}function l(t){return tA(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(oA,d,d)(t)}function d(t){return tk(t)?ok(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||U(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function cA(e,t,n){return r;function r(t){return ek(t)?iA(e,i)(t):n(t)}function i(t){return rA(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return tk(t)?ok(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||U(e)?t(e):n(e)}}var lA={name:`hardBreakEscape`,tokenize:uA};function uA(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return U(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var dA={name:`headingAtx`,resolve:fA,tokenize:pA};function fA(e,t){let n=e.length-2,r=3;if(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){let 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`};zO(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function pA(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||ek(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||U(n)?(e.exit(`atxHeading`),t(n)):tk(n)?ok(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||ek(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var mA=`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(`.`),hA=[`pre`,`script`,`style`,`textarea`],gA={concrete:!0,name:`htmlFlow`,resolveTo:vA,tokenize:yA},_A={partial:!0,tokenize:bA};function vA(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 yA(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:ie):qO(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):qO(a)?(e.consume(a),i=4,r.interrupt?t:ie):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ie):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 qO(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||ek(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&hA.includes(l)?(i=1,r.interrupt?t(s):O(s)):mA.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||JO(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 tk(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||qO(t)?(e.consume(t),b):tk(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||JO(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):tk(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):tk(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||U(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||ek(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||tk(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||U(t)?O(t):tk(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),te):t===62&&i===4?(e.consume(t),ae):t===63&&i===3?(e.consume(t),ie):t===93&&i===5?(e.consume(t),re):U(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(_A,M,k)(t)):t===null||U(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Pk,A,M)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||U(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),ie):O(t)}function te(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return hA.includes(n)?(e.consume(t),ae):O(t)}return qO(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function re(t){return t===93?(e.consume(t),ie):O(t)}function ie(t){return t===62?(e.consume(t),ae):t===45&&i===2?(e.consume(t),ie):O(t)}function ae(t){return t===null||U(t)?(e.exit(`htmlFlowData`),M(t)):(e.consume(t),ae)}function M(n){return e.exit(`htmlFlow`),t(n)}}function bA(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(wk,t,n)}}var xA={name:`htmlText`,tokenize:SA};function SA(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):qO(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):qO(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):U(t)?(o=d,te(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(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):U(t)?(o=h,te(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):U(t)?(o=v,te(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):U(t)?(o=y,te(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return qO(t)?(e.consume(t),S):n(t)}function S(t){return t===45||JO(t)?(e.consume(t),S):C(t)}function C(t){return U(t)?(o=C,te(t)):tk(t)?(e.consume(t),C):j(t)}function w(t){return t===45||JO(t)?(e.consume(t),w):t===47||t===62||ek(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||qO(t)?(e.consume(t),E):U(t)?(o=T,te(t)):tk(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||JO(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):U(t)?(o=D,te(t)):tk(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,k):U(t)?(o=O,te(t)):tk(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):U(t)?(o=k,te(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||ek(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||ek(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function te(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return tk(t)?ok(e,re,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):re(t)}function re(t){return e.enter(`htmlTextData`),o(t)}}var CA={name:`labelEnd`,resolveAll:DA,resolveTo:OA,tokenize:kA},wA={tokenize:AA},TA={tokenize:jA},EA={tokenize:MA};function DA(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&&zO(e,0,e.length,n),e}function OA(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=BO(o,e.slice(i+1,i+r+3)),o=BO(o,[[`enter`,l,t]]),o=BO(o,_k(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=BO(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=BO(o,e.slice(a+1)),o=BO(o,[[`exit`,s,t]]),zO(e,i,e.length,o),e}function kA(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(KO(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(wA,u,o?u:d)(t):t===91?e.attempt(TA,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(EA,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function AA(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 ek(t)?iA(e,a)(t):a(t)}function a(t){return t===41?u(t):tA(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return ek(t)?iA(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?rA(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return ek(t)?iA(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 jA(e,t,n){let r=this;return i;function i(t){return nA.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(KO(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function MA(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 NA={name:`labelStartImage`,resolveAll:CA.resolveAll,tokenize:PA};function PA(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var FA={name:`labelStartLink`,resolveAll:CA.resolveAll,tokenize:IA};function IA(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var LA={name:`lineEnding`,tokenize:RA};function RA(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),ok(e,t,`linePrefix`)}}var zA={name:`thematicBreak`,tokenize:BA};function BA(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||U(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),tk(t)?ok(e,s,`whitespace`)(t):s(t))}}var VA={continuation:{tokenize:GA},exit:qA,name:`list`,tokenize:WA},HA={partial:!0,tokenize:JA},UA={partial:!0,tokenize:KA};function WA(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:ZO(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(zA,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 ZO(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(wk,r.interrupt?n:u,e.attempt(HA,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return tk(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 GA(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(wk,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ok(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!tk(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(UA,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,ok(e,e.attempt(VA,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function KA(e,t,n){let r=this;return ok(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 qA(e){e.exit(this.containerState.type)}function JA(e,t,n){let r=this;return ok(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!tk(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var YA={name:`setextUnderline`,resolveTo:XA,tokenize:ZA};function XA(e,t){let n=new uk,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function ZA(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`),tk(t)?ok(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||U(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var QA={tokenize:$A};function $A(e){let t=this,n=e.attempt(wk,r,e.attempt(this.parser.constructs.flowInitial,i,ok(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Xk,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ej={resolveAll:ij()},tj=rj(`string`),nj=rj(`text`);function rj(e){return{resolveAll:ij(e===`text`?aj: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);else 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 ij(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 aj(e,t){let n=new uk,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var oj=t({attentionMarkers:()=>mj,contentInitial:()=>cj,disable:()=>hj,document:()=>sj,flow:()=>uj,flowInitial:()=>lj,insideSpan:()=>pj,string:()=>dj,text:()=>fj}),sj={42:VA,43:VA,45:VA,48:VA,49:VA,50:VA,51:VA,52:VA,53:VA,54:VA,55:VA,56:VA,57:VA,62:Ek},cj={91:aA},lj={[-2]:Rk,[-1]:Rk,32:Rk},uj={35:dA,42:zA,45:[YA,zA],60:gA,61:YA,95:zA,96:Ik,126:Ik},dj={38:Mk,92:Ak},fj={[-5]:LA,[-4]:LA,[-3]:LA,33:NA,38:Mk,42:vk,60:[Sk,xA],91:FA,92:[lA,Ak],93:CA,95:vk,96:Hk},pj={null:[vk,ej]},mj={null:[42,95]},hj={null:[]};function gj(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=BO(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=_k(a,l.events,l),l.events):[]}function f(e,t){return vj(p(e),t)}function p(e){return _j(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(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){U(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&&zO(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 _j(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 vj(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=`
|
|
@@ -93,7 +93,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
93
93
|
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
94
94
|
`,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=zz(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Hz.peek=Uz;function Hz(e){return e.value||``}function Uz(){return`<`}Wz.peek=Gz;function Wz(e,t,n,r){let i=Nz(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Gz(){return`!`}Kz.peek=qz;function Kz(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function qz(){return`!`}Jz.peek=Yz;function Jz(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Yz(){return"`"}function Xz(e,t){let n=NO(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}Zz.peek=Qz;function Zz(e,t,n,r){let i=Nz(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(Xz(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Qz(e,t,n){return Xz(e,n)?`<`:`[`}$z.peek=eB;function $z(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function eB(){return`[`}function tB(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function nB(e){let t=tB(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function rB(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function iB(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function aB(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?rB(n):tB(n),s=e.ordered?o===`.`?`)`:`.`:nB(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),iB(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function oB(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function sB(e,t,n,r){let i=oB(n),a=n.bulletCurrent||tB(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function cB(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function lB(e,t,n,r){if(!e.children.some(function(e){return Sz(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function uB(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}dB.attention=fB,dB.peek=pB;function dB(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function fB(e,t){return{construct:`strong`,markers:uB(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function pB(e,t,n){return n.options.strong||`*`}function mB(e,t,n,r){let i=t?t.children:[],a=i.indexOf(e);return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function hB(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function gB(e,t,n){let r=(iB(n)+(n.options.ruleSpaces?` `:``)).repeat(hB(n));return n.options.ruleSpaces?r.slice(0,-1):r}var _B={blockquote:Cz,break:Dz,code:jz,definition:Pz,emphasis:Iz,hardBreak:Dz,heading:Vz,html:Hz,image:Wz,imageReference:Kz,inlineCode:Jz,link:Zz,linkReference:$z,list:aB,listItem:sB,paragraph:cB,root:lB,strong:dB,text:mB,thematicBreak:gB};function vB(){return{enter:{table:yB,tableData:CB,tableHeader:CB,tableRow:xB},exit:{codeText:wB,table:bB,tableData:SB,tableHeader:SB,tableRow:SB}}}function yB(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function bB(e){this.exit(e),this.data.inTable=void 0}function xB(e){this.enter({type:`tableRow`,children:[]},e)}function SB(e){this.exit(e)}function CB(e){this.enter({type:`tableCell`,children:[]},e)}function wB(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,TB));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function TB(e,t){return t===`|`?t:e}function EB(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
95
95
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
96
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return yz(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=_B.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function DB(){return{exit:{taskListCheckValueChecked:kB,taskListCheckValueUnchecked:kB,paragraph:AB}}}function OB(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:jB}}}function kB(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function AB(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function jB(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=_B.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function MB(){return[IR(),oz(),dz(),vB(),DB()]}function NB(e){return{extensions:[LR(),sz(e),fz(),EB(e),OB()]}}var PB={tokenize:JB,partial:!0},FB={tokenize:YB,partial:!0},IB={tokenize:XB,partial:!0},LB={tokenize:ZB,partial:!0},RB={tokenize:QB,partial:!0},zB={name:`wwwAutolink`,tokenize:KB,previous:$B},BB={name:`protocolAutolink`,tokenize:qB,previous:eV},VB={name:`emailAutolink`,tokenize:GB,previous:tV},HB={};function UB(){return{text:HB}}for(var WB=48;WB<123;)HB[WB]=VB,WB++,WB===58?WB=65:WB===91&&(WB=97);HB[43]=VB,HB[45]=VB,HB[46]=VB,HB[95]=VB,HB[72]=[VB,BB],HB[104]=[VB,BB],HB[87]=[VB,zB],HB[119]=[VB,zB];function GB(e,t,n){let r=this,i,a;return o;function o(t){return!nV(t)||!tV.call(r,r.previous)||rV(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return nV(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(RB,u,l)(t):t===45||t===95||JO(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&qO(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function KB(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!$B.call(r,r.previous)||rV(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(PB,e.attempt(FB,e.attempt(IB,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function qB(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&eV.call(r,r.previous)&&!rV(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(qO(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||XO(t)||ek(t)||rk(t)||nk(t)?n(t):e.attempt(FB,e.attempt(IB,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function JB(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function YB(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(LB,c,s)(t):t===null||ek(t)||rk(t)||t!==45&&nk(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function XB(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(LB,t,a)(o):o===null||ek(o)||rk(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function ZB(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||ek(o)||rk(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||ek(e)||rk(e)?t(e):r(e)}function a(e){return qO(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):qO(t)?(e.consume(t),o):n(t)}}function QB(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return JO(e)?n(e):t(e)}}function $B(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ek(e)}function eV(e){return!qO(e)}function tV(e){return!(e===47||nV(e))}function nV(e){return e===43||e===45||e===46||e===95||JO(e)}function rV(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var iV={tokenize:fV,partial:!0};function aV(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:lV,continuation:{tokenize:uV},exit:dV}},text:{91:{name:`gfmFootnoteCall`,tokenize:cV},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:oV,resolveTo:sV}}}}function oV(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=KO(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function sV(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function cV(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||ek(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(KO(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return ek(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function lV(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||ek(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=KO(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return ek(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),ok(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function uV(e,t,n){return e.check(wk,t,e.attempt(iV,t,n))}function dV(e){e.exit(`gfmFootnoteDefinition`)}function fV(e,t,n){let r=this;return ok(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function pV(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&zO(o,o.length,0,_k(s,e.slice(r+1,n),t)),zO(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),zO(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=gk(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=gk(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var mV=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){hV(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function hV(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function gV(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function _V(){return{flow:{null:{name:`table`,tokenize:vV,resolveAll:yV}}}}function vV(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):U(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):tk(t)?ok(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||ek(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,tk(t)?ok(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return tk(t)?ok(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||U(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return tk(t)?ok(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||U(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||U(n)?(e.exit(`tableRow`),t(n)):tk(n)?ok(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||ek(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function yV(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new mV;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(xV(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=bV(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=bV(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=bV(f,t,o,i,n,d)):(o[0]=o[1],d=bV(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&xV(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=gV(t.events,n))}return e}function bV(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},SV(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=SV(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=SV(t.events,n[2]),a=SV(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},SV(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function xV(e,t,n,r,i){let a=[],o=SV(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function SV(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var CV={name:`tasklistCheck`,tokenize:TV};function wV(){return{text:{91:CV}}}function TV(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return ek(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return U(r)?t(r):tk(r)?e.check({tokenize:EV},t,n)(r):n(r)}}function EV(e,t,n){return ok(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function DV(e){return HO([UB(),aV(),pV(e),_V(),wV()])}var OV={};function kV(e){let t=this,n=e||OV,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(DV(n)),a.push(MB()),o.push(NB(n))}function AV(e){let[t,n]=(0,P.useState)(null),r=_f();return(0,P.useEffect)(()=>{let t=!0;return Ae(async()=>{let{getSharedHighlighter:e}=await import(`./dist-BtDwoA_O.js`);return{getSharedHighlighter:e}},__vite__mapDeps([6,7,1])).then(({getSharedHighlighter:t})=>t({themes:[r],langs:[e.language],preferredHighlighter:`shiki-wasm`}).then(t=>({highlighter:t,lang:e.language})).catch(()=>t({themes:[r],langs:[`text`],preferredHighlighter:`shiki-wasm`}).then(e=>({highlighter:e,lang:`text`})))).then(({highlighter:t,lang:n})=>t.codeToHast(e.code,{lang:n,themes:{light:r,dark:r},defaultColor:!1,transformers:[{pre(e){delete e.properties.style}}]})).then(e=>{t&&n((0,H.jsx)(`div`,{className:`chat-markdown-shiki`,children:lO(e,{Fragment:P.Fragment,jsx:H.jsx,jsxs:H.jsxs})}))}).catch(e=>console.error(e)),()=>{t=!1}},[e.code,e.language,r]),t===null?(0,H.jsx)(`pre`,{children:(0,H.jsx)(`code`,{children:e.code})}):t}function jV(){let[e,t]=(0,P.useState)(!1);async function n(e){try{if(!window.isSecureContext)throw Error(`Copying needs https or localhost`);await navigator.clipboard.writeText(e),t(!0),setTimeout(()=>t(!1),1500)}catch(e){V(e)}}return{copied:e,copy:n}}function MV(e){let t=(0,P.useRef)(null),[n,r]=(0,P.useState)(!0),i=jV(),a=n?`Collapse table cells`:`Expand table cells`,o=i.copied?`Copied`:`Copy table`;function s(e){let n=t.current;if(n===null)return;let r=[...n.rows].map(e=>[...e.cells].map(e=>(e.textContent??``).trim())),a=e===`markdown`?r.flatMap((e,t)=>{let n=`| ${e.map(e=>e.replaceAll(`|`,`\\|`)).join(` | `)} |`;return t===0?[n,`| ${e.map(()=>`---`).join(` | `)} |`]:[n]}).join(`
|
|
96
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return yz(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=_B.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function DB(){return{exit:{taskListCheckValueChecked:kB,taskListCheckValueUnchecked:kB,paragraph:AB}}}function OB(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:jB}}}function kB(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function AB(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function jB(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=_B.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function MB(){return[IR(),oz(),dz(),vB(),DB()]}function NB(e){return{extensions:[LR(),sz(e),fz(),EB(e),OB()]}}var PB={tokenize:JB,partial:!0},FB={tokenize:YB,partial:!0},IB={tokenize:XB,partial:!0},LB={tokenize:ZB,partial:!0},RB={tokenize:QB,partial:!0},zB={name:`wwwAutolink`,tokenize:KB,previous:$B},BB={name:`protocolAutolink`,tokenize:qB,previous:eV},VB={name:`emailAutolink`,tokenize:GB,previous:tV},HB={};function UB(){return{text:HB}}for(var WB=48;WB<123;)HB[WB]=VB,WB++,WB===58?WB=65:WB===91&&(WB=97);HB[43]=VB,HB[45]=VB,HB[46]=VB,HB[95]=VB,HB[72]=[VB,BB],HB[104]=[VB,BB],HB[87]=[VB,zB],HB[119]=[VB,zB];function GB(e,t,n){let r=this,i,a;return o;function o(t){return!nV(t)||!tV.call(r,r.previous)||rV(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return nV(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(RB,u,l)(t):t===45||t===95||JO(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&qO(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function KB(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!$B.call(r,r.previous)||rV(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(PB,e.attempt(FB,e.attempt(IB,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function qB(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&eV.call(r,r.previous)&&!rV(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(qO(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||XO(t)||ek(t)||rk(t)||nk(t)?n(t):e.attempt(FB,e.attempt(IB,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function JB(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function YB(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(LB,c,s)(t):t===null||ek(t)||rk(t)||t!==45&&nk(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function XB(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(LB,t,a)(o):o===null||ek(o)||rk(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function ZB(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||ek(o)||rk(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||ek(e)||rk(e)?t(e):r(e)}function a(e){return qO(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):qO(t)?(e.consume(t),o):n(t)}}function QB(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return JO(e)?n(e):t(e)}}function $B(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ek(e)}function eV(e){return!qO(e)}function tV(e){return!(e===47||nV(e))}function nV(e){return e===43||e===45||e===46||e===95||JO(e)}function rV(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var iV={tokenize:fV,partial:!0};function aV(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:lV,continuation:{tokenize:uV},exit:dV}},text:{91:{name:`gfmFootnoteCall`,tokenize:cV},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:oV,resolveTo:sV}}}}function oV(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=KO(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function sV(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function cV(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||ek(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(KO(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return ek(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function lV(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||ek(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=KO(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return ek(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),ok(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function uV(e,t,n){return e.check(wk,t,e.attempt(iV,t,n))}function dV(e){e.exit(`gfmFootnoteDefinition`)}function fV(e,t,n){let r=this;return ok(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function pV(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&zO(o,o.length,0,_k(s,e.slice(r+1,n),t)),zO(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),zO(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=gk(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=gk(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var mV=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){hV(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function hV(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function gV(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function _V(){return{flow:{null:{name:`table`,tokenize:vV,resolveAll:yV}}}}function vV(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):U(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):tk(t)?ok(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||ek(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,tk(t)?ok(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return tk(t)?ok(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||U(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return tk(t)?ok(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||U(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||U(n)?(e.exit(`tableRow`),t(n)):tk(n)?ok(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||ek(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function yV(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new mV;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(xV(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=bV(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=bV(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=bV(f,t,o,i,n,d)):(o[0]=o[1],d=bV(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&xV(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=gV(t.events,n))}return e}function bV(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},SV(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=SV(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=SV(t.events,n[2]),a=SV(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},SV(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function xV(e,t,n,r,i){let a=[],o=SV(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function SV(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var CV={name:`tasklistCheck`,tokenize:TV};function wV(){return{text:{91:CV}}}function TV(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return ek(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return U(r)?t(r):tk(r)?e.check({tokenize:EV},t,n)(r):n(r)}}function EV(e,t,n){return ok(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function DV(e){return HO([UB(),aV(),pV(e),_V(),wV()])}var OV={};function kV(e){let t=this,n=e||OV,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(DV(n)),a.push(MB()),o.push(NB(n))}function AV(e){let[t,n]=(0,P.useState)(null),r=_f();return(0,P.useEffect)(()=>{let t=!0;return Ae(async()=>{let{getSharedHighlighter:e}=await import(`./dist-M_vc7ku0.js`);return{getSharedHighlighter:e}},__vite__mapDeps([6,7,1])).then(({getSharedHighlighter:t})=>t({themes:[r],langs:[e.language],preferredHighlighter:`shiki-wasm`}).then(t=>({highlighter:t,lang:e.language})).catch(()=>t({themes:[r],langs:[`text`],preferredHighlighter:`shiki-wasm`}).then(e=>({highlighter:e,lang:`text`})))).then(({highlighter:t,lang:n})=>t.codeToHast(e.code,{lang:n,themes:{light:r,dark:r},defaultColor:!1,transformers:[{pre(e){delete e.properties.style}}]})).then(e=>{t&&n((0,H.jsx)(`div`,{className:`chat-markdown-shiki`,children:lO(e,{Fragment:P.Fragment,jsx:H.jsx,jsxs:H.jsxs})}))}).catch(e=>console.error(e)),()=>{t=!1}},[e.code,e.language,r]),t===null?(0,H.jsx)(`pre`,{children:(0,H.jsx)(`code`,{children:e.code})}):t}function jV(){let[e,t]=(0,P.useState)(!1);async function n(e){try{if(!window.isSecureContext)throw Error(`Copying needs https or localhost`);await navigator.clipboard.writeText(e),t(!0),setTimeout(()=>t(!1),1500)}catch(e){V(e)}}return{copied:e,copy:n}}function MV(e){let t=(0,P.useRef)(null),[n,r]=(0,P.useState)(!0),i=jV(),a=n?`Collapse table cells`:`Expand table cells`,o=i.copied?`Copied`:`Copy table`;function s(e){let n=t.current;if(n===null)return;let r=[...n.rows].map(e=>[...e.cells].map(e=>(e.textContent??``).trim())),a=e===`markdown`?r.flatMap((e,t)=>{let n=`| ${e.map(e=>e.replaceAll(`|`,`\\|`)).join(` | `)} |`;return t===0?[n,`| ${e.map(()=>`---`).join(` | `)} |`]:[n]}).join(`
|
|
97
97
|
`):r.map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replaceAll(`"`,`""`)}"`:e).join(`,`)).join(`
|
|
98
98
|
`);i.copy(a)}return(0,H.jsxs)(`div`,{className:`chat-markdown-table-container`,"data-expanded":n,children:[(0,H.jsx)(`div`,{className:`chat-markdown-table-scroll`,children:(0,H.jsx)(`table`,{ref:t,children:e.children})}),(0,H.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between select-none`,children:[(0,H.jsx)(M,{label:a,children:(0,H.jsx)(y,{type:`button`,variant:n?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":n,"aria-label":a,onClick:()=>{let e=t.current;if(e!==null&&!n){let t=[];for(let n of e.rows)[...n.cells].forEach((e,n)=>{t[n]=Math.max(t[n]??0,e.getBoundingClientRect().width)});[...e.tHead?.rows[0]?.cells??[]].forEach((e,n)=>{e.style.minWidth=`${t[n]}px`})}r(!n)},children:(0,H.jsx)(w,{icon:n?WT:VT,className:`size-3`})})}),(0,H.jsxs)(SD,{children:[(0,H.jsx)(M,{label:o,children:(0,H.jsx)(wD,{asChild:!0,children:(0,H.jsx)(y,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":o,children:(0,H.jsx)(w,{icon:i.copied?Qw:sT,className:`size-3`})})})}),(0,H.jsxs)(TD,{align:`end`,children:[(0,H.jsx)(ED,{onSelect:()=>s(`markdown`),children:`Copy as Markdown`}),(0,H.jsx)(ED,{onSelect:()=>s(`csv`),children:`Copy as CSV`})]})]})]})]})}function NV(e){let[t,n]=(0,P.useState)(e.open),r=P.Children.toArray(e.children),i=r.findIndex(e=>(0,P.isValidElement)(e)&&e.type===`summary`),a=r[i];return(0,H.jsxs)(`div`,{className:`border-border/60 my-2 border-y`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":t,className:`text-foreground flex w-full items-center gap-2 py-2 text-left text-sm font-medium`,onClick:()=>n(!t),children:[(0,H.jsx)(w,{icon:eT,"aria-hidden":!0,className:c(`text-muted-foreground size-4 shrink-0 transition-transform`,t&&`rotate-90`)}),(0,H.jsx)(`span`,{children:(0,P.isValidElement)(a)&&a.props.children!==void 0?a.props.children:`Details`})]}),t&&(0,H.jsx)(`div`,{className:`text-foreground/80 ps-6 pb-3`,children:r.filter((e,t)=>t!==i)})]})}var PV=(0,P.lazy)(async()=>({default:(await Ae(async()=>{let{VideoViewer:e}=await import(`./video-viewer-B404MUMw.js`);return{VideoViewer:e}},__vite__mapDeps([8,1,2,3,9]))).VideoViewer}));function FV(e){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(null),a=e.alt===``?e.name:e.alt;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,"aria-label":`Play ${a}`,className:c(`group focus-visible:ring-ring border-border/40 relative inline-block cursor-pointer overflow-hidden rounded-lg border bg-black align-top outline-none focus-visible:ring-2`,e.className),onClick:()=>n(!0),children:[(0,H.jsx)(`video`,{src:`${e.src}#t=0.001`,"aria-hidden":!0,tabIndex:-1,muted:!0,playsInline:!0,preload:`metadata`,className:`pointer-events-none block h-auto max-h-[28rem] w-auto max-w-full`,onError:e.onError,onLoadedMetadata:e=>i(Number.isFinite(e.currentTarget.duration)?e.currentTarget.duration:null)}),(0,H.jsx)(`span`,{className:`absolute inset-0 grid place-items-center bg-black/10 transition-colors group-hover:bg-black/25`,children:(0,H.jsx)(`span`,{className:`grid size-12 place-items-center rounded-full bg-black/60 text-white backdrop-blur-sm transition-transform group-hover:scale-105`,children:(0,H.jsx)(w,{icon:rE,className:`size-5 translate-x-px fill-current`})})}),r!==null&&(0,H.jsx)(`span`,{className:`text-2xs absolute right-2 bottom-2 rounded-md bg-black/60 px-1.5 py-0.5 font-mono text-white tabular-nums`,children:rp(r)})]}),t&&(0,H.jsx)(P.Suspense,{children:(0,H.jsx)(PV,{src:e.src,label:a,name:e.name,onClose:()=>n(!1)})})]})}var IV=new Map([[`.png`,`image/png`],[`.jpg`,`image/jpeg`],[`.jpeg`,`image/jpeg`],[`.gif`,`image/gif`],[`.webp`,`image/webp`],[`.svg`,`image/svg+xml`],[`.mp4`,`video/mp4`],[`.m4v`,`video/mp4`],[`.webm`,`video/webm`],[`.mov`,`video/quicktime`],[`.mp3`,`audio/mpeg`],[`.wav`,`audio/wav`],[`.ogg`,`audio/ogg`],[`.opus`,`audio/ogg`],[`.m4a`,`audio/mp4`],[`.aac`,`audio/aac`],[`.flac`,`audio/flac`]]);function LV(e){let t=/\.[a-z0-9]+$/i.exec(e.split(/[?#]/)[0])?.[0],n=t===void 0?void 0:IV.get(t.toLowerCase());return n?.startsWith(`image/`)===!0?`image`:n?.startsWith(`video/`)===!0?`video`:n?.startsWith(`audio/`)===!0?`audio`:null}async function RV(e,t,n){let r=await F(e,`files.media`,{projectId:t,path:n});return`${Zt(e)}/api/media?${new URLSearchParams({token:r})}`}var zV={image:kT,video:OE,audio:wE},BV={image:`Image unavailable`,video:`Video unavailable`,audio:`Audio unavailable`};function VV(e){let t=z(e=>e.selection),[n,r]=(0,P.useState)(null);return(0,P.useEffect)(()=>{if(t===null)return;let n=!0;async function i(e,t,i){try{let a=await RV(e,t,i);n&&r({path:i,src:a})}catch(e){n&&r({path:i,error:D(e)})}}return i(t.machine,t.projectId,e.path),()=>{n=!1}},[t,e.path]),n===null||n.path!==e.path?null:`error`in n?(0,H.jsx)(UV,{kind:LV(e.path)??`image`,reason:n.error,raw:e.raw}):(0,H.jsx)(HV,{src:n.src,alt:e.alt,name:e.path,kind:LV(e.path)??`image`,raw:e.raw})}function HV(e){let[t,n]=(0,P.useState)(null);return t===e.src?(0,H.jsx)(UV,{kind:e.kind,reason:`It could not be loaded`,raw:e.raw}):e.kind===`video`?(0,H.jsx)(FV,{src:e.src,alt:e.alt,name:e.name,className:`max-w-[min(100%,36rem)]`,onError:()=>n(e.src)}):e.kind===`audio`?(0,H.jsx)(`audio`,{src:e.src,"aria-label":e.alt,controls:!0,preload:`metadata`,className:`inline-block w-full max-w-[min(100%,28rem)] align-top`,onError:()=>n(e.src)}):(0,H.jsx)(_D,{src:e.src,alt:e.alt,name:e.name,className:`inline-block max-w-[min(100%,36rem)] align-top`,imageClassName:`border-border/40 h-auto max-h-[28rem] w-auto max-w-full rounded-lg border object-contain`,onError:()=>n(e.src)})}function UV(e){return(0,H.jsxs)(`span`,{className:`border-border/70 text-muted-foreground inline-flex max-w-full flex-col gap-1 rounded-lg border border-dashed px-3 py-2 align-top text-xs`,children:[(0,H.jsxs)(`span`,{className:`flex items-start gap-1.5`,children:[(0,H.jsx)(w,{icon:zV[e.kind],"aria-hidden":!0,className:`mt-px size-3.5 shrink-0`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`text-foreground/80 font-medium`,children:BV[e.kind]}),` · ${e.reason}`]})]}),(0,H.jsx)(`span`,{className:`text-2xs font-mono break-all opacity-80`,children:e.raw})]})}var WV={note:{label:`Note`,icon:jT,border:`border-blue-500/70`,title:`text-blue-600 dark:text-blue-400`},tip:{label:`Tip`,icon:IT,border:`border-emerald-500/70`,title:`text-emerald-600 dark:text-emerald-400`},important:{label:`Important`,icon:UT,border:`border-purple-500/70`,title:`text-purple-600 dark:text-purple-400`},warning:{label:`Warning`,icon:CE,border:`border-amber-500/70`,title:`text-amber-600 dark:text-amber-500`},caution:{label:`Caution`,icon:YT,border:`border-red-500/70`,title:`text-red-600 dark:text-red-400`}},GV={...lR,attributes:{...lR.attributes,blockquote:[...lR.attributes?.blockquote??[],`dataAlert`]}},KV=new Set;function qV(){return e=>{function t(e){e.children?.forEach(t),JV(e)}t(e)}}function JV(e){if(e.type!==`blockquote`)return;let t=e.children?.[0],n=t?.children?.[0];if(t?.type!==`paragraph`||n?.type!==`text`||typeof n.value!=`string`)return;let r=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\](?:\r?\n|$)/i.exec(n.value);if(r===null)return;let i=n.value.slice(r[0].length);if(i.length>0)n.value=i;else if(r[0].endsWith(`
|
|
99
99
|
`)||t.children?.length===1)t.children?.shift(),t.children?.length===0&&e.children?.shift();else return;e.data={...e.data,hProperties:{...e.data?.hProperties,dataAlert:r[1].toLowerCase()}}}var YV={blockquote({node:e,children:t}){let n=e?.properties.dataAlert,r=n===`note`||n===`tip`||n===`important`||n===`warning`||n===`caution`?WV[n]:null;return r===null?(0,H.jsx)(`blockquote`,{children:t}):(0,H.jsxs)(`div`,{role:`note`,className:c(`my-1 border-l-2 pl-3`,r.border),children:[(0,H.jsxs)(`p`,{className:c(`flex items-center gap-1.5 font-medium`,r.title),children:[(0,H.jsx)(w,{icon:r.icon,"aria-hidden":!0,className:`size-3.5 shrink-0`}),r.label]}),t]})},ol({node:e,start:t,children:n}){let r=e?.children.filter(e=>e.type===`element`&&e.tagName===`li`).length??0,i=t??1,a=Math.max(String(i).length,String(i+Math.max(r-1,0)).length);return(0,H.jsx)(`ol`,{start:t,ref:e=>{e!==null&&a>1&&e.style.setProperty(`--list-gutter`,`${a+2}ch`)},children:n})},a({node:e,href:t,children:n}){let r=QV(t);if(r===null)return(0,H.jsx)(`a`,{href:t,children:n});let i=e?.children.every(e=>e.type===`text`)?e.children.map(e=>e.type===`text`?e.value:``).join(``):``;return(0,H.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:i===``?n:(0,H.jsx)($V,{host:r,text:i})})},table({children:e}){return(0,H.jsx)(MV,{children:e})},details({open:e,children:t}){return(0,H.jsx)(NV,{open:e===!0,children:t})},img({src:e,alt:t}){return typeof e==`string`?e.startsWith(`/`)&&!e.startsWith(`//`)||e.startsWith(`./`)?(0,H.jsx)(VV,{path:decodeURI(e),alt:t??``,raw:``}):(0,H.jsx)(HV,{src:e,alt:t??``,name:e.startsWith(`data:`)?`Image`:e.split(/[?#]/)[0],kind:LV(e)??`image`,raw:``}):null},pre({node:e,children:t}){let n=e?.children[0];if(n?.type!==`element`||n.tagName!==`code`)return(0,H.jsx)(`pre`,{children:t});let r=n.children.map(e=>e.type===`text`?e.value:``).join(``),i=n.properties.className,a=Array.isArray(i)?i.map(String).find(e=>e.startsWith(`language-`))?.slice(9):void 0;return(0,H.jsx)(tH,{code:r.replace(/\n$/,``),language:a===`gitignore`?`ini`:a??`text`})}},XV=(0,P.memo)(ZV);function ZV(e){return(0,H.jsx)(`div`,{className:c(`chat-markdown text-foreground w-full min-w-0 text-sm leading-relaxed [overflow-wrap:anywhere] [word-break:break-word]`,e.className),"data-streaming":e.streaming===!0?``:void 0,children:(0,H.jsx)(LN,{remarkPlugins:e.lineBreaks===!0?[kV,qV,NR]:[kV,qV],rehypePlugins:e.rawHtml===!1?[]:[Mte,[TR,GV]],components:YV,children:e.text})})}function QV(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).host}catch{return null}}function $V(e){let t=/^https?:\/\//i.exec(e.text)?.[0].length??Math.min(e.text.length,1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,H.jsx)(eH,{host:e.host}),e.text.slice(0,t)]}),Array.from(e.text.slice(t),(e,t)=>(0,H.jsxs)(`span`,{children:[e,(0,H.jsx)(`wbr`,{})]},t))]})}function eH(e){let[t,n]=(0,P.useState)(KV.has(e.host)),r=e.host.toLowerCase(),i=r===`github.com`||r.endsWith(`.github.com`);return(0,H.jsx)(`span`,{className:`ms-[0.25em] me-[0.2em] inline-flex size-[14px] [vertical-align:-0.125em]`,"aria-hidden":!0,children:i?(0,H.jsx)(w,{icon:CT,className:`block size-full shrink-0 select-none`}):t?(0,H.jsx)(w,{icon:wT,className:`block size-full shrink-0 select-none`}):(0,H.jsx)(`img`,{src:`https://${e.host}/favicon.ico`,alt:``,loading:`lazy`,draggable:!1,className:`block size-full shrink-0 rounded-sm select-none`,onError:()=>{KV.add(e.host),n(!0)}})})}function tH(e){let[t,n]=(0,P.useState)(!0),r=jV(),i=t?`Disable line wrap`:`Wrap lines`,a=r.copied?`Copied`:`Copy code`;return(0,H.jsxs)(`div`,{className:`chat-markdown-codeblock border-border/70 bg-secondary dark:bg-input/32 my-[0.65rem] overflow-hidden rounded-lg border leading-snug dark:border-transparent`,"data-language":e.language,"data-wrap":t,children:[(0,H.jsxs)(`div`,{className:`chat-markdown-codeblock-header flex items-center justify-between gap-2 pt-1.5 pr-1.5 pb-0 pl-3 select-none`,children:[(0,H.jsx)(`span`,{className:`text-2xs inline-flex min-w-0 items-center gap-1.5 font-mono`,children:pe(e.language)?(0,H.jsx)(M,{label:e.language,children:(0,H.jsx)(`span`,{className:`inline-flex shrink-0 rounded-sm`,"aria-label":`Language: ${e.language}`,children:(0,H.jsx)(Te,{path:me(e.language),className:`size-3.5`})})}):(0,H.jsx)(`span`,{className:`truncate`,children:e.language})}),(0,H.jsxs)(`span`,{className:`flex items-center gap-0.5`,role:`toolbar`,children:[(0,H.jsx)(M,{label:i,children:(0,H.jsx)(y,{type:`button`,variant:t?`secondary`:`ghost-muted`,size:`icon-xs`,"aria-pressed":t,"aria-label":i,onClick:()=>n(!t),children:(0,H.jsx)(w,{icon:xE,className:`size-3`})})}),(0,H.jsx)(M,{label:a,children:(0,H.jsx)(y,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":a,onClick:()=>void r.copy(e.code),children:(0,H.jsx)(w,{icon:r.copied?Qw:sT,className:`size-3`})})})]})]}),(0,H.jsx)(AV,{code:e.code,language:e.language})]})}var nH=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},rH=new class extends nH{};function iH(e,t,n){return rH.diff(e,t,n)}function aH(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function oH(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function sH(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function cH(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function lH(e,t){return sH(e,t,``)}function uH(e,t){return cH(e,t,``)}function dH(e,t){return t.slice(0,fH(e,t))}function fH(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function pH(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function mH(e,t){if(t)return gH(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function hH(e,t){if(t)return gH(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function gH(e,t){if(!t)return[hH(e),mH(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=pH(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var _H=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,vH=RegExp(`[${_H}]+|\\s+|[^${_H}]`,`ug`);new class extends nH{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=pH(e,r)}else n=e.match(vH)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&yH(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&yH(n,i,r,null,t.intlSegmenter),e}};function yH(e,t,n,r,i){if(t&&n){let[a,o]=gH(t.value,i),[s,c]=gH(n.value,i);if(e){let r=aH(a,s);e.value=cH(e.value,s,r),t.value=lH(t.value,r),n.value=lH(n.value,r)}if(r){let e=oH(o,c);r.value=sH(r.value,c,e),t.value=uH(t.value,e),n.value=uH(n.value,e)}}else if(n){if(e){let e=hH(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=hH(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=hH(r.value,i),[a,o]=gH(t.value,i),s=aH(n,a);t.value=lH(t.value,s);let c=oH(lH(n,s),o);t.value=uH(t.value,c),r.value=sH(r.value,n,c),e.value=cH(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=hH(r.value,i),n=dH(mH(t.value,i),e);t.value=uH(t.value,n)}else if(e){let n=dH(mH(e.value,i),hH(t.value,i));t.value=lH(t.value,n)}}var bH=new class extends nH{tokenize(e){let t=RegExp(`(\\r?\\n)|[${_H}]+|[^\\S\\n\\r]+|[^${_H}]`,`ug`);return e.match(t)||[]}};function xH(e,t,n){return bH.diff(e,t,n)}var SH=new class extends nH{constructor(){super(...arguments),this.tokenize=wH}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|