runcastle 1.3.6 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/runcastle.js +4605 -2723
- package/drizzle/0037_amusing_steve_rogers.sql +7 -0
- package/drizzle/0038_project_docs_commit_prefix.sql +1 -0
- package/drizzle/0039_chat_session_kind.sql +3 -0
- package/drizzle/0039_review_verdict.sql +5 -0
- package/drizzle/0040_new_maestro.sql +10 -0
- package/drizzle/0041_round_harpoon.sql +2 -0
- package/drizzle/meta/0037_snapshot.json +1118 -0
- package/drizzle/meta/0040_snapshot.json +1212 -0
- package/drizzle/meta/0041_snapshot.json +1226 -0
- package/drizzle/meta/_journal.json +35 -0
- package/index.js +4599 -2718
- package/package.json +2 -1
- package/sandcastle-template/Containerfile +12 -3
- package/sandcastle-template/Dockerfile +12 -3
- package/skills/burner/implement-ticket.md +4 -1
- package/skills/burner/review-ticket.md +21 -3
- package/skills/burner/verify-fixes.md +11 -3
- package/skills/packs/README.md +42 -28
- package/skills/packs/runcastle/skills/code-review/SKILL.md +10 -0
- package/skills/packs/runcastle/skills/converge/SKILL.md +8 -6
- package/skills/packs/runcastle/skills/ideate/SKILL.md +5 -5
- package/skills/packs/runcastle/skills/prepare/SKILL.md +1 -1
- package/skills/packs/runcastle/skills/project/SKILL.md +26 -11
- package/skills/packs/runcastle/skills/project/references/health-sweeps.md +7 -4
- package/skills/packs/runcastle/skills/project/references/triage.md +183 -0
- package/skills/packs/runcastle/skills/qa/SKILL.md +4 -3
- package/skills/packs/runcastle/skills/revisit/SKILL.md +28 -15
- package/skills/packs/runcastle/skills/spec/SKILL.md +2 -2
- package/skills/packs/runcastle/skills/tickets/SKILL.md +22 -6
- package/skills/packs/runcastle/skills/waypoint/SKILL.md +2 -2
- package/web/assets/index-L11zqTP_.css +1 -0
- package/web/assets/index-x1_wkP9-.js +187 -0
- package/web/index.html +2 -2
- package/web/assets/index-D697YlOb.css +0 -1
- package/web/assets/index-jbVdnCzO.js +0 -186
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},d=new class extends u{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},f={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},p=new class{#e=f;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function m(e){setTimeout(e,0)}var h=typeof window>`u`||`Deno`in globalThis;function g(){}function _(e,t){return typeof e==`function`?e(t):e}function v(e){return typeof e==`number`&&e>=0&&e!==1/0}function y(e,t){return Math.max(e+(t||0)-Date.now(),0)}function b(e,t){return typeof e==`function`?e(t):e}function x(e,t){return typeof e==`function`?e(t):e}function S(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==w(o,t.options))return!1}else if(!E(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function C(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!E(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function w(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>j(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function E(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>E(e[n],t[n])):!1}var D=Object.prototype.hasOwnProperty;function O(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=A(e)&&A(t);if(!r&&!(j(e)&&j(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:D.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=O(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function k(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function A(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function j(e){if(!M(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!M(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function M(e){return Object.prototype.toString.call(e)===`[object Object]`}function N(e){return new Promise(t=>{p.setTimeout(t,e)})}function P(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:O(e,t)}function F(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ee(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var te=Symbol();function ne(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===te?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function I(e,t){return typeof e==`function`?e(...t):!!e}function re(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ie=(()=>{let e=()=>h;return{isServer(){return e()},setIsServer(t){e=t}}})();function ae(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var oe=m;function se(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=oe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ce=se(),le=new class extends u{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ue(e){return Math.min(1e3*2**e,3e4)}function de(e){return(e??`online`)!==`online`||le.isOnline()}var fe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function pe(e){let t=!1,n=0,r,i=ae(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new fe(t);p(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>d.isFocused()&&(e.networkMode===`always`||le.isOnline())&&e.canRun(),u=()=>de(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(ie.isServer()?0:3),o=e.retryDelay??ue,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),N(s).then(()=>l()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),i)}}var me=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),v(this.gcTime)&&(this.#e=p.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ie.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(p.clearTimeout(this.#e),this.#e=void 0)}};function he(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{re(e,()=>t.signal,()=>n=!0)},u=ne(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ee:F;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?_e:ge,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ge(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function ge(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function _e(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function ve(e,t){return t?ge(e,t)!=null:!1}function ye(e,t){return!t||!e.getPreviousPageParam?!1:_e(e,t)!=null}var be=class extends me{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ce(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ce(this.options);e.data!==void 0&&(this.setState(Se(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=P(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(g).catch(g):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>x(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===te||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>b(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!y(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ne(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?he(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=pe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof fe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof fe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...xe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Se(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ce.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function xe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:de(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Se(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ce(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var we=class extends u{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=ae(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ee(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return De(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return De(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof x(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!k(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Oe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||x(this.options.enabled,this.#t)!==x(t.enabled,this.#t)||b(this.options.staleTime,this.#t)!==b(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||x(this.options.enabled,this.#t)!==x(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ae(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(g)),t}#g(){this.#b();let e=b(this.options.staleTime,this.#t);if(ie.isServer()||this.#r.isStale||!v(e))return;let t=y(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(ie.isServer()||x(this.options.enabled,this.#t)===!1||!v(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(p.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(p.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ee(e,t),o=i&&Oe(e,n,t,r);(a||o)&&(l={...l,...xe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=P(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=P(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ke(e,t),refetch:this.refetch,promise:this.#o,isEnabled:x(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=ae();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!k(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ce.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Te(e,t){return x(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&x(t.retryOnMount,e)===!1)}function Ee(e,t){return Te(e,t)||e.state.data!==void 0&&De(e,t,t.refetchOnMount)}function De(e,t,n){if(x(t.enabled,e)!==!1&&b(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ke(e,t)}return!1}function Oe(e,t,n,r){return(e!==t||x(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ke(e,n)}function ke(e,t){return x(t.enabled,e)!==!1&&e.isStaleByTime(b(t.staleTime,e))}function Ae(e,t){return!k(e.getCurrentResult(),t)}var je=class extends we{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:ve(t,n.data),hasPreviousPage:ye(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Me=class extends me{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ne(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=pe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ce.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ne(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Pe=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Me({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Fe(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Fe(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Fe(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Fe(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ce.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>C(t,e))}findAll(e={}){return this.getAll().filter(t=>C(e,t))}notify(e){ce.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ce.batch(()=>Promise.all(e.map(e=>e.continue().catch(g))))}};function Fe(e){return e.options.scope?.id}var Ie=class extends u{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),k(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&T(t.mutationKey)!==T(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ne();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ce.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Le(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Re(e,t,n){let r=e.slice(0);return r[t]=n,r}var ze=class extends u{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ce.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!k(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Le(e,n).forEach(e=>{e.destroy()}),Le(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=O(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new we(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Re(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&ce.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Be=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??w(r,t),a=this.get(i);return a||(a=new be({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ce.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>S(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>S(e,t)):t}notify(e){ce.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ce.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ce.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ve=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Be,this.#t=e.mutationCache||new Pe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=d.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=le.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(b(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=_(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ce.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ce.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ce.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ce.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(g).catch(g)}invalidateQueries(e,t={}){return ce.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ce.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(g)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(g)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(b(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(g).catch(g)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(g).catch(g)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return le.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(T(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{E(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(T(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{E(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=w(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===te&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},He=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ee=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},te={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=te,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,ee)}catch(e){ee(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),Ue=o(((e,t)=>{t.exports=He()})),We=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ge=o(((e,t)=>{t.exports=We()})),L=l(Ue(),1),R=Ge(),Ke=L.createContext(void 0),qe=e=>{let t=L.useContext(Ke);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Je=({client:e,children:t})=>(L.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,R.jsx)(Ke.Provider,{value:e,children:t})),Ye=L.createContext(!1),Xe=()=>L.useContext(Ye);Ye.Provider;function Ze(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Qe=L.createContext(Ze()),$e=()=>L.useContext(Qe),et=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?I(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tt=e=>{L.useEffect(()=>{e.clearReset()},[e])},nt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||I(n,[e.error,r])),rt=(e,t)=>t.state.data===void 0,it=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},at=(e,t)=>e.isLoading&&e.isFetching&&!t,ot=(e,t)=>e?.suspense&&t.isPending,st=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ct({queries:e,...t},n){let r=qe(n),i=Xe(),a=$e(),o=L.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{it(e);let t=r.getQueryCache().get(e.queryHash);et(e,a,t)}),tt(a);let[s]=L.useState(()=>new ze(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;L.useSyncExternalStore(L.useCallback(e=>d?s.subscribe(ce.batchCalls(e)):g,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),L.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>ot(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&ot(n,e)?st(n,new we(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&nt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function lt(e,t,n){let r=Xe(),i=$e(),a=qe(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,it(o),et(o,i,s),tt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=L.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(L.useSyncExternalStore(L.useCallback(e=>{let t=f?u.subscribe(ce.batchCalls(e)):g;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),L.useEffect(()=>{u.setOptions(o)},[o,u]),ot(o,d))throw st(o,u,i);if(nt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!ie.isServer()&&at(d,r)&&(l?st(o,u,i):s?.promise)?.catch(g).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function ut(e,t){return lt(e,we,t)}function dt(e,t){return lt({...e,enabled:!0,suspense:!0,throwOnError:rt,placeholderData:void 0},we,t)}function ft(e,t){return lt({...e,enabled:!0,suspense:!0,throwOnError:rt},je,t)}function pt(e,t){return ct({...e,queries:e.queries.map(e=>({...e,suspense:!0,throwOnError:rt,enabled:!0,placeholderData:void 0}))},t)}function mt(e,t){let n=qe(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function ht(e,t){let n=qe(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function gt(e){return e}function _t(e){return e}function vt(e,t){let n=qe(t),[r]=L.useState(()=>new Ie(n,e));L.useEffect(()=>{r.setOptions(e)},[r,e]);let i=L.useSyncExternalStore(L.useCallback(e=>r.subscribe(ce.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=L.useCallback((e,t)=>{r.mutate(e,t).catch(g)},[r]);if(i.error&&I(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function yt(e,t){return lt(e,je,t)}var bt=Object.create,xt=Object.defineProperty,St=Object.getOwnPropertyDescriptor,Ct=Object.getOwnPropertyNames,wt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty,Et=(e,t)=>function(){return t||(0,e[Ct(e)[0]])((t={exports:{}}).exports,t),t.exports},Dt=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Ct(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Tt.call(e,s)&&s!==n&&xt(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=St(t,s))||r.enumerable});return e},Ot=(e,t,n)=>(n=e==null?{}:bt(wt(e)),Dt(t||!e||!e.__esModule?xt(n,`default`,{value:e,enumerable:!0}):n,e)),kt=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),At=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=kt().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),jt=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=kt().default,r=At();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Mt=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=jt();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Nt=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Mt();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});function Pt(e){let t={subscribe(t){let n=null,r=!1,i=!1,a=!1;function o(){if(n===null){a=!0;return}i||(i=!0,typeof n==`function`?n():n&&n.unsubscribe())}return n=e({next(e){var n;r||(n=t.next)==null||n.call(t,e)},error(e){var n;r||(r=!0,(n=t.error)==null||n.call(t,e),o())},complete(){var e;r||(r=!0,(e=t.complete)==null||e.call(t),o())}}),a&&o(),{unsubscribe:o}},pipe(...e){return e.reduce(Ft,t)}};return t}function Ft(e,t){return t(e)}function It(e){let t=new AbortController;return new Promise((n,r)=>{let i=!1;function a(){i||(i=!0,o.unsubscribe())}t.signal.addEventListener(`abort`,()=>{r(t.signal.reason)});let o=e.subscribe({next(e){i=!0,n(e),a()},error(e){r(e)},complete(){t.abort(),a()}})})}function Lt(e){return e=>{let t=0,n=null,r=[];function i(){n||=e.subscribe({next(e){for(let n of r){var t;(t=n.next)==null||t.call(n,e)}},error(e){for(let n of r){var t;(t=n.error)==null||t.call(n,e)}},complete(){for(let t of r){var e;(e=t.complete)==null||e.call(t)}}})}function a(){if(t===0&&n){let e=n;n=null,e.unsubscribe()}}return Pt(e=>(t++,r.push(e),i(),{unsubscribe(){t--,a();let n=r.findIndex(t=>t===e);n>-1&&r.splice(n,1)}}))}}function Rt(e){let t=e,n=[],r=e=>{t!==void 0&&e.next(t),n.push(e)},i=e=>{n.splice(n.indexOf(e),1)},a=Pt(e=>(r(e),()=>{i(e)}));return a.next=e=>{if(t!==e){t=e;for(let t of n)t.next(e)}},a.get=()=>t,a}function zt(e){return Pt(t=>{function n(t=0,r=e.op){let i=e.links[t];if(!i)throw Error(`No more links to execute - did you forget to add an ending link?`);return i({op:r,next(e){return n(t+1,e)}})}return n().subscribe(t)})}function Bt(e){return!!e&&!Array.isArray(e)&&typeof e==`object`}function Vt(){return Object.create(null)}var Ht=typeof Symbol==`function`&&!!Symbol.asyncIterator;function Ut(e){return Ht&&Bt(e)&&Symbol.asyncIterator in e}var Wt={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};Wt.BAD_GATEWAY,Wt.SERVICE_UNAVAILABLE,Wt.GATEWAY_TIMEOUT,Wt.INTERNAL_SERVER_ERROR;var Gt=Object.create,Kt=Object.defineProperty,qt=Object.getOwnPropertyDescriptor,Jt=Object.getOwnPropertyNames,Yt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty,Zt=(e,t)=>function(){return t||(0,e[Jt(e)[0]])((t={exports:{}}).exports,t),t.exports},Qt=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Jt(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Xt.call(e,s)&&s!==n&&Kt(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=qt(t,s))||r.enumerable});return e},$t=(e,t,n)=>(n=e==null?{}:Gt(Yt(e)),Qt(t||!e||!e.__esModule?Kt(n,`default`,{value:e,enumerable:!0}):n,e)),en=()=>{},tn=e=>{Object.freeze&&Object.freeze(e)};function nn(e,t,n){let r=t.join(`.`);return n[r]??(n[r]=new Proxy(en,{get(r,i){if(!(typeof i!=`string`||i===`then`))return nn(e,[...t,i],n)},apply(n,r,i){let a=t[t.length-1];if(a===`valueOf`||a===`toString`||a===`toJSON`)return`tRPC.proxy(${t.slice(0,-1).join(`.`)})`;let o={args:i,path:t};return a===`call`?o={args:i.length>=2?[i[1]]:[],path:t.slice(0,-1)}:a===`apply`&&(o={args:i.length>=2?i[1]:[],path:t.slice(0,-1)}),tn(o.args),tn(o.path),e(o)}})),n[r]}var rn=e=>nn(e,[],Vt()),an=e=>new Proxy(en,{get(t,n){if(n!==`then`)return e(n)}}),on=Zt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),sn=Zt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=on().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),cn=Zt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=on().default,r=sn();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),ln=Zt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=cn();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),un=Zt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=ln();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});$t(un(),1),$t(ln(),1);var dn=$t(un(),1);function fn(e,t){if(`error`in e){let n=t.deserialize(e.error);return{ok:!1,error:(0,dn.default)((0,dn.default)({},e),{},{error:n})}}return{ok:!0,result:(0,dn.default)((0,dn.default)({},e.result),(!e.result.type||e.result.type===`data`)&&{type:`data`,data:t.deserialize(e.result.data)})}}var pn=class extends Error{constructor(){super(`Unable to transform response from server`)}};function mn(e,t){let n;try{n=fn(e,t)}catch{throw new pn}if(!n.ok&&(!Bt(n.error.error)||typeof n.error.error.code!=`number`)||n.ok&&!Bt(n.result))throw new pn;return n}$t(un(),1);var hn=Ot(Mt(),1),gn=Ot(Nt(),1);function _n(e){return e instanceof bn}function vn(e){return Bt(e)&&Bt(e.error)&&typeof e.error.code==`number`&&typeof e.error.message==`string`}function yn(e,t){return typeof e==`string`?e:Bt(e)&&typeof e.message==`string`?e.message:t}var bn=class e extends Error{constructor(t,n){var r,i;let a=n?.cause;super(t,{cause:a}),(0,hn.default)(this,`cause`,void 0),(0,hn.default)(this,`shape`,void 0),(0,hn.default)(this,`data`,void 0),(0,hn.default)(this,`meta`,void 0),this.meta=n?.meta,this.cause=a,this.shape=n==null||(r=n.result)==null?void 0:r.error,this.data=n==null||(i=n.result)==null?void 0:i.error.data,this.name=`TRPCClientError`,Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){let r=t;return _n(r)?(n.meta&&(r.meta=(0,gn.default)((0,gn.default)({},r.meta),n.meta)),r):vn(r)?new e(r.error.message,(0,gn.default)((0,gn.default)({},n),{},{result:r,cause:n.cause})):new e(yn(r,`Unknown error`),(0,gn.default)((0,gn.default)({},n),{},{cause:r}))}};function xn(e){let t=e;return t?`input`in t?t:{input:t,output:t}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}var Sn=e=>typeof e==`function`;function Cn(e){if(e)return e;if(typeof window<`u`&&Sn(window.fetch))return window.fetch;if(typeof globalThis<`u`&&Sn(globalThis.fetch))return globalThis.fetch;throw Error(`No fetch implementation found`)}var wn=Ot(Nt());function Tn(e){return{url:e.url.toString(),fetch:e.fetch,transformer:xn(e.transformer),methodOverride:e.methodOverride}}function En(e){let t={};for(let n=0;n<e.length;n++)t[n]=e[n];return t}var Dn={query:`GET`,mutation:`POST`,subscription:`PATCH`};function On(e){return`input`in e?e.transformer.input.serialize(e.input):En(e.inputs.map(t=>e.transformer.input.serialize(t)))}var kn=e=>{let t=e.url.split(`?`),n=t[0].replace(/\/$/,``)+`/`+e.path,r=[];if(t[1]&&r.push(t[1]),`inputs`in e&&r.push(`batch=1`),e.type===`query`||e.type===`subscription`){let t=On(e);t!==void 0&&e.methodOverride!==`POST`&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(n+=`?`+r.join(`&`)),n},An=e=>{if(e.type===`query`&&e.methodOverride!==`POST`)return;let t=On(e);return t===void 0?void 0:JSON.stringify(t)},jn=e=>Fn((0,wn.default)((0,wn.default)({},e),{},{contentTypeHeader:`application/json`,getUrl:kn,getBody:An})),Mn=class extends Error{constructor(){let e=`AbortError`;super(e),this.name=e,this.message=e}},Nn=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<`u`?new DOMException(`AbortError`,`AbortError`):new Mn};async function Pn(e){Nn(e.signal);let t=e.getUrl(e),n=e.getBody(e),r=e.methodOverride??Dn[e.type],i=await(async()=>{let t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),a=(0,wn.default)((0,wn.default)((0,wn.default)({},e.contentTypeHeader&&r!==`GET`?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[e.trpcAcceptHeaderKey??`trpc-accept`]:e.trpcAcceptHeader}:void 0),i);return Cn(e.fetch)(t,{method:r,signal:e.signal,body:n,headers:a})}async function Fn(e){let t={},n=await Pn(e);t.response=n;let r=await n.json();return t.responseJSON=r,{json:r,meta:t}}Ot(Nt(),1);var In=()=>{throw Error(`Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new`)};function Ln(e){let t=null,n=null,r=()=>{clearTimeout(n),n=null,t=null};function i(t){let n=[[]],r=0;for(;;){let o=t[r];if(!o)break;let s=n[n.length-1];if(o.aborted){var i;(i=o.reject)==null||i.call(o,Error(`Aborted`)),r++;continue}if(e.validate(s.concat(o).map(e=>e.key))){s.push(o),r++;continue}if(s.length===0){var a;(a=o.reject)==null||a.call(o,Error(`Input is too big for a single dispatch`)),r++;continue}n.push([])}return n}function a(){let n=i(t);r();for(let t of n){if(!t.length)continue;let n={items:t};for(let e of t)e.batch=n;e.fetch(n.items.map(e=>e.key)).then(async e=>{await Promise.all(e.map(async(e,t)=>{let r=n.items[t];try{var i;let t=await Promise.resolve(e);(i=r.resolve)==null||i.call(r,t)}catch(e){var a;(a=r.reject)==null||a.call(r,e)}r.batch=null,r.reject=null,r.resolve=null}));for(let e of n.items){var t;(t=e.reject)==null||t.call(e,Error(`Missing result`)),e.batch=null}}).catch(e=>{for(let r of n.items){var t;(t=r.reject)==null||t.call(r,e),r.batch=null}})}}function o(e){let r={aborted:!1,key:e,batch:null,resolve:In,reject:In},i=new Promise((e,n)=>{r.reject=n,r.resolve=e,t??=[],t.push(r)});return n??=setTimeout(a),i}return{load:o}}function Rn(...e){let t=new AbortController,n=e.length,r=0,i=()=>{++r===n&&t.abort()};for(let t of e)t?.aborted?i():t?.addEventListener(`abort`,i,{once:!0});return t.signal}var zn=Ot(Nt(),1);function Bn(e){let t=Tn(e),n=e.maxURLLength??1/0,r=e.maxItems??1/0;return()=>{let i=i=>({validate(e){if(n===1/0&&r===1/0)return!0;if(e.length>r)return!1;let a=e.map(e=>e.path).join(`,`),o=e.map(e=>e.input);return kn((0,zn.default)((0,zn.default)({},t),{},{type:i,path:a,inputs:o,signal:null})).length<=n},async fetch(n){let r=n.map(e=>e.path).join(`,`),a=n.map(e=>e.input),o=Rn(...n.map(e=>e.signal)),s=await jn((0,zn.default)((0,zn.default)({},t),{},{path:r,inputs:a,type:i,headers(){return e.headers?typeof e.headers==`function`?e.headers({opList:n}):e.headers:{}},signal:o}));return(Array.isArray(s.json)?s.json:n.map(()=>s.json)).map(e=>({meta:s.meta,json:e}))}}),a={query:Ln(i(`query`)),mutation:Ln(i(`mutation`))};return({op:e})=>Pt(n=>{if(e.type===`subscription`)throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let r=a[e.type].load(e),i;return r.then(e=>{i=e;let r=mn(e.json,t.transformer.output);if(!r.ok){n.error(bn.from(r.error,{meta:e.meta}));return}n.next({context:e.meta,result:r.result}),n.complete()}).catch(e=>{n.error(bn.from(e,{meta:i?.meta}))}),()=>{}})}}Ot(Nt(),1);var Vn=(e,...t)=>typeof e==`function`?e(...t):e;Ot(Mt(),1);function Hn(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Un(e){let t=await Vn(e.url);return e.connectionParams?t+`${t.includes(`?`)?`&`:`?`}connectionParams=1`:t}async function Wn(e,t){let n={method:`connectionParams`,data:await Vn(e)};return t.encode(n)}Ot(Mt(),1);var Gn=Ot(Mt(),1);function Kn(e){let{promise:t,resolve:n,reject:r}=Hn();return e.addEventListener(`open`,()=>{e.removeEventListener(`error`,r),n()}),e.addEventListener(`error`,r),t}function qn(e,{intervalMs:t,pongTimeoutMs:n}){let r,i;function a(){r=setTimeout(()=>{e.send(`PING`),i=setTimeout(()=>{e.close()},n)},t)}function o(){clearTimeout(r),a()}function s(){clearTimeout(i),o()}e.addEventListener(`open`,a),e.addEventListener(`message`,({data:e})=>{clearTimeout(r),a(),e===`PONG`&&s()}),e.addEventListener(`close`,()=>{clearTimeout(r),clearTimeout(i)})}var Jn=class e{constructor(t){if((0,Gn.default)(this,`id`,++e.connectCount),(0,Gn.default)(this,`WebSocketPonyfill`,void 0),(0,Gn.default)(this,`urlOptions`,void 0),(0,Gn.default)(this,`keepAliveOpts`,void 0),(0,Gn.default)(this,`encoder`,void 0),(0,Gn.default)(this,`wsObservable`,Rt(null)),(0,Gn.default)(this,`openPromise`,null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++e.connectCount,t.openPromise=Un(t.urlOptions).then(e=>new t.WebSocketPonyfill(e)).then(async e=>{t.ws=e,e.binaryType=`arraybuffer`,e.addEventListener(`message`,function({data:e}){e===`PING`&&this.send(`PONG`)}),t.keepAliveOpts.enabled&&qn(e,t.keepAliveOpts),e.addEventListener(`close`,()=>{t.ws===e&&(t.ws=null)}),await Kn(e),t.urlOptions.connectionParams&&e.send(await Wn(t.urlOptions.connectionParams,t.encoder))});try{await t.openPromise}finally{t.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var t;(t=e.ws)==null||t.close()}}};(0,Gn.default)(Jn,`connectCount`,0),Ot(Mt(),1),Ot(Nt(),1);var Yn=Ot(Mt(),1),Xn=Ot(Nt(),1),Zn=class{constructor(e){(0,Yn.default)(this,`links`,void 0),(0,Yn.default)(this,`runtime`,void 0),(0,Yn.default)(this,`requestId`,void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){return zt({links:this.links,op:(0,Xn.default)((0,Xn.default)({},e),{},{context:e.context??{},id:++this.requestId})}).pipe(Lt())}async requestAsPromise(e){var t=this;try{return(await It(t.$request(e))).result.data}catch(e){throw bn.from(e)}}query(e,t,n){return this.requestAsPromise({type:`query`,path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:`mutation`,path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:`subscription`,path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case`state`:var t;(t=n.onConnectionStateChange)==null||t.call(n,e.result);break;case`started`:var r;(r=n.onStarted)==null||r.call(n,{context:e.context});break;case`stopped`:var i;(i=n.onStopped)==null||i.call(n);break;case`data`:case void 0:var a;(a=n.onData)==null||a.call(n,e.result.data);break}},error(e){var t;(t=n.onError)==null||t.call(n,e)},complete(){var e;(e=n.onComplete)==null||e.call(n)}})}},Qn=Symbol.for(`trpc_untypedClient`),$n={query:`query`,mutate:`mutation`,subscribe:`subscription`},er=e=>$n[e];function tr(e){let t=rn(({path:t,args:n})=>{let r=[...t],i=er(r.pop()),a=r.join(`.`);return e[i](a,...n)});return an(n=>n===Qn?e:t[n])}function nr(e){return tr(new Zn(e))}function rr(e){return e[Qn]}Ot(Nt(),1),Ot(Nt(),1),Ot(Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){var t,n,i,a=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,i=Symbol.iterator);a--;){if(n&&(t=e[n])!=null)return t.call(e);if(i&&(t=e[i])!=null)return new r(t.call(e));n=`@@asyncIterator`,i=`@@iterator`}throw TypeError(`Object is not async iterable`)}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new r(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),Ot(Nt(),1);var ir=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function n(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),ar=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function n(e,t){this.v=e,this.k=t}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),or=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=ar();function r(e){return new n(e,0)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),sr=Et({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=ar();function r(e){return function(){return new i(e.apply(this,arguments))}}function i(e){var t,r;function i(t,r){try{var o=e[t](r),s=o.value,c=s instanceof n;Promise.resolve(c?s.v:s).then(function(n){if(c){var r=t===`return`?`return`:`next`;if(!s.k||n.done)return i(r,n);n=e[r](n).value}a(o.done?`return`:`normal`,n)},function(e){i(`throw`,e)})}catch(e){a(`throw`,e)}}function a(e,n){switch(e){case`return`:t.resolve({value:n,done:!0});break;case`throw`:t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?i(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise(function(a,o){var s={key:e,arg:n,resolve:a,reject:o,next:null};r?r=r.next=s:(t=r=s,i(e,n))})},typeof e.return!=`function`&&(this.return=void 0)}i.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},i.prototype.next=function(e){return this._invoke(`next`,e)},i.prototype.throw=function(e){return this._invoke(`throw`,e)},i.prototype.return=function(e){return this._invoke(`return`,e)},t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}});Ot(ir(),1),Ot(or(),1),Ot(sr(),1),Ot(Nt(),1);var cr=o((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&&j(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&&j(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 j(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,j(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}}}})),lr=o(((e,t)=>{t.exports=cr()})),ur=o((e=>{var t=Ue();function n(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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),dr=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ur()})),fr=o((e=>{var t=lr(),n=Ue(),r=dr();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(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 c(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 l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var M=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ee=[],te=-1;function ne(e){return{current:e}}function I(e){0>te||(e.current=ee[te],ee[te]=null,te--)}function re(e,t){te++,ee[te]=e.current,e.current=t}var ie=ne(null),ae=ne(null),oe=ne(null),se=ne(null);function ce(e,t){switch(re(oe,t),re(ae,e),re(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Xd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Xd(t),e=G(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}I(ie),re(ie,e)}function le(){I(ie),I(ae),I(oe)}function ue(e){e.memoizedState!==null&&re(se,e);var t=ie.current,n=G(t,e.type);t!==n&&(re(ae,e),re(ie,n))}function de(e){ae.current===e&&(I(ie),I(ae)),se.current===e&&(I(se),op._currentValue=F)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!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}e.call(n.prototype)}}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(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{he=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?me(n):``}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return me(e.type);case 16:return me(`Lazy`);case 13:return e.child!==t&&t!==null?me(`Suspense Fallback`):me(`Suspense`);case 19:return me(`SuspenseList`);case 0:case 15:return ge(e.type,!1);case 11:return ge(e.type.render,!1);case 1:return ge(e.type,!0);case 31:return me(`Activity`);default:return``}}function ve(e){try{var t=``,n=null;do t+=_e(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var ye=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,xe=t.unstable_cancelCallback,Se=t.unstable_shouldYield,Ce=t.unstable_requestPaint,we=t.unstable_now,Te=t.unstable_getCurrentPriorityLevel,Ee=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,Oe=t.unstable_NormalPriority,ke=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,je=t.log,Me=t.unstable_setDisableYieldValue,Ne=null,Pe=null;function Fe(e){if(typeof je==`function`&&Me(e),Pe&&typeof Pe.setStrictMode==`function`)try{Pe.setStrictMode(Ne,e)}catch{}}var Ie=Math.clz32?Math.clz32:ze,Le=Math.log,Re=Math.LN2;function ze(e){return e>>>=0,e===0?32:31-(Le(e)/Re|0)|0}var Be=256,Ve=262144,He=4194304;function We(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ge(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=We(n))):i=We(o):i=We(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=We(n))):i=We(o)):i=We(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function L(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function R(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=He;return He<<=1,!(He&62914560)&&(He=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ie(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ie(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ie(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=P.p;return e===0?(e=window.event,e===void 0?32:xp(e.type)):e}function nt(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yf(e);e!==null;){if(n=e[it])return n;e=yf(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function _t(e){e[dt]=!0}var vt=new Set,yt={};function bt(e,t){xt(e,t),xt(e+`Capture`,t)}function xt(e,t){for(yt[e]=t,e=0;e<t.length;e++)vt.add(t[e])}var St=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Ct={},wt={};function Tt(e){return ye.call(wt,e)?!0:ye.call(Ct,e)?!1:St.test(e)?wt[e]=!0:(Ct[e]=!0,!1)}function Et(e,t,n){if(Tt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Dt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Ot(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mt(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Nt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Pt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ft=/[\n"\\]/g;function It(e){return e.replace(Ft,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Lt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):zt(e,o,kt(n)):zt(e,o,kt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+kt(s):e.removeAttribute(`name`)}function Rt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Mt(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Mt(e)}function zt(e,t,n){t===`number`&&Pt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Bt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Vt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Ht(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(M(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Mt(e)}function Ut(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Gt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Wt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Kt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Gt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Gt(e,o,t[o])}function qt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Jt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Yt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Xt(e){return Yt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Zt(){}var Qt=null;function $t(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var en=null,tn=null;function nn(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Lt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+It(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[at]||null;if(!a)throw Error(i(90));Lt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Nt(r)}break a;case`textarea`:Vt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Bt(e,!!n.multiple,t,!1)}}}var rn=!1;function an(e,t,n){if(rn)return e(t,n);rn=!0;try{return e(t)}finally{if(rn=!1,(en!==null||tn!==null)&&(Eu(),en&&(t=en,e=tn,tn=en=null,nn(t),e)))for(t=0;t<e.length;t++)nn(e[t])}}function on(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var sn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),cn=!1;if(sn)try{var ln={};Object.defineProperty(ln,"passive",{get:function(){cn=!0}}),window.addEventListener(`test`,ln,ln),window.removeEventListener(`test`,ln,ln)}catch{cn=!1}var un=null,dn=null,fn=null;function pn(){if(fn)return fn;var e,t=dn,n=t.length,r,i=`value`in un?un.value:un.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return fn=i.slice(e,1<r?1-r:void 0)}function mn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function hn(){return!0}function gn(){return!1}function _n(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?hn:gn,this.isPropagationStopped=gn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=hn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=hn)},persist:function(){},isPersistent:hn}),t}var vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yn=_n(vn),bn=f({},vn,{view:0,detail:0}),xn=_n(bn),Sn,Cn,wn,Tn=f({},bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:In,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==wn&&(wn&&e.type===`mousemove`?(Sn=e.screenX-wn.screenX,Cn=e.screenY-wn.screenY):Cn=Sn=0,wn=e),Sn)},movementY:function(e){return`movementY`in e?e.movementY:Cn}}),En=_n(Tn),Dn=_n(f({},Tn,{dataTransfer:0})),On=_n(f({},bn,{relatedTarget:0})),kn=_n(f({},vn,{animationName:0,elapsedTime:0,pseudoElement:0})),An=_n(f({},vn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),jn=_n(f({},vn,{data:0})),Mn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Nn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Pn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Fn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Pn[e])?!!t[e]:!1}function In(){return Fn}var Ln=_n(f({},bn,{key:function(e){if(e.key){var t=Mn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Nn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:In,charCode:function(e){return e.type===`keypress`?mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Rn=_n(f({},Tn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),zn=_n(f({},bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:In})),Bn=_n(f({},vn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Vn=_n(f({},Tn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Hn=_n(f({},vn,{newState:0,oldState:0})),Un=[9,13,27,32],Wn=sn&&`CompositionEvent`in window,Gn=null;sn&&`documentMode`in document&&(Gn=document.documentMode);var Kn=sn&&`TextEvent`in window&&!Gn,qn=sn&&(!Wn||Gn&&8<Gn&&11>=Gn),Jn=` `,Yn=!1;function Xn(e,t){switch(e){case`keyup`:return Un.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Zn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Qn=!1;function $n(e,t){switch(e){case`compositionend`:return Zn(t);case`keypress`:return t.which===32?(Yn=!0,Jn):null;case`textInput`:return e=t.data,e===Jn&&Yn?null:e;default:return null}}function er(e,t){if(Qn)return e===`compositionend`||!Wn&&Xn(e,t)?(e=pn(),fn=dn=un=null,Qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return qn&&t.locale!==`ko`?null:t.data;default:return null}}var tr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!tr[e.type]:t===`textarea`}function rr(e,t,n,r){en?tn?tn.push(r):tn=[r]:en=r,t=Pd(t,`onChange`),0<t.length&&(n=new yn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ir=null,ar=null;function or(e){Ed(e,0)}function sr(e){if(Nt(ht(e)))return e}function cr(e,t){if(e===`change`)return t}var ur=!1;if(sn){var fr;if(sn){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;ur=fr&&(!document.documentMode||9<document.documentMode)}function hr(){ir&&(ir.detachEvent(`onpropertychange`,gr),ar=ir=null)}function gr(e){if(e.propertyName===`value`&&sr(ar)){var t=[];rr(t,ar,e,$t(e)),an(or,t)}}function _r(e,t,n){e===`focusin`?(hr(),ir=t,ar=n,ir.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return sr(ar)}function yr(e,t){if(e===`click`)return sr(t)}function br(e,t){if(e===`input`||e===`change`)return sr(t)}function xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Sr=typeof Object.is==`function`?Object.is:xr;function Cr(e,t){if(Sr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ye.call(t,i)||!Sr(e[i],t[i]))return!1}return!0}function wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tr(e,t){var n=wr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pt(e.document)}return t}function Or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var kr=sn&&`documentMode`in document&&11>=document.documentMode,Ar=null,jr=null,Mr=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||Ar==null||Ar!==Pt(r)||(r=Ar,`selectionStart`in r&&Or(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mr&&Cr(Mr,r)||(Mr=r,r=Pd(jr,`onSelect`),0<r.length&&(t=new yn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ar)))}function Fr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ir={animationend:Fr(`Animation`,`AnimationEnd`),animationiteration:Fr(`Animation`,`AnimationIteration`),animationstart:Fr(`Animation`,`AnimationStart`),transitionrun:Fr(`Transition`,`TransitionRun`),transitionstart:Fr(`Transition`,`TransitionStart`),transitioncancel:Fr(`Transition`,`TransitionCancel`),transitionend:Fr(`Transition`,`TransitionEnd`)},Lr={},Rr={};sn&&(Rr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),`TransitionEvent`in window||delete Ir.transitionend.transition);function zr(e){if(Lr[e])return Lr[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return Lr[e]=t[n];return e}var Br=zr(`animationend`),Vr=zr(`animationiteration`),Hr=zr(`animationstart`),Ur=zr(`transitionrun`),Wr=zr(`transitionstart`),Gr=zr(`transitioncancel`),Kr=zr(`transitionend`),qr=new Map,Jr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Jr.push(`scrollEnd`);function Yr(e,t){qr.set(e,t),bt(t,[e])}var Xr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},z=[],Zr=0,Qr=0;function $r(){for(var e=Zr,t=Qr=Zr=0;t<e;){var n=z[t];z[t++]=null;var r=z[t];z[t++]=null;var i=z[t];z[t++]=null;var a=z[t];if(z[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&V(n,i,a)}}function ei(e,t,n,r){z[Zr++]=e,z[Zr++]=t,z[Zr++]=n,z[Zr++]=r,Qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function B(e,t,n,r){return ei(e,t,n,r),ni(e)}function ti(e,t){return ei(e,null,null,t),ni(e)}function V(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ie(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ni(e){if(50<_u)throw _u=0,vu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ri={};function ii(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ai(e,t,n,r){return new ii(e,t,n,r)}function oi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function si(e,t){var n=e.alternate;return n===null?(n=ai(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ci(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function li(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)oi(e)&&(s=1);else if(typeof e==`string`)s=Zf(e,n,ie.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case E:return e=ai(31,n,t,a),e.elementType=E,e.lanes=o,e;case g:return ui(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=ai(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=ai(13,n,t,a),e.elementType=S,e.lanes=o,e;case C:return e=ai(19,n,t,a),e.elementType=C,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case w:s=14;break a;case T:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ai(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ui(e,t,n,r){return e=ai(7,e,r,t),e.lanes=n,e}function di(e,t,n){return e=ai(6,e,null,t),e.lanes=n,e}function fi(e){var t=ai(18,null,null,0);return t.stateNode=e,t}function pi(e,t,n){return t=ai(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var mi=new WeakMap;function hi(e,t){if(typeof e==`object`&&e){var n=mi.get(e);return n===void 0?(t={value:e,source:t,stack:ve(t)},mi.set(e,t),t):n}return{value:e,source:t,stack:ve(t)}}var gi=[],_i=0,vi=null,yi=0,bi=[],xi=0,Si=null,Ci=1,wi=``;function Ti(e,t){gi[_i++]=yi,gi[_i++]=vi,vi=e,yi=t}function H(e,t,n){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Si=e;var r=Ci;e=wi;var i=32-Ie(r)-1;r&=~(1<<i),n+=1;var a=32-Ie(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ci=1<<32-Ie(t)+i|n<<i|r,wi=a+e}else Ci=1<<a|n<<i|r,wi=e}function Ei(e){e.return!==null&&(Ti(e,1),H(e,1,0))}function Di(e){for(;e===vi;)vi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null;for(;e===Si;)Si=bi[--xi],bi[xi]=null,wi=bi[--xi],bi[xi]=null,Ci=bi[--xi],bi[xi]=null}function Oi(e,t){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Ci=t.id,wi=t.overflow,Si=e}var ki=null,Ai=null,ji=!1,Mi=null,Ni=!1,Pi=Error(i(519));function Fi(e){throw Vi(hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Pi}function Ii(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:Dd(`cancel`,t),Dd(`close`,t);break;case`iframe`:case`object`:case`embed`:Dd(`load`,t);break;case`video`:case`audio`:for(n=0;n<wd.length;n++)Dd(wd[n],t);break;case`source`:Dd(`error`,t);break;case`img`:case`image`:case`link`:Dd(`error`,t),Dd(`load`,t);break;case`details`:Dd(`toggle`,t);break;case`input`:Dd(`invalid`,t),Rt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Dd(`invalid`,t);break;case`textarea`:Dd(`invalid`,t),Ht(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Bd(t.textContent,n)?(r.popover!=null&&(Dd(`beforetoggle`,t),Dd(`toggle`,t)),r.onScroll!=null&&Dd(`scroll`,t),r.onScrollEnd!=null&&Dd(`scrollend`,t),r.onClick!=null&&(t.onclick=Zt),t=!0):t=!1,t||Fi(e,!0)}function Li(e){for(ki=e.return;ki;)switch(ki.tag){case 5:case 31:case 13:Ni=!1;return;case 27:case 3:Ni=!0;return;default:ki=ki.return}}function Ri(e){if(e!==ki)return!1;if(!ji)return Li(e),ji=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Zd(e.type,e.memoizedProps)),n=!n),n&&Ai&&Fi(e),Li(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ai=vf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ai=vf(e)}else t===27?(t=Ai,of(e.type)?(e=_f,_f=null,Ai=e):Ai=t):Ai=ki?gf(e.stateNode.nextSibling):null;return!0}function zi(){Ai=ki=null,ji=!1}function Bi(){var e=Mi;return e!==null&&(ru===null?ru=e:ru.push.apply(ru,e),Mi=null),e}function Vi(e){Mi===null?Mi=[e]:Mi.push(e)}var Hi=ne(null),Ui=null,Wi=null;function Gi(e,t,n){re(Hi,t._currentValue),t._currentValue=n}function Ki(e){e._currentValue=Hi.current,I(Hi)}function qi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ji(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),qi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),qi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Yi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Sr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===se.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[op]:e.push(op))}a=a.return}e!==null&&Ji(t,e,n,r),t.flags|=262144}function Xi(e){for(e=e.firstContext;e!==null;){if(!Sr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zi(e){Ui=e,Wi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Qi(e){return ea(Ui,e)}function $i(e,t){return Ui===null&&Zi(e),ea(e,t)}function ea(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Wi===null){if(e===null)throw Error(i(308));Wi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wi=Wi.next=t;return n}var ta=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},na=t.unstable_scheduleCallback,ra=t.unstable_NormalPriority,ia={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function aa(){return{controller:new ta,data:new Map,refCount:0}}function oa(e){e.refCount--,e.refCount===0&&na(ra,function(){e.controller.abort()})}var sa=null,ca=0,la=0,ua=null;function da(e,t){if(sa===null){var n=sa=[];ca=0,la=vd(),ua={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ca++,t.then(fa,fa),t}function fa(){if(--ca===0&&sa!==null){ua!==null&&(ua.status=`fulfilled`);var e=sa;sa=null,la=0,ua=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ma=N.S;N.S=function(e,t){ou=we(),typeof t==`object`&&t&&typeof t.then==`function`&&da(e,t),ma!==null&&ma(e,t)};var ha=ne(null);function ga(){var e=ha.current;return e===null?Hl.pooledCache:e}function _a(e,t){t===null?re(ha,ha.current):re(ha,t.pool)}function va(){var e=ga();return e===null?null:{parent:ia._currentValue,pool:e}}var ya=Error(i(460)),ba=Error(i(474)),xa=Error(i(542)),Sa={then:function(){}};function Ca(e){return e=e.status,e===`fulfilled`||e===`rejected`}function wa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Zt,Zt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Oa(e),e;default:if(typeof t.status==`string`)t.then(Zt,Zt);else{if(e=Hl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Oa(e),e}throw Ea=t,ya}}function Ta(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ea=e,ya):e}}var Ea=null;function Da(){if(Ea===null)throw Error(i(459));var e=Ea;return Ea=null,e}function Oa(e){if(e===ya||e===xa)throw Error(i(483))}var ka=null,Aa=0;function ja(e){var t=Aa;return Aa+=1,ka===null&&(ka=[]),wa(ka,e,t)}function Ma(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Na(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Pa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=si(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=di(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===T&&Ta(i)===t.type)?(t=a(t,n.props),Ma(t,n),t.return=e,t):(t=li(n.type,n.key,n.props,null,e.mode,r),Ma(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ui(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=li(t.type,t.key,t.props,null,e.mode,n),Ma(n,t),n.return=e,n;case h:return t=pi(t,e.mode,n),t.return=e,t;case T:return t=Ta(t),f(e,t,n)}if(M(t)||k(t))return t=ui(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ja(t),n);if(t.$$typeof===b)return f(e,$i(e,t),n);Na(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case T:return n=Ta(n),p(e,t,n,r)}if(M(n)||k(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ja(n),r);if(n.$$typeof===b)return p(e,t,$i(e,n),r);Na(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case T:return r=Ta(r),_(e,t,n,r,i)}if(M(r)||k(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,ja(r),i);if(r.$$typeof===b)return _(e,t,n,$i(t,r),i);Na(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),ji&&Ti(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return ji&&Ti(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),ji&&Ti(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),ji&&Ti(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return ji&&Ti(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),ji&&Ti(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&Ta(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ma(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),Ma(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=Ta(o),x(e,r,o,c)}if(M(o))return v(e,r,o,c);if(k(o)){if(l=k(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,ja(o),c);if(o.$$typeof===b)return x(e,r,$i(e,o),c);Na(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Aa=0;var i=x(e,t,n,r);return ka=null,i}catch(t){if(t===ya||t===xa)throw t;var a=ai(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Fa=Pa(!0),Ia=Pa(!1),La=!1;function Ra(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function za(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Vl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ni(e),V(e,null,n),t}return ei(e,r,t,n),ni(e)}function Ha(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}function Ua(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Wa=!1;function Ga(){if(Wa){var e=ua;if(e!==null)throw e}}function Ka(e,t,n,r){Wa=!1;var i=e.updateQueue;La=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Wl&p)===p:(r&p)===p){p!==0&&p===la&&(Wa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:La=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Zl|=o,e.lanes=o,e.memoizedState=d}}function qa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ja(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)qa(n[e],t)}var Ya=ne(null),Xa=ne(0);function Za(e,t){e=Yl,re(Xa,e),re(Ya,t),Yl=e|t.baseLanes}function Qa(){re(Xa,Yl),re(Ya,Ya.current)}function $a(){Yl=Xa.current,I(Ya),I(Xa)}var eo=ne(null),to=null;function no(e){var t=e.alternate;re(so,so.current&1),re(eo,e),to===null&&(t===null||Ya.current!==null||t.memoizedState!==null)&&(to=e)}function ro(e){re(so,so.current),re(eo,e),to===null&&(to=e)}function io(e){e.tag===22?(re(so,so.current),re(eo,e),to===null&&(to=e)):ao(e)}function ao(){re(so,so.current),re(eo,eo.current)}function oo(e){I(eo),to===e&&(to=null),I(so)}var so=ne(0);function co(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pf(n)||mf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var lo=0,uo=null,fo=null,po=null,mo=!1,ho=!1,go=!1,_o=0,vo=0,yo=null,bo=0;function xo(){throw Error(i(321))}function So(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function Co(e,t,n,r,i,a){return lo=a,uo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Bs:Vs,go=!1,a=n(r,i),go=!1,ho&&(a=To(t,n,r,i)),wo(e),a}function wo(e){N.H=zs;var t=fo!==null&&fo.next!==null;if(lo=0,po=fo=uo=null,mo=!1,vo=0,yo=null,t)throw Error(i(300));e===null||ic||(e=e.dependencies,e!==null&&Xi(e)&&(ic=!0))}function To(e,t,n,r){uo=e;var a=0;do{if(ho&&(yo=null),vo=0,ho=!1,25<=a)throw Error(i(301));if(a+=1,po=fo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Hs,o=t(n,r)}while(ho);return o}function Eo(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?No(t):t,e=e.useState()[0],(fo===null?null:fo.memoizedState)!==e&&(uo.flags|=1024),t}function Do(){var e=_o!==0;return _o=0,e}function Oo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ko(e){if(mo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}mo=!1}lo=0,po=fo=uo=null,ho=!1,vo=_o=0,yo=null}function Ao(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return po===null?uo.memoizedState=po=e:po=po.next=e,po}function jo(){if(fo===null){var e=uo.alternate;e=e===null?null:e.memoizedState}else e=fo.next;var t=po===null?uo.memoizedState:po.next;if(t!==null)po=t,fo=e;else{if(e===null)throw uo.alternate===null?Error(i(467)):Error(i(310));fo=e,e={memoizedState:fo.memoizedState,baseState:fo.baseState,baseQueue:fo.baseQueue,queue:fo.queue,next:null},po===null?uo.memoizedState=po=e:po=po.next=e}return po}function Mo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function No(e){var t=vo;return vo+=1,yo===null&&(yo=[]),e=wa(yo,e,t),t=uo,(po===null?t.memoizedState:po.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Bs:Vs),e}function Po(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return No(e);if(e.$$typeof===b)return Qi(e)}throw Error(i(438,String(e)))}function Fo(e){var t=null,n=uo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=uo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Mo(),uo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=D;return t.index++,n}function Io(e,t){return typeof t==`function`?t(e):t}function Lo(e){return Ro(jo(),fo,e)}function Ro(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(lo&f)===f:(Wl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===la&&(d=!0);else if((lo&p)===p){u=u.next,p===la&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,uo.lanes|=p,Zl|=p;f=u.action,go&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,uo.lanes|=f,Zl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Sr(o,e.memoizedState)&&(ic=!0,d&&(n=ua,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function zo(e){var t=jo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Sr(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Bo(e,t,n){var r=uo,a=jo(),o=ji;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Sr((fo||a).memoizedState,n);if(s&&(a.memoizedState=n,ic=!0),a=a.queue,ds(Uo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||po!==null&&po.memoizedState.tag&1){if(r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,a,n,t),null),Hl===null)throw Error(i(349));o||lo&127||Vo(r,t,n)}return n}function Vo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=uo.updateQueue,t===null?(t=Mo(),uo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ho(e,t,n,r){t.value=n,t.getSnapshot=r,Wo(t)&&Go(e)}function Uo(e,t,n){return n(function(){Wo(t)&&Go(e)})}function Wo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function Go(e){var t=ti(e,2);t!==null&&xu(t,e,2)}function Ko(e){var t=Ao();if(typeof e==`function`){var n=e;if(e=n(),go){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t}function qo(e,t,n,r){return e.baseState=n,Ro(e,fo,typeof r==`function`?r:Io)}function Jo(e,t,n,r,a){if(Is(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Yo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Yo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Xo(e,t,s)}catch(n){Qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Xo(e,t,a)}catch(n){Qo(e,t,n)}}function Xo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Zo(e,t,n)},function(n){return Qo(e,t,n)}):Zo(e,t,n)}function Zo(e,t,n){t.status=`fulfilled`,t.value=n,$o(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Yo(e,n)))}function Qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,$o(t),t=t.next;while(t!==r)}e.action=null}function $o(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function es(e,t){return t}function ts(e,t){if(ji){var n=Hl.formState;if(n!==null){a:{var r=uo;if(ji){if(Ai){b:{for(var i=Ai,a=Ni;i.nodeType!==8;){if(!a){i=null;break b}if(i=gf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ai=gf(i.nextSibling),r=i.data===`F!`;break a}}Fi(r)}r=!1}r&&(t=n[0])}}return n=Ao(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:t},n.queue=r,n=Ns.bind(null,uo,r),r.dispatch=n,r=Ko(!1),a=Fs.bind(null,uo,!1,r.queue),r=Ao(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Jo.bind(null,uo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ns(e){return rs(jo(),fo,e)}function rs(e,t,n){if(t=Ro(e,t,es)[0],e=Lo(Io)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=No(t)}catch(e){throw e===ya?xa:e}else r=t;t=jo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(uo.flags|=2048,os(9,{destroy:void 0},is.bind(null,i,n),null)),[r,a,e]}function is(e,t){e.action=t}function as(e){var t=jo(),n=fo;if(n!==null)return rs(t,n,e);jo(),t=t.memoizedState,n=jo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function os(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=uo.updateQueue,t===null&&(t=Mo(),uo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ss(){return jo().memoizedState}function cs(e,t,n,r){var i=Ao();uo.flags|=e,i.memoizedState=os(1|t,{destroy:void 0},n,r===void 0?null:r)}function ls(e,t,n,r){var i=jo();r=r===void 0?null:r;var a=i.memoizedState.inst;fo!==null&&r!==null&&So(r,fo.memoizedState.deps)?i.memoizedState=os(t,a,n,r):(uo.flags|=e,i.memoizedState=os(1|t,a,n,r))}function us(e,t){cs(8390656,8,e,t)}function ds(e,t){ls(2048,8,e,t)}function fs(e){uo.flags|=4;var t=uo.updateQueue;if(t===null)t=Mo(),uo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ps(e){var t=jo().memoizedState;return fs({ref:t,nextImpl:e}),function(){if(Vl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ms(e,t){return ls(4,2,e,t)}function hs(e,t){return ls(4,4,e,t)}function gs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _s(e,t,n){n=n==null?null:n.concat([e]),ls(4,4,gs.bind(null,t,e),n)}function vs(){}function ys(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&So(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&So(t,r[1]))return r[0];if(r=e(),go){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||lo&1073741824&&!(Wl&261930)?e.memoizedState=t:(e.memoizedState=n,e=bu(),uo.lanes|=e,Zl|=e,n)}function Ss(e,t,n,r){return Sr(n,t)?n:Ya.current===null?!(lo&42)||lo&1073741824&&!(Wl&261930)?(ic=!0,e.memoizedState=n):(e=bu(),uo.lanes|=e,Zl|=e,t):(e=xs(e,n,r),Sr(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,Fs(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,pa(c,r),yu(e)):Ps(e,t,r,yu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},yu())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,F,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:F},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},yu())}function Os(){return Qi(op)}function ks(){return jo().memoizedState}function As(){return jo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=yu();e=Ba(n);var r=Va(t,e,n);r!==null&&(xu(r,t,n),Ha(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=yu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=B(e,t,n,r),n!==null&&(xu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,yu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Sr(s,o))return ei(e,t,i,0),Hl===null&&$r(),!1}catch{}if(n=B(e,t,i,r),n!==null)return xu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=B(e,n,r,2),t!==null&&xu(t,e,2)}function Is(e){var t=e.alternate;return e===uo||t!==null&&t===uo}function Ls(e,t){ho=mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var zs={readContext:Qi,use:Po,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useLayoutEffect:xo,useInsertionEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useSyncExternalStore:xo,useId:xo,useHostTransitionStatus:xo,useFormState:xo,useActionState:xo,useOptimistic:xo,useMemoCache:xo,useCacheRefresh:xo};zs.useEffectEvent=xo;var Bs={readContext:Qi,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:Qi,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(go){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(go){Fe(!0);try{n(t)}finally{Fe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,uo,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,uo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,uo,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=uo,a=Ao();if(ji){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Hl===null)throw Error(i(349));Wl&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Hl.identifierPrefix;if(ji){var n=wi,r=Ci;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=_o++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=bo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:ts,useActionState:ts,useOptimistic:function(e){var t=Ao();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,uo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fo,useCacheRefresh:function(){return Ao().memoizedState=js.bind(null,uo)},useEffectEvent:function(e){var t=Ao(),n={impl:e};return t.memoizedState=n,function(){if(Vl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:Qi,use:Po,useCallback:ys,useContext:Qi,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Lo,useRef:ss,useState:function(){return Lo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){return Ss(jo(),fo.memoizedState,e,t)},useTransition:function(){var e=Lo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){return qo(jo(),fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Vs.useEffectEvent=ps;var Hs={readContext:Qi,use:Po,useCallback:ys,useContext:Qi,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:zo,useRef:ss,useState:function(){return zo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){var n=jo();return fo===null?xs(n,e,t):Ss(n,fo.memoizedState,e,t)},useTransition:function(){var e=zo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:as,useActionState:as,useOptimistic:function(e,t){var n=jo();return fo===null?(n.baseState=e,[e,n.queue.dispatch]):qo(n,fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Hs.useEffectEvent=ps;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ba(r);i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(xu(t,e,r),Ha(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ba(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(xu(t,e,r),Ha(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=yu(),r=Ba(n);r.tag=2,t!=null&&(r.callback=t),t=Va(e,r,n),t!==null&&(xu(t,e,n),Ha(t,e,n))}};function Gs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Cr(n,r)||!Cr(i,a):!0}function Ks(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ws.enqueueReplaceState(t,t.state,null)}function qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){Xr(e)}function Ys(e){console.error(e)}function Xs(e){Xr(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){return n=Ba(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=Ba(e),e.tag=3,e}function tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(lu===null?lu=new Set([this]):lu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Yi(t,n,a,!0),n=eo.current,n!==null){switch(n.tag){case 31:case 13:return to===null?Nu():n.alternate===null&&Xl===0&&(Xl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Sa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Qu(e,r,a)),!1;case 22:return n.flags|=65536,r===Sa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Qu(e,r,a)),!1}throw Error(i(435,n.tag))}return Qu(e,r,a),Nu(),!1}if(ji)return t=eo.current,t===null?(r!==Pi&&(t=Error(i(423),{cause:r}),Vi(hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=hi(r,n),a=$s(e.stateNode,r,a),Ua(e,a),Xl!==4&&(Xl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Pi&&(e=Error(i(422),{cause:r}),Vi(hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=hi(o,n),nu===null?nu=[o]:nu.push(o),Xl!==4&&(Xl=2),t===null)return!0;r=hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=$s(n.stateNode,r,e),Ua(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(lu===null||!lu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ec(a),tc(a,e,n,r),Ua(n,a),!1}n=n.return}while(n!==null);return!1}var rc=Error(i(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?Ia(t,null,n,r):Fa(t,e.child,n,r)}function oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Zi(t),r=Co(e,t,n,o,a,i),s=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(ji&&s&&Ei(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!oi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=li(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Cr:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=si(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Cr(a,r)&&e.ref===t.ref)if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}return gc(e,t,n,r,i)}function lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&_a(t,a===null?null:a.cachePool),a===null?Qa():Za(t,a),io(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&_a(t,null),Qa(),ao(t)):(_a(t,a.cachePool),Za(t,a),ao(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=ga();return a=a===null?null:{parent:ia._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&_a(t,null),Qa(),io(t),e!==null&&Yi(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return Fa(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,oo(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(ji){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(ro(t),(e=Ai)?(e=ff(e,Ni),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Fi(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ro(t),a)if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ic||Yi(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Hl,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ti(e,s),xu(r,e,s),rc;Nu(),t=pc(e,t,n)}else e=o.treeContext,Ai=gf(s.nextSibling),ki=t,ji=!0,Mi=null,Ni=!1,e!==null&&Oi(t,e),t=fc(t,r),t.flags|=4096;return t}return e=si(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gc(e,t,n,r,i){return Zi(t),n=Co(e,t,n,r,void 0,i),r=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(ji&&r&&Ei(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return Zi(t),t.updateQueue=null,n=To(t,r,n,i),wo(e),r=Do(),e!==null&&!ic?(Oo(e,t,a),Ac(e,t,a)):(ji&&r&&Ei(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if(Zi(t),t.stateNode===null){var a=ri,o=n.contextType;typeof o==`object`&&o&&(a=Qi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ra(t),o=n.contextType,a.context=typeof o==`object`&&o?Qi(o):ri,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ws.enqueueReplaceState(a,a.state,null),Ka(t,r,a,i),Ga(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ri,typeof u==`object`&&u&&(o=Qi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ks(t,a,r,o),La=!1;var f=t.memoizedState;a.state=f,Ka(t,r,a,i),Ga(),l=t.memoizedState,s||f!==l||La?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=La||Gs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,za(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ri,typeof l==`object`&&l&&(c=Qi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ks(t,a,r,c),La=!1,f=t.memoizedState,a.state=f,Ka(t,r,a,i),Ga();var p=t.memoizedState;o!==d||f!==p||La||e!==null&&e.dependencies!==null&&Xi(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=La||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Xi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,hc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Fa(t,e.child,null,i),t.child=Fa(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return zi(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:va()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=eu),e}function Cc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(so.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(ji){if(a?no(t):ao(t),(e=Ai)?(e=ff(e,Ni),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Fi(t);return mf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(ao(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=ui(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(no(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(no(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(ao(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=ui(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Fa(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(ao(t),t.child=e.child,t.flags|=128,t=null);else if(no(t),mf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Vi({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Yi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Hl,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ti(e,r),xu(s,e,r),rc;pf(c)||Nu(),t=Ec(e,t,n)}else pf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ai=gf(c.nextSibling),ki=t,ji=!0,Mi=null,Ni=!1,e!==null&&Oi(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(ao(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=si(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ui(c,a,n,null),c.flags|=2):c=si(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(a=c.cachePool,a===null?a=va():(l=ia._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(no(t),n=e.child,e=n.sibling,n=si(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=ai(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return Fa(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qi(e.return,t,n)}function Oc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=so.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,re(so,o),ac(e,t,r,n),r=ji?yi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Zl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Yi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=si(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=si(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Xi(e))):!0}function Mc(e,t,n){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Gi(t,ia,e.memoizedState.cache),zi();break;case 27:case 5:ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Gi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ro(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(no(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(no(t),t.flags|=128,null);no(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Yi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),re(so,so.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:Gi(t,ia,e.memoizedState.cache)}return Ac(e,t,n)}function Nc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,Mc(e,t,n);ic=!!(e.flags&131072)}else ic=!1,ji&&t.flags&1048576&&H(t,yi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ta(t.elementType),t.type=e,typeof e==`function`)oi(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=oc(null,t,e,r,n);break a}else if(a===w){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=j(e)||e,Error(i(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=qs(r,t.pendingProps),vc(e,t,r,a,n);case 3:a:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,za(e,t),Ka(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Gi(t,ia,r),r!==o.cache&&Ji(t,[ia],n,!0),Ga(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=yc(e,t,r,n);break a}else if(r!==a){a=hi(Error(i(424)),t),Vi(a),t=yc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ai=gf(e.firstChild),ki=t,ji=!0,Mi=null,Ni=!0,n=Ia(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(zi(),r===a){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=Lf(t.type,null,t.pendingProps,null))?t.memoizedState=n:ji||(n=t.type,e=t.pendingProps,r=Yd(oe.current).createElement(n),r[it]=t,r[at]=e,Ud(r,n,e),_t(r),t.stateNode=r):t.memoizedState=Lf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&ji&&(r=t.stateNode=bf(t.type,t.pendingProps,oe.current),ki=t,Ni=!0,a=Ai,of(t.type)?(_f=a,Ai=gf(r.firstChild)):Ai=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ji&&((a=r=Ai)&&(r=uf(r,t.type,t.pendingProps,Ni),r===null?a=!1:(t.stateNode=r,ki=t,Ai=gf(r.firstChild),Ni=!1,a=!0)),a||Fi(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Zd(a,o)?r=null:s!==null&&Zd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Co(e,t,Eo,null,null,n),op._currentValue=a),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&ji&&((e=n=Ai)&&(n=df(n,t.pendingProps,Ni),n===null?e=!1:(t.stateNode=n,ki=t,Ai=null,e=!0)),e||Fi(t)),null;case 13:return Cc(e,t,n);case 4:return ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fa(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Gi(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Zi(t),a=Qi(a),r=r(a),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return Zi(t),r=Qi(ia),e===null?(a=ga(),a===null&&(a=Hl,o=aa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ra(t),Gi(t,ia,a)):((e.lanes&n)!==0&&(za(e,t),Ka(t,null,null,n),Ga()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Gi(t,ia,r),r!==a.cache&&Ji(t,[ia],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Gi(t,ia,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Pc(e){e.flags|=4}function Fc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Au())e.flags|=8192;else throw Ea=Sa,ba}else e.flags&=-16777217}function Ic(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qf(t))if(Au())e.flags|=8192;else throw Ea=Sa,ba}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,tu|=t)}function Rc(e,t){if(!ji)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Bc(e,t,n){var r=t.pendingProps;switch(Di(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zc(t),null;case 1:return zc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ki(ia),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ri(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Bi())),zc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Pc(t),o===null?(zc(t),Fc(t,a,null,r,n)):(zc(t),Ic(t,o))):o?o===e.memoizedState?(zc(t),t.flags&=-16777217):(Pc(t),zc(t),Ic(t,o)):(e=e.memoizedProps,e!==r&&Pc(t),zc(t),Fc(t,a,e,r,n)),null;case 27:if(de(t),n=oe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}e=ie.current,Ri(t)?Ii(t,e):(e=bf(a,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}if(o=ie.current,Ri(t))Ii(t,o);else{var s=Yd(oe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ud(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=oe.current,Ri(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Bd(e.nodeValue,n)),e||Fi(t,!0)}else e=Yd(e).createTextNode(r),e[it]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ri(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[it]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(oo(t),t):(oo(t),null);if(t.flags&128)throw Error(i(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ri(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[it]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(oo(t),t):(oo(t),null)}return oo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),zc(t),null);case 4:return le(),e===null&&Ad(t.stateNode.containerInfo),zc(t),null;case 10:return Ki(t.type),zc(t),null;case 19:if(I(so),r=t.memoizedState,r===null)return zc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Rc(r,!1);else{if(Xl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=co(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return re(so,so.current&1|2),ji&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>su&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}else{if(!a)if(e=co(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ji)return zc(t),null}else 2*we()-r.renderingStartTime>su&&n!==536870912&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=so.current,re(so,a?n&1|2:n&1),ji&&Ti(t,r.treeForkCount),e);case 22:case 23:return oo(t),$a(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&I(ha),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ki(ia),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ki(ia),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(oo(t),t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(oo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return I(so),null;case 4:return le(),null;case 10:return Ki(t.type),null;case 22:case 23:return oo(t),$a(),e!==null&&I(ha),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ki(ia),null;case 25:return null;default:return null}}function Hc(e,t){switch(Di(t),t.tag){case 3:Ki(ia),le();break;case 26:case 27:case 5:de(t);break;case 4:le();break;case 31:t.memoizedState!==null&&oo(t);break;case 13:oo(t);break;case 19:I(so);break;case 10:Ki(t.type);break;case 22:case 23:oo(t),$a(),e!==null&&I(ha);break;case 24:Ki(ia)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Zu(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Zu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Zu(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ja(t,n)}catch(t){Zu(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Zu(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Zu(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Zu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Zu(e,t,n)}else n.current=null}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Zu(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Wd(r,e.type,n,t),r[at]=t}catch(t){Zu(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&of(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zt));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ud(t,r,n),t[it]=e,t[at]=n}catch(t){Zu(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,qd=mp,e=Dr(e),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Jd={focusedElem:e,selectionRange:n},mp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=qs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Zu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:lf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ol=e;break}ol=t.return}}function cl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Cl(e,n),r&4&&Uc(5,n);break;case 1:if(Cl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Zu(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Zu(n,n.return,e)}}r&64&&Gc(n),r&512&&qc(n,n.return);break;case 3:if(Cl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ja(e,t)}catch(e){Zu(n,n.return,e)}}break;case 27:t===null&&r&4&&tl(n);case 26:case 5:Cl(e,n),t===null&&r&4&&Yc(n),r&512&&qc(n,n.return);break;case 12:Cl(e,n);break;case 31:Cl(e,n),r&4&&ml(e,n);break;case 13:Cl(e,n),r&4&&hl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=td.bind(null,n),hf(e,n))));break;case 22:if(r=n.memoizedState!==null||nl,!r){t=t!==null&&t.memoizedState!==null||rl,i=nl;var a=rl;nl=r,(rl=t)&&!a?Tl(e,n,(n.subtreeFlags&8772)!=0):Cl(e,n),nl=i,rl=a}break;case 30:break;default:Cl(e,n)}}function ll(e){var t=e.alternate;t!==null&&(e.alternate=null,ll(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ul=null,dl=!1;function fl(e,t,n){for(n=n.child;n!==null;)pl(e,t,n),n=n.sibling}function pl(e,t,n){if(Pe&&typeof Pe.onCommitFiberUnmount==`function`)try{Pe.onCommitFiberUnmount(Ne,n)}catch{}switch(n.tag){case 26:rl||Jc(n,t),fl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rl||Jc(n,t);var r=ul,i=dl;of(n.type)&&(ul=n.stateNode,dl=!1),fl(e,t,n),xf(n.stateNode),ul=r,dl=i;break;case 5:rl||Jc(n,t);case 6:if(r=ul,i=dl,ul=null,fl(e,t,n),ul=r,dl=i,ul!==null)if(dl)try{(ul.nodeType===9?ul.body:ul.nodeName===`HTML`?ul.ownerDocument.body:ul).removeChild(n.stateNode)}catch(e){Zu(n,t,e)}else try{ul.removeChild(n.stateNode)}catch(e){Zu(n,t,e)}break;case 18:ul!==null&&(dl?(e=ul,sf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Bp(e)):sf(ul,n.stateNode));break;case 4:r=ul,i=dl,ul=n.stateNode.containerInfo,dl=!0,fl(e,t,n),ul=r,dl=i;break;case 0:case 11:case 14:case 15:Wc(2,n,t),rl||Wc(4,n,t),fl(e,t,n);break;case 1:rl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Kc(n,t,r)),fl(e,t,n);break;case 21:fl(e,t,n);break;case 22:rl=(r=rl)||n.memoizedState!==null,fl(e,t,n),rl=r;break;default:fl(e,t,n)}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Bp(e)}catch(e){Zu(t,t.return,e)}}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Bp(e)}catch(e){Zu(t,t.return,e)}}function gl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new al),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new al),t;default:throw Error(i(435,e.tag))}}function _l(e,t){var n=gl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=nd.bind(null,e,t);t.then(r,r)}})}function vl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(of(c.type)){ul=c.stateNode,dl=!1;break a}break;case 5:ul=c.stateNode,dl=!1;break a;case 3:case 4:ul=c.stateNode.containerInfo,dl=!0;break a}c=c.return}if(ul===null)throw Error(i(160));pl(o,s,a),ul=null,dl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bl(t,e),t=t.sibling}var yl=null;function bl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:vl(t,e),xl(e),r&4&&(Wc(3,e,e.return),Uc(3,e),Wc(5,e,e.return));break;case 1:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&64&&nl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=yl;if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[dt]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Ud(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=Yf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Ud(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Yf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Ud(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[it]=e,_t(o),r=o}e.stateNode=r}else Xf(a,e.type,e.stateNode);else e.stateNode=Wf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Xf(a,e.type,e.stateNode):Wf(a,r,e.memoizedProps))}break;case 27:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),e.flags&32){a=e.stateNode;try{Ut(a,``)}catch(t){Zu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Xc(e,a,n===null?a:n.memoizedProps)),r&1024&&(il=!0);break;case 6:if(vl(t,e),xl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Zu(e,e.return,t)}}break;case 3:if(Jf=null,a=yl,yl=wf(t.containerInfo),vl(t,e),yl=a,xl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Bp(t.containerInfo)}catch(t){Zu(e,e.return,t)}il&&(il=!1,Sl(e));break;case 4:r=yl,yl=wf(e.stateNode.containerInfo),vl(t,e),xl(e),yl=r;break;case 12:vl(t,e),xl(e);break;case 31:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 13:vl(t,e),xl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(au=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=nl,d=rl;if(nl=u||a,rl=d||l,vl(t,e),rl=d,nl=u,xl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||nl||rl||wl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Zu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Zu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?cf(m,!0):cf(l.stateNode,!1)}catch(e){Zu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,_l(e,n))));break;case 19:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 30:break;case 21:break;default:vl(t,e),xl(e)}}function xl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;el(e,Qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ut(o,``),n.flags&=-33),el(e,Qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;$c(e,Qc(e),s);break;default:throw Error(i(161))}}catch(t){Zu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Cl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cl(e,t.alternate,t),t=t.sibling}function wl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wc(4,t,t.return),wl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Kc(t,t.return,n),wl(t);break;case 27:xf(t.stateNode);case 26:case 5:Jc(t,t.return),wl(t);break;case 22:t.memoizedState===null&&wl(t);break;case 30:wl(t);break;default:wl(t)}e=e.sibling}}function Tl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Tl(i,a,n),Uc(4,a);break;case 1:if(Tl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Zu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)qa(c[i],s)}catch(e){Zu(r,r.return,e)}}n&&o&64&&Gc(a),qc(a,a.return);break;case 27:tl(a);case 26:case 5:Tl(i,a,n),n&&r===null&&o&4&&Yc(a),qc(a,a.return);break;case 12:Tl(i,a,n);break;case 31:Tl(i,a,n),n&&o&4&&ml(i,a);break;case 13:Tl(i,a,n),n&&o&4&&hl(i,a);break;case 22:a.memoizedState===null&&Tl(i,a,n),qc(a,a.return);break;case 30:break;default:Tl(i,a,n)}t=t.sibling}}function U(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&oa(n))}function El(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oa(e))}function Dl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ol(e,t,n,r),t=t.sibling}function Ol(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Dl(e,t,n,r),i&2048&&Uc(9,t);break;case 1:Dl(e,t,n,r);break;case 3:Dl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oa(e)));break;case 12:if(i&2048){Dl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Zu(t,t.return,e)}}else Dl(e,t,n,r);break;case 31:Dl(e,t,n,r);break;case 13:Dl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Dl(e,t,n,r):(a._visibility|=2,kl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Dl(e,t,n,r):Al(e,t),i&2048&&U(o,t);break;case 24:Dl(e,t,n,r),i&2048&&El(t.alternate,t);break;default:Dl(e,t,n,r)}}function kl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:kl(a,o,s,c,i),Uc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,kl(a,o,s,c,i)):u._visibility&2?kl(a,o,s,c,i):Al(a,o),i&&l&2048&&U(o.alternate,o);break;case 24:kl(a,o,s,c,i),i&&l&2048&&El(o.alternate,o);break;default:kl(a,o,s,c,i)}t=t.sibling}}function Al(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Al(n,r),i&2048&&U(r.alternate,r);break;case 24:Al(n,r),i&2048&&El(r.alternate,r);break;default:Al(n,r)}t=t.sibling}}var jl=8192;function Ml(e,t,n){if(e.subtreeFlags&jl)for(e=e.child;e!==null;)Nl(e,t,n),e=e.sibling}function Nl(e,t,n){switch(e.tag){case 26:Ml(e,t,n),e.flags&jl&&e.memoizedState!==null&&$f(n,yl,e.memoizedState,e.memoizedProps);break;case 5:Ml(e,t,n);break;case 3:case 4:var r=yl;yl=wf(e.stateNode.containerInfo),Ml(e,t,n),yl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=jl,jl=16777216,Ml(e,t,n),jl=r):Ml(e,t,n));break;default:Ml(e,t,n)}}function Pl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,Rl(r,e)}Pl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Il(e),e=e.sibling}function Il(e){switch(e.tag){case 0:case 11:case 15:Fl(e),e.flags&2048&&Wc(9,e,e.return);break;case 3:Fl(e);break;case 12:Fl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):Fl(e);break;default:Fl(e)}}function Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,Rl(r,e)}Pl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wc(8,t,t.return),Ll(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Rl(e,t){for(;ol!==null;){var n=ol;switch(n.tag){case 0:case 11:case 15:Wc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:oa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ol=r;else a:for(n=e;ol!==null;){r=ol;var i=r.sibling,a=r.return;if(ll(r),r===n){ol=null;break a}if(i!==null){i.return=a,ol=i;break a}ol=a}}}var zl={getCacheForType:function(e){var t=Qi(ia),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Qi(ia).controller.signal}},Bl=typeof WeakMap==`function`?WeakMap:Map,Vl=0,Hl=null,Ul=null,Wl=0,Gl=0,Kl=null,W=!1,ql=!1,Jl=!1,Yl=0,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=null,ru=null,iu=!1,au=0,ou=0,su=1/0,cu=null,lu=null,uu=0,du=null,fu=null,pu=0,mu=0,hu=null,gu=null,_u=0,vu=null;function yu(){return Vl&2&&Wl!==0?Wl&-Wl:N.T===null?tt():vd()}function bu(){if(eu===0)if(!(Wl&536870912)||ji){var e=Ve;Ve<<=1,!(Ve&3932160)&&(Ve=262144),eu=e}else eu=536870912;return e=eo.current,e!==null&&(e.flags|=32),eu}function xu(e,t,n){(e===Hl&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)&&(Ou(e,0),Tu(e,Wl,eu,!1)),Je(e,n),(!(Vl&2)||e!==Hl)&&(e===Hl&&(!(Vl&2)&&(Ql|=n),Xl===4&&Tu(e,Wl,eu,!1)),ud(e))}function Su(e,t,n){if(Vl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||L(e,t),a=r?Iu(e,t):Pu(e,t,!0),o=r;do{if(a===0){ql&&!r&&Tu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!wu(n)){a=Pu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=nu;var l=c.current.memoizedState.isDehydrated;if(l&&(Ou(c,s).flags|=256),s=Pu(c,s,!1),s!==2){if(Jl&&!l){c.errorRecoveryDisabledLanes|=o,Ql|=o,a=4;break a}o=ru,ru=a,o!==null&&(ru===null?ru=o:ru.push.apply(ru,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ou(e,0),Tu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Tu(r,t,eu,!W);break a;case 2:ru=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=au+300-we(),10<a)){if(Tu(r,t,eu,!W),Ge(r,0,!0)!==0)break a;pu=t,r.timeoutHandle=ef(Cu.bind(null,r,n,ru,cu,iu,t,eu,Ql,tu,W,o,`Throttled`,-0,0),a);break a}Cu(r,n,ru,cu,iu,t,eu,Ql,tu,W,o,null,-0,0)}}break}while(1);ud(e)}function Cu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zt},Nl(t,a,d);var m=(a&62914560)===a?au-we():(a&4194048)===a?ou-we():0;if(m=tp(d,m),m!==null){pu=a,e.cancelPendingCommit=m(Uu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Tu(e,a,o,!l);return}}Uu(e,t,a,n,r,i,o,s,c)}function wu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Sr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Tu(e,t,n,r){t&=~$l,t&=~Ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ie(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function Eu(){return Vl&6?!0:(dd(0,!1),!1)}function Du(){if(Ul!==null){if(Gl===0)var e=Ul.return;else e=Ul,Wi=Ui=null,ko(e),ka=null,Aa=0,e=Ul;for(;e!==null;)Hc(e.alternate,e),e=e.return;Ul=null}}function Ou(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),pu=0,Du(),Hl=e,Ul=n=si(e.current,null),Wl=t,Gl=0,Kl=null,W=!1,ql=L(e,t),Jl=!1,tu=eu=$l=Ql=Zl=Xl=0,ru=nu=null,iu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ie(r),a=1<<i;t|=e[i],r&=~a}return Yl=t,$r(),n}function ku(e,t){uo=null,N.H=zs,t===ya||t===xa?(t=Da(),Gl=3):t===ba?(t=Da(),Gl=4):Gl=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Kl=t,Ul===null&&(Xl=1,Zs(e,hi(t,e.current)))}function Au(){var e=eo.current;return e===null?!0:(Wl&4194048)===Wl?to===null:(Wl&62914560)===Wl||Wl&536870912?e===to:!1}function ju(){var e=N.H;return N.H=zs,e===null?zs:e}function Mu(){var e=N.A;return N.A=zl,e}function Nu(){Xl=4,W||(Wl&4194048)!==Wl&&eo.current!==null||(ql=!0),!(Zl&134217727)&&!(Ql&134217727)||Hl===null||Tu(Hl,Wl,eu,!1)}function Pu(e,t,n){var r=Vl;Vl|=2;var i=ju(),a=Mu();(Hl!==e||Wl!==t)&&(cu=null,Ou(e,t)),t=!1;var o=Xl;a:do try{if(Gl!==0&&Ul!==null){var s=Ul,c=Kl;switch(Gl){case 8:Du(),o=6;break a;case 3:case 2:case 9:case 6:eo.current===null&&(t=!0);var l=Gl;if(Gl=0,Kl=null,Bu(e,s,c,l),n&&ql){o=0;break a}break;default:l=Gl,Gl=0,Kl=null,Bu(e,s,c,l)}}Fu(),o=Xl;break}catch(t){ku(e,t)}while(1);return t&&e.shellSuspendCounter++,Wi=Ui=null,Vl=r,N.H=i,N.A=a,Ul===null&&(Hl=null,Wl=0,$r()),o}function Fu(){for(;Ul!==null;)Ru(Ul)}function Iu(e,t){var n=Vl;Vl|=2;var r=ju(),a=Mu();Hl!==e||Wl!==t?(cu=null,su=we()+500,Ou(e,t)):ql=L(e,t);a:do try{if(Gl!==0&&Ul!==null){t=Ul;var o=Kl;b:switch(Gl){case 1:Gl=0,Kl=null,Bu(e,t,o,1);break;case 2:case 9:if(Ca(o)){Gl=0,Kl=null,zu(t);break}t=function(){Gl!==2&&Gl!==9||Hl!==e||(Gl=7),ud(e)},o.then(t,t);break a;case 3:Gl=7;break a;case 4:Gl=5;break a;case 7:Ca(o)?(Gl=0,Kl=null,zu(t)):(Gl=0,Kl=null,Bu(e,t,o,7));break;case 5:var s=null;switch(Ul.tag){case 26:s=Ul.memoizedState;case 5:case 27:var c=Ul;if(s?Qf(s):c.stateNode.complete){Gl=0,Kl=null;var l=c.sibling;if(l!==null)Ul=l;else{var u=c.return;u===null?Ul=null:(Ul=u,Vu(u))}break b}}Gl=0,Kl=null,Bu(e,t,o,5);break;case 6:Gl=0,Kl=null,Bu(e,t,o,6);break;case 8:Du(),Xl=6;break a;default:throw Error(i(462))}}Lu();break}catch(t){ku(e,t)}while(1);return Wi=Ui=null,N.H=r,N.A=a,Vl=n,Ul===null?(Hl=null,Wl=0,$r(),Xl):0}function Lu(){for(;Ul!==null&&!Se();)Ru(Ul)}function Ru(e){var t=Nc(e.alternate,e,Yl);e.memoizedProps=e.pendingProps,t===null?Vu(e):Ul=t}function zu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,Wl);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,Wl);break;case 5:ko(t);default:Hc(n,t),t=Ul=ci(t,Yl),t=Nc(n,t,Yl)}e.memoizedProps=e.pendingProps,t===null?Vu(e):Ul=t}function Bu(e,t,n,r){Wi=Ui=null,ko(t),ka=null,Aa=0;var i=t.return;try{if(nc(e,i,t,n,Wl)){Xl=1,Zs(e,hi(n,e.current)),Ul=null;return}}catch(t){if(i!==null)throw Ul=i,t;Xl=1,Zs(e,hi(n,e.current)),Ul=null;return}t.flags&32768?(ji||r===1?e=!0:ql||Wl&536870912?e=!1:(W=e=!0,(r===2||r===9||r===3||r===6)&&(r=eo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Hu(t,e)):Vu(t)}function Vu(e){var t=e;do{if(t.flags&32768){Hu(t,W);return}e=t.return;var n=Bc(t.alternate,t,Yl);if(n!==null){Ul=n;return}if(t=t.sibling,t!==null){Ul=t;return}Ul=t=e}while(t!==null);Xl===0&&(Xl=5)}function Hu(e,t){do{var n=Vc(e.alternate,e);if(n!==null){n.flags&=32767,Ul=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ul=e;return}Ul=e=n}while(e!==null);Xl=6,Ul=null}function Uu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Ju();while(uu!==0);if(Vl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Qr,Ye(e,n,o,s,c,l),e===Hl&&(Ul=Hl=null,Wl=0),fu=t,du=e,pu=n,mu=o,hu=a,gu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,rd(Oe,function(){return Yu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Vl,Vl|=4;try{sl(e,t,n)}finally{Vl=s,P.p=a,N.T=r}}uu=1,Wu(),Gu(),Ku()}}function Wu(){if(uu===1){uu=0;var e=du,t=fu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Vl;Vl|=4;try{bl(t,e);var a=Jd,o=Dr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Er(s.ownerDocument.documentElement,s)){if(c!==null&&Or(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Tr(s,h),v=Tr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}mp=!!qd,Jd=qd=null}finally{Vl=i,P.p=r,N.T=n}}e.current=t,uu=2}}function Gu(){if(uu===2){uu=0;var e=du,t=fu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Vl;Vl|=4;try{cl(e,t.alternate,t)}finally{Vl=i,P.p=r,N.T=n}}uu=3}}function Ku(){if(uu===4||uu===3){uu=0,Ce();var e=du,t=fu,n=pu,r=gu;t.subtreeFlags&10256||t.flags&10256?uu=5:(uu=0,fu=du=null,qu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(lu=null),et(n),t=t.stateNode,Pe&&typeof Pe.onCommitFiberRoot==`function`)try{Pe.onCommitFiberRoot(Ne,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}pu&3&&Ju(),ud(e),i=e.pendingLanes,n&261930&&i&42?e===vu?_u++:(_u=0,vu=e):_u=0,dd(0,!1)}}function qu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,oa(t)))}function Ju(){return Wu(),Gu(),Ku(),Yu()}function Yu(){if(uu!==5)return!1;var e=du,t=mu;mu=0;var n=et(pu),r=N.T,a=P.p;try{P.p=32>n?32:n,N.T=null,n=hu,hu=null;var o=du,s=pu;if(uu=0,fu=du=null,pu=0,Vl&6)throw Error(i(331));var c=Vl;if(Vl|=4,Il(o.current),Ol(o,o.current,s,n),Vl=c,dd(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot==`function`)try{Pe.onPostCommitFiberRoot(Ne,o)}catch{}return!0}finally{P.p=a,N.T=r,qu(e,t)}}function Xu(e,t,n){t=hi(n,t),t=$s(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(Je(e,2),ud(e))}function Zu(e,t,n){if(e.tag===3)Xu(e,e,n);else for(;t!==null;){if(t.tag===3){Xu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(lu===null||!lu.has(r))){e=hi(n,e),n=ec(2),r=Va(t,n,2),r!==null&&(tc(n,r,t,e),Je(r,2),ud(r));break}}t=t.return}}function Qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Jl=!0,i.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Hl===e&&(Wl&n)===n&&(Xl===4||Xl===3&&(Wl&62914560)===Wl&&300>we()-au?!(Vl&2)&&Ou(e,0):$l|=n,tu===Wl&&(tu=0)),ud(e)}function ed(e,t){t===0&&(t=Ke()),e=ti(e,t),e!==null&&(Je(e,t),ud(e))}function td(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ed(e,n)}function nd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),ed(e,n)}function rd(e,t){return be(e,t)}var id=null,ad=null,od=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==ad&&e.next===null&&(ad===null?id=ad=e:ad=ad.next=e),sd=!0,od||(od=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=id;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ie(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=Wl,a=Ge(r,r===Hl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||L(r,a)||(n=!0,gd(r,a));r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=od=!1;var e=0;ld!==0&&$d()&&(e=ld);for(var t=we(),n=null,r=id;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?id=i:n.next=i,i===null&&(ad=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}uu!==0&&uu!==5||dd(e,!1),ld!==0&&(ld=0)}function md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ie(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=R(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Hl,n=Wl,n=Ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||L(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xe(r),et(n)){case 2:case 8:n=De;break;case 32:n=Oe;break;case 268435456:n=Ae;break;default:n=Oe}return r=hd.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xe(r),e.callbackPriority=2,e.callbackNode=null,2}function hd(e,t){if(uu!==0&&uu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ju()&&e.callbackNode!==n)return null;var r=Wl;return r=Ge(e,e===Hl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Su(e,r,t),md(e,we()),e.callbackNode!=null&&e.callbackNode===n?hd.bind(null,e):null)}function gd(e,t){if(Ju())return null;Su(e,t,!0)}function _d(){rf(function(){Vl&6?be(Ee,fd):pd()})}function vd(){if(ld===0){var e=la;e===0&&(e=Be,Be<<=1,!(Be&261888)&&(Be=256)),ld=e}return ld}function yd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Xt(``+e)}function bd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function xd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=yd((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?yd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new yn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ld!==0){var e=o?bd(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?bd(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Sd=0;Sd<Jr.length;Sd++){var Cd=Jr[Sd];Yr(Cd.toLowerCase(),`on`+(Cd[0].toUpperCase()+Cd.slice(1)))}Yr(Br,`onAnimationEnd`),Yr(Vr,`onAnimationIteration`),Yr(Hr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Ur,`onTransitionRun`),Yr(Wr,`onTransitionStart`),Yr(Gr,`onTransitionCancel`),Yr(Kr,`onTransitionEnd`),xt(`onMouseEnter`,[`mouseout`,`mouseover`]),xt(`onMouseLeave`,[`mouseout`,`mouseover`]),xt(`onPointerEnter`,[`pointerout`,`pointerover`]),xt(`onPointerLeave`,[`pointerout`,`pointerover`]),bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var wd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Td=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(wd));function Ed(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Xr(e)}i.currentTarget=null,a=c}}}}function Dd(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(jd(t,e,2,!1),n.add(r))}function Od(e,t,n){var r=0;t&&(r|=4),jd(n,e,r,t)}var kd=`_reactListening`+Math.random().toString(36).slice(2);function Ad(e){if(!e[kd]){e[kd]=!0,vt.forEach(function(t){t!==`selectionchange`&&(Td.has(t)||Od(t,!1,e),Od(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[kd]||(t[kd]=!0,Od(`selectionchange`,!1,t))}}function jd(e,t,n,r){switch(xp(t)){case 2:var i=hp;break;case 8:i=gp;break;default:i=_p}n=i.bind(null,t,n,e),i=void 0,!cn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Md(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=pt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}an(function(){var r=a,i=$t(n),s=[];a:{var c=qr.get(e);if(c!==void 0){var l=yn,u=e;switch(e){case`keypress`:if(mn(n)===0)break a;case`keydown`:case`keyup`:l=Ln;break;case`focusin`:u=`focus`,l=On;break;case`focusout`:u=`blur`,l=On;break;case`beforeblur`:case`afterblur`:l=On;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=En;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Dn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=zn;break;case Br:case Vr:case Hr:l=kn;break;case Kr:l=Bn;break;case`scroll`:case`scrollend`:l=xn;break;case`wheel`:l=Vn;break;case`copy`:case`cut`:case`paste`:l=An;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Rn;break;case`toggle`:case`beforetoggle`:l=Hn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=on(m,p),g!=null&&d.push(Nd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Qt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?pt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=En,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Rn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ht(l),h=u==null?c:ht(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,pt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Fd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Id(s,c,l,d,!1),u!==null&&f!==null&&Id(s,f,u,d,!0)}}a:{if(c=r?ht(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=cr;else if(nr(c))if(ur)v=br;else{v=vr;var y=_r}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&qt(r.elementType)&&(v=cr):v=yr;if(v&&=v(e,r)){rr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&zt(c,`number`,c.value)}switch(y=r?ht(r):window,e){case`focusin`:(nr(y)||y.contentEditable===`true`)&&(Ar=y,jr=r,Mr=null);break;case`focusout`:Mr=jr=Ar=null;break;case`mousedown`:Nr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Nr=!1,Pr(s,n,i);break;case`selectionchange`:if(kr)break;case`keydown`:case`keyup`:Pr(s,n,i)}var b;if(Wn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Qn?Xn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(qn&&n.locale!==`ko`&&(Qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Qn&&(b=pn()):(un=i,dn=`value`in un?un.value:un.textContent,Qn=!0)),y=Pd(r,x),0<y.length&&(x=new jn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Zn(n),b!==null&&(x.data=b)))),(b=Kn?$n(e,n):er(e,n))&&(x=Pd(r,`onBeforeInput`),0<x.length&&(y=new jn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),xd(s,e,r,n,i)}Ed(s,t)})}function Nd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Pd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=on(e,n),i!=null&&r.unshift(Nd(e,i,a)),i=on(e,t),i!=null&&r.push(Nd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Fd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Id(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=on(n,a),l!=null&&o.unshift(Nd(n,l,c))):i||(l=on(n,a),l!=null&&o.push(Nd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ld=/\r\n?/g,Rd=/\u0000|\uFFFD/g;function zd(e){return(typeof e==`string`?e:``+e).replace(Ld,`
|
|
9
|
+
`).replace(Rd,``)}function Bd(e,t){return t=zd(t),zd(e)===t}function Vd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ut(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:Kt(e,r,o);break;case`data`:if(t!==`object`){Dt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Vd(e,t,`name`,a.name,a,null),Vd(e,t,`formEncType`,a.formEncType,a,null),Vd(e,t,`formMethod`,a.formMethod,a,null),Vd(e,t,`formTarget`,a.formTarget,a,null)):(Vd(e,t,`encType`,a.encType,a,null),Vd(e,t,`method`,a.method,a,null),Vd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`onScroll`:r!=null&&Dd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Dd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Xt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Dd(`beforetoggle`,e),Dd(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Jt.get(n)||n,Et(e,n,r))}}function Hd(e,t,n,r,a,o){switch(n){case`style`:Kt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ut(e,``+r);break;case`onScroll`:r!=null&&Dd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Dd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[at]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Et(e,n,r)}}}function Ud(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Dd(`error`,e),Dd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Vd(e,t,o,s,n,null)}}a&&Vd(e,t,`srcSet`,n.srcSet,n,null),r&&Vd(e,t,`src`,n.src,n,null);return;case`input`:Dd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Vd(e,t,r,d,n,null)}}Rt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Dd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Vd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Bt(e,!!r,n,!0):Bt(e,!!r,t,!1);return;case`textarea`:for(s in Dd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Vd(e,t,s,c,n,null)}Ht(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Vd(e,t,l,r,n,null)}return;case`dialog`:Dd(`beforetoggle`,e),Dd(`toggle`,e),Dd(`cancel`,e),Dd(`close`,e);break;case`iframe`:case`object`:Dd(`load`,e);break;case`video`:case`audio`:for(r=0;r<wd.length;r++)Dd(wd[r],e);break;case`image`:Dd(`error`,e),Dd(`load`,e);break;case`details`:Dd(`toggle`,e);break;case`embed`:case`source`:case`link`:Dd(`error`,e),Dd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Vd(e,t,u,r,n,null)}return;default:if(qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Hd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Vd(e,t,c,r,n,null))}function Wd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Vd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Vd(e,t,p,m,r,f)}}Lt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Vd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Vd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Bt(e,!!n,n?[]:``,!1):Bt(e,!!n,t,!0)):Bt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Vd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Vd(e,t,s,a,r,o)}Vt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Vd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Vd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Vd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Vd(e,t,u,p,r,m)}return;default:if(qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Hd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Hd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Vd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Vd(e,t,f,p,r,m)}function Gd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Kd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Gd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Gd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var qd=null,Jd=null;function Yd(e){return e.nodeType===9?e:e.ownerDocument}function Xd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function G(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Zd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Qd=null;function $d(){var e=window.event;return e&&e.type===`popstate`?e===Qd?!1:(Qd=e,!0):(Qd=null,!1)}var ef=typeof setTimeout==`function`?setTimeout:void 0,tf=typeof clearTimeout==`function`?clearTimeout:void 0,nf=typeof Promise==`function`?Promise:void 0,rf=typeof queueMicrotask==`function`?queueMicrotask:nf===void 0?ef:function(e){return nf.resolve(null).then(e).catch(af)};function af(e){setTimeout(function(){throw e})}function of(e){return e===`head`}function sf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Bp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)xf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,xf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&xf(e.ownerDocument.body);n=i}while(n);Bp(t)}function cf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function lf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:lf(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function uf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[dt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=gf(e.nextSibling),e===null)break}return null}function df(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gf(e.nextSibling),e===null))return null;return e}function ff(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gf(e.nextSibling),e===null))return null;return e}function pf(e){return e.data===`$?`||e.data===`$~`}function mf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function gf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var _f=null;function vf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function yf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function bf(e,t,n){switch(t=Yd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function xf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var Sf=new Map,Cf=new Set;function wf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Tf=P.d;P.d={f:Ef,r:Df,D:Af,C:jf,L:Mf,m:Nf,X:Ff,S:Pf,M:If};function Ef(){var e=Tf.f(),t=Eu();return e||t}function Df(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):Tf.r(e)}var Of=typeof document>`u`?null:document;function kf(e,t,n){var r=Of;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Cf.has(i)||(Cf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ud(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Af(e){Tf.D(e),kf(`dns-prefetch`,e,null)}function jf(e,t){Tf.C(e,t),kf(`preconnect`,e,t)}function Mf(e,t,n){Tf.L(e,t,n);var r=Of;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Hf(e)}Sf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Sf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Ud(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Nf(e,t){Tf.m(e,t);var n=Of;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Hf(e)}if(!Sf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Sf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Ud(r,`link`,e),_t(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=gt(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Sf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);_t(c),Ud(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ff(e,t){Tf.X(e,t);var n=Of;if(n&&e){var r=gt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=f({src:e,async:!0},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),_t(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t){Tf.M(e,t);var n=Of;if(n&&e){var r=gt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),_t(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=oe.current)?wf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Rf(n.href),n=gt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Rf(n.href);var o=gt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Sf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Sf.set(e,n),o||Vf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Hf(n),n=gt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Rf(e){return`href="`+It(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ud(t,`link`,n),_t(t),e.head.appendChild(t))}function Hf(e){return`[src="`+It(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Ud(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Bf(n),(a=Sf.get(a))&&Kf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ud(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,_t(a),a):(r=n,(a=Sf.get(o))&&(r=f({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(a),Ud(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Gf(r,n.precedence,e));return t.instance}function Gf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Jf=null;function Yf(e,t,n){if(Jf===null){var r=new Map,i=Jf=new Map;i.set(n,r)}else i=Jf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[dt]||a[it]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Zf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Kf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ud(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ep===0&&(ep=62500*Kd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=np.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var op={$$typeof:b,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function sp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function cp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new sp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ai(3,null,null,t),e.current=a,a.stateNode=e,t=aa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ra(a),e}function lp(e){return e?(e=ri,e):ri}function up(e,t,n,r,i,a){i=lp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ba(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Va(e,r,t),n!==null&&(xu(n,e,t),Ha(n,e,t))}function dp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fp(e,t){dp(e,t),(e=e.alternate)&&dp(e,t)}function pp(e){if(e.tag===13||e.tag===31){var t=ti(e,67108864);t!==null&&xu(t,e,67108864),fp(e,67108864)}}function K(e){if(e.tag===13||e.tag===31){var t=yu();t=$e(t);var n=ti(e,t);n!==null&&xu(n,e,t),fp(e,t)}}var mp=!0;function hp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,_p(e,t,n,r)}finally{P.p=a,N.T=i}}function gp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,_p(e,t,n,r)}finally{P.p=a,N.T=i}}function _p(e,t,n,r){if(mp){var i=vp(r);if(i===null)Md(e,t,r,yp,n),Ap(e,r);else if(Mp(i,e,t,n,r))r.stopPropagation();else if(Ap(e,r),t&4&&-1<kp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ie(o);s.entanglements[1]|=c,o&=~c}ud(a),!(Vl&6)&&(su=we()+500,dd(0,!1))}}break;case 31:case 13:s=ti(a,2),s!==null&&xu(s,a,2),Eu(),fp(a,2)}if(a=vp(r),a===null&&Md(e,t,r,yp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Md(e,t,r,null,n)}}function vp(e){return e=$t(e),bp(e)}var yp=null;function bp(e){if(yp=null,e=pt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return yp=e,null}function xp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Te()){case Ee:return 2;case De:return 8;case Oe:case ke:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var Sp=!1,Cp=null,wp=null,Tp=null,Ep=new Map,Dp=new Map,Op=[],kp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ap(e,t){switch(e){case`focusin`:case`focusout`:Cp=null;break;case`dragenter`:case`dragleave`:wp=null;break;case`mouseover`:case`mouseout`:Tp=null;break;case`pointerover`:case`pointerout`:Ep.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Dp.delete(t.pointerId)}}function jp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=mt(t),t!==null&&pp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Mp(e,t,n,r,i){switch(t){case`focusin`:return Cp=jp(Cp,e,t,n,r,i),!0;case`dragenter`:return wp=jp(wp,e,t,n,r,i),!0;case`mouseover`:return Tp=jp(Tp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ep.set(a,jp(Ep.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Dp.set(a,jp(Dp.get(a)||null,e,t,n,r,i)),!0}return!1}function Np(e){var t=pt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,nt(e.priority,function(){K(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,nt(e.priority,function(){K(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Pp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qt=r,n.target.dispatchEvent(r),Qt=null}else return t=mt(n),t!==null&&pp(t),e.blockedOn=n,!1;t.shift()}return!0}function Fp(e,t,n){Pp(e)&&n.delete(t)}function Ip(){Sp=!1,Cp!==null&&Pp(Cp)&&(Cp=null),wp!==null&&Pp(wp)&&(wp=null),Tp!==null&&Pp(Tp)&&(Tp=null),Ep.forEach(Fp),Dp.forEach(Fp)}function Lp(e,n){e.blockedOn===n&&(e.blockedOn=null,Sp||(Sp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ip)))}var Rp=null;function zp(e){Rp!==e&&(Rp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Rp===e&&(Rp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(bp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Bp(e){function t(t){return Lp(t,e)}Cp!==null&&Lp(Cp,e),wp!==null&&Lp(wp,e),Tp!==null&&Lp(Tp,e),Ep.forEach(t),Dp.forEach(t);for(var n=0;n<Op.length;n++){var r=Op[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Op.length&&(n=Op[0],n.blockedOn===null);)Np(n),n.blockedOn===null&&Op.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[at]||null;if(typeof a==`function`)o||zp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(bp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),zp(n)}}}function Vp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Hp(e){this._internalRoot=e}Up.prototype.render=Hp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;up(n,yu(),e,t,null,null)},Up.prototype.unmount=Hp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;up(e.current,2,null,e,null,null),Eu(),t[ot]=null}};function Up(e){this._internalRoot=e}Up.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Op.length&&t!==0&&t<Op[n].priority;n++);Op.splice(n,0,e),n===0&&Np(e)}};var Wp=n.version;if(Wp!==`19.2.7`)throw Error(i(527,Wp,`19.2.7`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Gp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Kp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kp.isDisabled&&Kp.supportsFiber)try{Ne=Kp.inject(Gp),Pe=Kp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=cp(e,1,!1,null,null,n,r,null,o,s,c,Vp),e[ot]=t.current,Ad(e),new Hp(t)}})),pr=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=fr()}))(),mr=Object.create,hr=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,_r=Object.getOwnPropertyNames,vr=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty,br=(e,t)=>function(){return t||(0,e[_r(e)[0]])((t={exports:{}}).exports,t),t.exports},xr=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_r(t),a=0,o=i.length,s;a<o;a++)s=i[a],!yr.call(e,s)&&s!==n&&hr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=gr(t,s))||r.enumerable});return e},Sr=(e,t,n)=>(n=e==null?{}:mr(vr(e)),xr(t||!e||!e.__esModule?hr(n,`default`,{value:e,enumerable:!0}):n,e)),Cr=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(e,t){function n(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),wr=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(e,t){var n=Cr();function r(e,t){if(e==null)return{};var r,i,a=n(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Tr=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Er=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Tr().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Dr=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Tr().default,r=Er();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Or=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Dr();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),kr=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Or();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ar=Sr(wr(),1),jr=Sr(kr(),1),Mr=[`cursor`,`direction`];function Nr(e,t,n){let r=e.flatMap(e=>e.split(`.`));if(!t&&(!n||n===`any`))return r.length?[r]:[];if(n===`infinite`&&Bt(t)&&(`direction`in t||`cursor`in t)){let{cursor:e,direction:n}=t;return[r,{input:(0,Ar.default)(t,Mr),type:`infinite`}]}return[r,(0,jr.default)((0,jr.default)({},t!==void 0&&t!==te&&{input:t}),n&&n!==`any`&&{type:n})]}function Pr(e){return Nr(e,void 0,`any`)}function Fr(e){return rn(({path:t,args:n})=>{let r=[...t],i=r.pop();if(i===`useMutation`)return e[i](r,...n);if(i===`_def`)return{path:r};let[a,...o]=n,s=o[0]??{};return e[i](r,a,s)})}var Ir=[`client`,`ssrContext`,`ssrState`,`abortOnUnmount`],Lr=L.createContext?.call(L,null),Rr=e=>{switch(e){case`queryOptions`:case`fetch`:case`ensureData`:case`prefetch`:case`getData`:case`setData`:case`setQueriesData`:return`query`;case`infiniteQueryOptions`:case`fetchInfinite`:case`prefetchInfinite`:case`getInfiniteData`:case`setInfiniteData`:return`infinite`;case`setMutationDefaults`:case`getMutationDefaults`:case`isMutating`:case`cancel`:case`invalidate`:case`refetch`:case`reset`:return`any`}};function zr(e){return rn(t=>{let n=[...t.path],r=n.pop(),i=[...t.args],a=i.shift(),o=Nr(n,a,Rr(r));return{infiniteQueryOptions:()=>e.infiniteQueryOptions(n,o,i[0]),queryOptions:()=>e.queryOptions(n,o,...i),fetch:()=>e.fetchQuery(o,...i),fetchInfinite:()=>e.fetchInfiniteQuery(o,i[0]),prefetch:()=>e.prefetchQuery(o,...i),prefetchInfinite:()=>e.prefetchInfiniteQuery(o,i[0]),ensureData:()=>e.ensureQueryData(o,...i),invalidate:()=>e.invalidateQueries(o,...i),reset:()=>e.resetQueries(o,...i),refetch:()=>e.refetchQueries(o,...i),cancel:()=>e.cancelQuery(o,...i),setData:()=>{e.setQueryData(o,i[0],i[1])},setQueriesData:()=>e.setQueriesData(o,i[0],i[1],i[2]),setInfiniteData:()=>{e.setInfiniteQueryData(o,i[0],i[1])},getData:()=>e.getQueryData(o),getInfiniteData:()=>e.getInfiniteQueryData(o),setMutationDefaults:()=>e.setMutationDefaults(Pr(n),a),getMutationDefaults:()=>e.getMutationDefaults(Pr(n)),isMutating:()=>e.isMutating({mutationKey:Pr(n)})}[r]()})}function Br(e){let t=tr(e.client),n=zr(e);return an(r=>{let i=r;return i===`client`?t:Ir.includes(i)?e[i]:n[r]})}var Vr=Sr(kr(),1);function Hr(e){let t=e instanceof Zn?e:rr(e);return rn(e=>{let n=e.path,r=n.join(`.`),[i,a]=e.args;return(0,Vr.default)({queryKey:Nr(n,i,`query`),queryFn:()=>t.query(r,i,a?.trpc)},a)})}var Ur=Sr(kr(),1);function Wr(e,t,n){let r=e[0],i=e[1]?.input;return n&&(i=(0,Ur.default)((0,Ur.default)((0,Ur.default)({},i??{}),n.pageParam?{cursor:n.pageParam}:{}),{},{direction:n.direction})),[r.join(`.`),i,t?.trpc]}var Gr=Sr(br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){var t,n,i,a=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,i=Symbol.iterator);a--;){if(n&&(t=e[n])!=null)return t.call(e);if(i&&(t=e[i])!=null)return new r(t.call(e));n=`@@asyncIterator`,i=`@@iterator`}throw TypeError(`Object is not async iterable`)}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new r(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}})(),1);function Kr(e){return{path:e.path.join(`.`)}}function qr(e){let t=Kr(e);return L.useMemo(()=>t,[t])}async function Jr(e,t,n){let r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:`success`});let i=[];var a=!1,o=!1,s;try{for(var c=(0,Gr.default)(e),l;a=!(l=await c.next()).done;a=!1){let e=l.value;i.push(e),r.setState({data:[...i]})}}catch(e){o=!0,s=e}finally{try{a&&c.return!=null&&await c.return()}finally{if(o)throw s}}return i}var Yr=Sr(kr(),1);function Xr(e){let{client:t,queryClient:n}=e,r=t instanceof Zn?t:rr(t);return{infiniteQueryOptions:(e,t,n)=>{let i=t[1]?.input===te;return Object.assign(_t((0,Yr.default)((0,Yr.default)({},n),{},{initialData:n?.initialData,queryKey:t,queryFn:i?te:async e=>{var i;let a=(0,Yr.default)((0,Yr.default)({},n),{},{trpc:(0,Yr.default)((0,Yr.default)({},n?.trpc),!(n==null||(i=n.trpc)==null)&&i.abortOnUnmount?{signal:e.signal}:{signal:null})});return await r.query(...Wr(t,a,{direction:e.direction,pageParam:e.pageParam}))},initialPageParam:n?.initialCursor??null})),{trpc:Kr({path:e})})},queryOptions:(e,t,i)=>{let a=t[1]?.input===te;return Object.assign(gt((0,Yr.default)((0,Yr.default)({},i),{},{initialData:i?.initialData,queryKey:t,queryFn:a?te:async e=>{var a;let o=(0,Yr.default)((0,Yr.default)({},i),{},{trpc:(0,Yr.default)((0,Yr.default)({},i?.trpc),!(i==null||(a=i.trpc)==null)&&a.abortOnUnmount?{signal:e.signal}:{signal:null})}),s=await r.query(...Wr(t,o));return Ut(s)?Jr(s,n,t):s}})),{trpc:Kr({path:e})})},fetchQuery:(e,t)=>n.fetchQuery((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e,queryFn:()=>r.query(...Wr(e,t))})),fetchInfiniteQuery:(e,t)=>n.fetchInfiniteQuery((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e,queryFn:({pageParam:n,direction:i})=>r.query(...Wr(e,t,{pageParam:n,direction:i})),initialPageParam:t?.initialCursor??null})),prefetchQuery:(e,t)=>n.prefetchQuery((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e,queryFn:()=>r.query(...Wr(e,t))})),prefetchInfiniteQuery:(e,t)=>n.prefetchInfiniteQuery((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e,queryFn:({pageParam:n,direction:i})=>r.query(...Wr(e,t,{pageParam:n,direction:i})),initialPageParam:t?.initialCursor??null})),ensureQueryData:(e,t)=>n.ensureQueryData((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e,queryFn:()=>r.query(...Wr(e,t))})),invalidateQueries:(e,t,r)=>n.invalidateQueries((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e}),r),resetQueries:(e,t,r)=>n.resetQueries((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e}),r),refetchQueries:(e,t,r)=>n.refetchQueries((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e}),r),cancelQuery:(e,t)=>n.cancelQueries({queryKey:e},t),setQueryData:(e,t,r)=>n.setQueryData(e,t,r),setQueriesData:(e,t,r,i)=>n.setQueriesData((0,Yr.default)((0,Yr.default)({},t),{},{queryKey:e}),r,i),getQueryData:e=>n.getQueryData(e),setInfiniteQueryData:(e,t,r)=>n.setQueryData(e,t,r),getInfiniteQueryData:e=>n.getQueryData(e),setMutationDefaults:(t,i)=>{let a=t[0];return n.setMutationDefaults(t,typeof i==`function`?i({canonicalMutationFn:t=>r.mutation(...Wr([a,{input:t}],e))}):i)},getMutationDefaults:e=>n.getMutationDefaults(e),isMutating:e=>n.isMutating((0,Yr.default)((0,Yr.default)({},e),{},{exact:!0}))}}var z=Sr(kr()),Zr=(e,t)=>new Proxy(e,{get(e,n){return t(n),e[n]}});function Qr(e){var t;let n=(e==null||(t=e.overrides)==null||(t=t.useMutation)==null?void 0:t.onSuccess)??(e=>e.originalFn()),r=e?.context??Lr,i=nr,a=e=>{let{abortOnUnmount:t=!1,queryClient:n,ssrContext:i}=e,[a,o]=L.useState(e.ssrState??!1),s=e.client instanceof Zn?e.client:rr(e.client),c=L.useMemo(()=>Xr({client:s,queryClient:n}),[s,n]),l=L.useMemo(()=>(0,z.default)({abortOnUnmount:t,queryClient:n,client:s,ssrContext:i??null,ssrState:a},c),[t,s,c,n,i,a]);return L.useEffect(()=>{o(e=>e?`mounted`:!1)},[]),(0,R.jsx)(r.Provider,{value:l,children:e.children})};function o(){let e=L.useContext(r);if(!e)throw Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return e}function s(e,t){let{queryClient:n,ssrState:r}=o();return r&&r!==`mounted`&&n.getQueryCache().find({queryKey:e})?.state.status===`error`?(0,z.default)({retryOnMount:!1},t):t}function c(t,n,r){var i,a;let{abortOnUnmount:c,client:l,ssrState:u,queryClient:d,prefetchQuery:f}=o(),p=Nr(t,n,`query`),m=d.getQueryDefaults(p),h=n===te;typeof window>`u`&&u===`prepass`&&(r==null||(i=r.trpc)==null?void 0:i.ssr)!==!1&&(r?.enabled??m?.enabled)!==!1&&!h&&!d.getQueryCache().find({queryKey:p})&&f(p,r);let g=s(p,(0,z.default)((0,z.default)({},m),r)),_=(r==null||(a=r.trpc)==null?void 0:a.abortOnUnmount)??e?.abortOnUnmount??c,v=ut((0,z.default)((0,z.default)({},g),{},{queryKey:p,queryFn:h?n:async e=>{let t=(0,z.default)((0,z.default)({},g),{},{trpc:(0,z.default)((0,z.default)({},g?.trpc),_?{signal:e.signal}:{signal:null})}),n=await l.query(...Wr(p,t));return Ut(n)?Jr(n,d,p):n}}),d);return v.trpc=qr({path:t}),v}function l(t,n,r){var i;let a=o(),s=Nr(t,n,`query`),c=n===te,l=(r==null||(i=r.trpc)==null?void 0:i.abortOnUnmount)??e?.abortOnUnmount??a.abortOnUnmount;mt((0,z.default)((0,z.default)({},r),{},{queryKey:s,queryFn:c?n:e=>{let t={trpc:(0,z.default)((0,z.default)({},r?.trpc),l?{signal:e.signal}:{})};return a.client.query(...Wr(s,t))}}))}function u(t,n,r){var i;let a=o(),s=Nr(t,n,`query`),c=(r==null||(i=r.trpc)==null?void 0:i.abortOnUnmount)??e?.abortOnUnmount??a.abortOnUnmount,l=dt((0,z.default)((0,z.default)({},r),{},{queryKey:s,queryFn:e=>{let t=(0,z.default)((0,z.default)({},r),{},{trpc:(0,z.default)((0,z.default)({},r?.trpc),c?{signal:e.signal}:{signal:null})});return a.client.query(...Wr(s,t))}}),a.queryClient);return l.trpc=qr({path:t}),[l.data,l]}function d(e,t){let{client:r,queryClient:i}=o(),a=Pr(e),s=i.defaultMutationOptions(i.getMutationDefaults(a)),c=vt((0,z.default)((0,z.default)({},t),{},{mutationKey:a,mutationFn:n=>r.mutation(...Wr([e,{input:n}],t)),onSuccess(...e){return n({originalFn:()=>{var n,r;return(t==null||(n=t.onSuccess)==null?void 0:n.call(t,...e))??(s==null||(r=s.onSuccess)==null?void 0:r.call(s,...e))},queryClient:i,meta:t?.meta??s?.meta??{}})}}),i);return c.trpc=qr({path:e}),c}let f={data:void 0,error:null,status:`idle`},p={data:void 0,error:null,status:`connecting`};function m(e,t,n){let r=n?.enabled??t!==te,i=T(Nr(e,t,`any`)),{client:a}=o(),s=L.useRef(n);L.useEffect(()=>{s.current=n});let[c]=L.useState(new Set([])),l=L.useCallback(e=>{c.add(e)},[c]),u=L.useRef(null),d=L.useCallback(e=>{let t=h.current,n=h.current=e(t),r=!1;for(let e of c)if(t[e]!==n[e]){r=!0;break}r&&_(Zr(n,l))},[l,c]),m=L.useCallback(()=>{var n;if((n=u.current)==null||n.unsubscribe(),!r){d(()=>(0,z.default)((0,z.default)({},f),{},{reset:m}));return}d(()=>(0,z.default)((0,z.default)({},p),{},{reset:m}));let i=a.subscription(e.join(`.`),t??void 0,{onStarted:()=>{var e,t;(e=(t=s.current).onStarted)==null||e.call(t),d(e=>(0,z.default)((0,z.default)({},e),{},{status:`pending`,error:null}))},onData:e=>{var t,n;(t=(n=s.current).onData)==null||t.call(n,e),d(t=>(0,z.default)((0,z.default)({},t),{},{status:`pending`,data:e,error:null}))},onError:e=>{var t,n;(t=(n=s.current).onError)==null||t.call(n,e),d(t=>(0,z.default)((0,z.default)({},t),{},{status:`error`,error:e}))},onConnectionStateChange:e=>{d(t=>{switch(e.state){case`idle`:return(0,z.default)((0,z.default)({},t),{},{status:e.state,error:null,data:void 0});case`connecting`:return(0,z.default)((0,z.default)({},t),{},{error:e.error,status:e.state});case`pending`:return t}})},onComplete:()=>{var e,t;(e=(t=s.current).onComplete)==null||e.call(t),d(e=>(0,z.default)((0,z.default)({},e),{},{status:`idle`,error:null,data:void 0}))}});u.current=i},[a,i,r,d]);L.useEffect(()=>(m(),()=>{var e;(e=u.current)==null||e.unsubscribe()}),[m]);let h=L.useRef(r?(0,z.default)((0,z.default)({},p),{},{reset:m}):(0,z.default)((0,z.default)({},f),{},{reset:m})),[g,_]=L.useState(Zr(h.current,l));return g}function h(e,t,n){var r,i;let{client:a,ssrState:c,prefetchInfiniteQuery:l,queryClient:u,abortOnUnmount:d}=o(),f=Nr(e,t,`infinite`),p=u.getQueryDefaults(f),m=t===te;typeof window>`u`&&c===`prepass`&&(n==null||(r=n.trpc)==null?void 0:r.ssr)!==!1&&(n?.enabled??p?.enabled)!==!1&&!m&&!u.getQueryCache().find({queryKey:f})&&l(f,(0,z.default)((0,z.default)({},p),n));let h=s(f,(0,z.default)((0,z.default)({},p),n)),g=(n==null||(i=n.trpc)==null?void 0:i.abortOnUnmount)??d,_=yt((0,z.default)((0,z.default)({},h),{},{initialPageParam:n.initialCursor??null,persister:n.persister,queryKey:f,queryFn:m?t:e=>{let t=(0,z.default)((0,z.default)({},h),{},{trpc:(0,z.default)((0,z.default)({},h?.trpc),g?{signal:e.signal}:{signal:null})});return a.query(...Wr(f,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}),u);return _.trpc=qr({path:e}),_}function g(e,t,n){var r;let i=o(),a=Nr(e,t,`infinite`),c=i.queryClient.getQueryDefaults(a),l=t===te,u=s(a,(0,z.default)((0,z.default)({},c),n)),d=(n==null||(r=n.trpc)==null?void 0:r.abortOnUnmount)??i.abortOnUnmount;ht((0,z.default)((0,z.default)({},n),{},{initialPageParam:n.initialCursor??null,queryKey:a,queryFn:l?t:e=>{let t=(0,z.default)((0,z.default)({},u),{},{trpc:(0,z.default)((0,z.default)({},u?.trpc),d?{signal:e.signal}:{})});return i.client.query(...Wr(a,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}))}function _(e,t,n){var r;let i=o(),a=Nr(e,t,`infinite`),c=i.queryClient.getQueryDefaults(a),l=s(a,(0,z.default)((0,z.default)({},c),n)),u=(n==null||(r=n.trpc)==null?void 0:r.abortOnUnmount)??i.abortOnUnmount,d=ft((0,z.default)((0,z.default)({},n),{},{initialPageParam:n.initialCursor??null,queryKey:a,queryFn:e=>{let t=(0,z.default)((0,z.default)({},l),{},{trpc:(0,z.default)((0,z.default)({},l?.trpc),u?{signal:e.signal}:{})});return i.client.query(...Wr(a,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}),i.queryClient);return d.trpc=qr({path:e}),[d.data,d]}return{Provider:a,createClient:i,useContext:o,useUtils:o,useQuery:c,usePrefetchQuery:l,useSuspenseQuery:u,useQueries:(e,t)=>{let{ssrState:n,queryClient:r,prefetchQuery:i,client:a}=o(),s=e(Hr(a));if(typeof window>`u`&&n===`prepass`)for(let e of s){let t=e;t.trpc?.ssr!==!1&&!r.getQueryCache().find({queryKey:t.queryKey})&&i(t.queryKey,t)}return ct({queries:s.map(e=>(0,z.default)((0,z.default)({},e),{},{queryKey:e.queryKey})),combine:t?.combine},r)},useSuspenseQueries:e=>{let{queryClient:t,client:n}=o(),r=pt({queries:e(Hr(n)).map(e=>(0,z.default)((0,z.default)({},e),{},{queryFn:e.queryFn,queryKey:e.queryKey}))},t);return[r.map(e=>e.data),r]},useMutation:d,useSubscription:m,useInfiniteQuery:h,usePrefetchInfiniteQuery:g,useSuspenseInfiniteQuery:_}}function $r(e){let t=Fr(e);return an(n=>n===`useContext`||n===`useUtils`?()=>{let t=e.useUtils();return L.useMemo(()=>Br(t),[t])}:e.hasOwnProperty(n)?e[n]:t[n])}function ei(e){return $r(Qr(e))}var B=ei(),ti;function V(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var ni=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ri=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ti=globalThis).__zod_globalConfig??(ti.__zod_globalConfig={});var ii=globalThis.__zod_globalConfig;function ai(e){return e&&Object.assign(ii,e),ii}function oi(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function si(e,t){return typeof t==`bigint`?t.toString():t}function ci(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function li(e){return e==null}function ui(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function di(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var fi=Symbol(`evaluating`);function pi(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==fi)return r===void 0&&(r=fi,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function mi(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function hi(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function gi(e){return JSON.stringify(e)}function _i(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var vi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function yi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var bi=ci(()=>{if(ii.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function xi(e){if(yi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(yi(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Si(e){return xi(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ci=new Set([`string`,`number`,`symbol`]);function wi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ti(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function H(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ei(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Di={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Oi(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Ti(e,hi(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return mi(this,`shape`,e),e},checks:[]}))}function ki(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Ti(e,hi(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return mi(this,`shape`,r),r},checks:[]}))}function Ai(e,t){if(!xi(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ti(e,hi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return mi(this,`shape`,n),n}}))}function ji(e,t){if(!xi(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ti(e,hi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return mi(this,`shape`,n),n}}))}function Mi(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ti(e,hi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return mi(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ni(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Ti(t,hi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return mi(this,`shape`,i),i},checks:[]}))}function Pi(e,t,n){return Ti(t,hi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return mi(this,`shape`,i),i}}))}function Fi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ii(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Li(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ri(e){return typeof e==`string`?e:e?.message}function zi(e,t,n){let r=e.message?e.message:Ri(e.inst?._zod.def?.error?.(e))??Ri(t?.error?.(e))??Ri(n.customError?.(e))??Ri(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Bi(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Vi(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Hi=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,si,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ui=V(`$ZodError`,Hi),Wi=V(`$ZodError`,Hi,{Parent:Error});function Gi(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ki(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var qi=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new ni;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>zi(e,a,ai())));throw vi(t,i?.callee),t}return o.value},Ji=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>zi(e,a,ai())));throw vi(t,i?.callee),t}return o.value},Yi=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ni;return a.issues.length?{success:!1,error:new(e??Ui)(a.issues.map(e=>zi(e,i,ai())))}:{success:!0,data:a.value}},Xi=Yi(Wi),Zi=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>zi(e,i,ai())))}:{success:!0,data:a.value}},Qi=Zi(Wi),$i=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qi(e)(t,n,i)},ea=e=>(t,n,r)=>qi(e)(t,n,r),ta=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ji(e)(t,n,i)},na=e=>async(t,n,r)=>Ji(e)(t,n,r),ra=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Yi(e)(t,n,i)},ia=e=>(t,n,r)=>Yi(e)(t,n,r),aa=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Zi(e)(t,n,i)},oa=e=>async(t,n,r)=>Zi(e)(t,n,r),sa=/^[cC][0-9a-z]{6,}$/,ca=/^[0-9a-z]+$/,la=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ua=/^[0-9a-vA-V]{20}$/,da=/^[A-Za-z0-9]{27}$/,fa=/^[a-zA-Z0-9_-]{21}$/,pa=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ma=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ha=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ga=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_a=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function va(){return new RegExp(_a,`u`)}var ya=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ba=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xa=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Sa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ca=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wa=/^[A-Za-z0-9_-]*$/,Ta=/^https?$/,Ea=/^\+[1-9]\d{6,14}$/,Da=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Oa=RegExp(`^${Da}$`);function ka(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Aa(e){return RegExp(`^${ka(e)}$`)}function ja(e){let t=ka({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Da}T(?:${r})$`)}var Ma=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Na=/^-?\d+$/,Pa=/^-?\d+(?:\.\d+)?$/,Fa=/^(?:true|false)$/i,Ia=/^null$/i,La=/^[^A-Z]*$/,Ra=/^[^a-z]*$/,za=V(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ba={number:`number`,bigint:`bigint`,object:`date`},Va=V(`$ZodCheckLessThan`,(e,t)=>{za.init(e,t);let n=Ba[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ha=V(`$ZodCheckGreaterThan`,(e,t)=>{za.init(e,t);let n=Ba[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ua=V(`$ZodCheckMultipleOf`,(e,t)=>{za.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):di(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Wa=V(`$ZodCheckNumberFormat`,(e,t)=>{za.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Di[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Na)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ga=V(`$ZodCheckMaxLength`,(e,t)=>{var n;za.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!li(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Bi(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ka=V(`$ZodCheckMinLength`,(e,t)=>{var n;za.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!li(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Bi(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qa=V(`$ZodCheckLengthEquals`,(e,t)=>{var n;za.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!li(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Bi(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ja=V(`$ZodCheckStringFormat`,(e,t)=>{var n,r;za.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ya=V(`$ZodCheckRegex`,(e,t)=>{Ja.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xa=V(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=La,Ja.init(e,t)}),Za=V(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ra,Ja.init(e,t)}),Qa=V(`$ZodCheckIncludes`,(e,t)=>{za.init(e,t);let n=wi(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),$a=V(`$ZodCheckStartsWith`,(e,t)=>{za.init(e,t);let n=RegExp(`^${wi(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),eo=V(`$ZodCheckEndsWith`,(e,t)=>{za.init(e,t);let n=RegExp(`.*${wi(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),to=V(`$ZodCheckOverwrite`,(e,t)=>{za.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),no=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
10
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
11
|
+
`))}},ro={major:4,minor:4,patch:3},io=V(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ro;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Fi(e),i;for(let a of t){if(a._zod.def.when){if(Ii(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new ni;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Fi(e,t))});else{if(e.issues.length===t)continue;r||=Fi(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Fi(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new ni;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new ni;return o.then(e=>t(e,r,a))}return t(o,r,a)}}pi(e,`~standard`,()=>({validate:t=>{try{let n=Xi(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Qi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),ao=V(`$ZodString`,(e,t)=>{io.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ma(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),oo=V(`$ZodStringFormat`,(e,t)=>{Ja.init(e,t),ao.init(e,t)}),so=V(`$ZodGUID`,(e,t)=>{t.pattern??=ma,oo.init(e,t)}),co=V(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=ha(e)}else t.pattern??=ha();oo.init(e,t)}),lo=V(`$ZodEmail`,(e,t)=>{t.pattern??=ga,oo.init(e,t)}),uo=V(`$ZodURL`,(e,t)=>{oo.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Ta.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),fo=V(`$ZodEmoji`,(e,t)=>{t.pattern??=va(),oo.init(e,t)}),po=V(`$ZodNanoID`,(e,t)=>{t.pattern??=fa,oo.init(e,t)}),mo=V(`$ZodCUID`,(e,t)=>{t.pattern??=sa,oo.init(e,t)}),ho=V(`$ZodCUID2`,(e,t)=>{t.pattern??=ca,oo.init(e,t)}),go=V(`$ZodULID`,(e,t)=>{t.pattern??=la,oo.init(e,t)}),_o=V(`$ZodXID`,(e,t)=>{t.pattern??=ua,oo.init(e,t)}),vo=V(`$ZodKSUID`,(e,t)=>{t.pattern??=da,oo.init(e,t)}),yo=V(`$ZodISODateTime`,(e,t)=>{t.pattern??=ja(t),oo.init(e,t)}),bo=V(`$ZodISODate`,(e,t)=>{t.pattern??=Oa,oo.init(e,t)}),xo=V(`$ZodISOTime`,(e,t)=>{t.pattern??=Aa(t),oo.init(e,t)}),So=V(`$ZodISODuration`,(e,t)=>{t.pattern??=pa,oo.init(e,t)}),Co=V(`$ZodIPv4`,(e,t)=>{t.pattern??=ya,oo.init(e,t),e._zod.bag.format=`ipv4`}),wo=V(`$ZodIPv6`,(e,t)=>{t.pattern??=ba,oo.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),To=V(`$ZodCIDRv4`,(e,t)=>{t.pattern??=xa,oo.init(e,t)}),Eo=V(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Sa,oo.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Do(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Oo=V(`$ZodBase64`,(e,t)=>{t.pattern??=Ca,oo.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Do(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ko(e){if(!wa.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Do(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ao=V(`$ZodBase64URL`,(e,t)=>{t.pattern??=wa,oo.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ko(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),jo=V(`$ZodE164`,(e,t)=>{t.pattern??=Ea,oo.init(e,t)});function Mo(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var No=V(`$ZodJWT`,(e,t)=>{oo.init(e,t),e._zod.check=n=>{Mo(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Po=V(`$ZodNumber`,(e,t)=>{io.init(e,t),e._zod.pattern=e._zod.bag.pattern??Pa,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Fo=V(`$ZodNumberFormat`,(e,t)=>{Wa.init(e,t),Po.init(e,t)}),Io=V(`$ZodBoolean`,(e,t)=>{io.init(e,t),e._zod.pattern=Fa,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Lo=V(`$ZodNull`,(e,t)=>{io.init(e,t),e._zod.pattern=Ia,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Ro=V(`$ZodUnknown`,(e,t)=>{io.init(e,t),e._zod.parse=e=>e}),zo=V(`$ZodNever`,(e,t)=>{io.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Bo(e,t,n){e.issues.length&&t.issues.push(...Li(n,e.issues)),t.value[n]=e.value}var Vo=V(`$ZodArray`,(e,t)=>{io.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Bo(t,n,e))):Bo(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Ho(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Li(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Uo(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ei(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Wo(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ho(e,n,i,t,u,d))):Ho(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Go=V(`$ZodObject`,(e,t)=>{if(io.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=ci(()=>Uo(t));pi(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=yi,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Ho(n,t,e,s,r,i))):Ho(a,t,e,s,r,i)}return i?Wo(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ko=V(`$ZodObjectJIT`,(e,t)=>{Go.init(e,t);let n=e._zod.parse,r=ci(()=>Uo(t)),i=e=>{let t=new no([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=gi(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=gi(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
12
|
+
if (${n}.issues.length) {
|
|
13
|
+
if (${o} in input) {
|
|
14
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
15
|
+
...iss,
|
|
16
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
17
|
+
})));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (${n}.value === undefined) {
|
|
22
|
+
if (${o} in input) {
|
|
23
|
+
newResult[${o}] = undefined;
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
newResult[${o}] = ${n}.value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
`):c?t.write(`
|
|
30
|
+
if (${n}.issues.length) {
|
|
31
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
32
|
+
...iss,
|
|
33
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (${n}.value === undefined) {
|
|
38
|
+
if (${o} in input) {
|
|
39
|
+
newResult[${o}] = undefined;
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
newResult[${o}] = ${n}.value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
`):t.write(`
|
|
46
|
+
const ${n}_present = ${o} in input;
|
|
47
|
+
if (${n}.issues.length) {
|
|
48
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
49
|
+
...iss,
|
|
50
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
54
|
+
payload.issues.push({
|
|
55
|
+
code: "invalid_type",
|
|
56
|
+
expected: "nonoptional",
|
|
57
|
+
input: undefined,
|
|
58
|
+
path: [${o}]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (${n}_present) {
|
|
63
|
+
if (${n}.value === undefined) {
|
|
64
|
+
newResult[${o}] = undefined;
|
|
65
|
+
} else {
|
|
66
|
+
newResult[${o}] = ${n}.value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=yi,s=!ii.jitless,c=s&&bi.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Wo([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function qo(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=>!Fi(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=>zi(e,r,ai())))}),t)}var Jo=V(`$ZodUnion`,(e,t)=>{io.init(e,t),pi(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),pi(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),pi(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),pi(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ui(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=>qo(t,r,e,i)):qo(o,r,e,i)}}),Yo=V(`$ZodIntersection`,(e,t)=>{io.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])=>Zo(e,t,n)):Zo(e,i,a)}});function Xo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(xi(e)&&xi(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Xo(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=Xo(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 Zo(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Fi(e))return e;let o=Xo(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Qo=V(`$ZodRecord`,(e,t)=>{io.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!xi(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>zi(e,r,ai())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Li(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Li(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Pa.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>zi(e,r,ai())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Li(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Li(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),$o=V(`$ZodEnum`,(e,t)=>{io.init(e,t);let n=oi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ci.has(typeof e)).map(e=>typeof e==`string`?wi(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),es=V(`$ZodTransform`,(e,t)=>{io.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ri(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new ni;return n.value=i,n.fallback=!0,n}});function ts(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var ns=V(`$ZodOptional`,(e,t)=>{io.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,pi(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),pi(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ui(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>ts(e,r)):ts(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),rs=V(`$ZodExactOptional`,(e,t)=>{ns.init(e,t),pi(e._zod,`values`,()=>t.innerType._zod.values),pi(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),is=V(`$ZodNullable`,(e,t)=>{io.init(e,t),pi(e._zod,`optin`,()=>t.innerType._zod.optin),pi(e._zod,`optout`,()=>t.innerType._zod.optout),pi(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ui(e.source)}|null)$`):void 0}),pi(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),as=V(`$ZodDefault`,(e,t)=>{io.init(e,t),e._zod.optin=`optional`,pi(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>os(e,t)):os(r,t)}});function os(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ss=V(`$ZodPrefault`,(e,t)=>{io.init(e,t),e._zod.optin=`optional`,pi(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),cs=V(`$ZodNonOptional`,(e,t)=>{io.init(e,t),pi(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ls(t,e)):ls(i,e)}});function ls(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var us=V(`$ZodCatch`,(e,t)=>{io.init(e,t),e._zod.optin=`optional`,pi(e._zod,`optout`,()=>t.innerType._zod.optout),pi(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>zi(e,n,ai()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>zi(e,n,ai()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),ds=V(`$ZodPipe`,(e,t)=>{io.init(e,t),pi(e._zod,`values`,()=>t.in._zod.values),pi(e._zod,`optin`,()=>t.in._zod.optin),pi(e._zod,`optout`,()=>t.out._zod.optout),pi(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>fs(e,t.in,n)):fs(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>fs(e,t.out,n)):fs(r,t.out,n)}});function fs(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var ps=V(`$ZodPreprocess`,(e,t)=>{ds.init(e,t)}),ms=V(`$ZodReadonly`,(e,t)=>{io.init(e,t),pi(e._zod,`propValues`,()=>t.innerType._zod.propValues),pi(e._zod,`values`,()=>t.innerType._zod.values),pi(e._zod,`optin`,()=>t.innerType?._zod?.optin),pi(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(hs):hs(r)}});function hs(e){return e.value=Object.freeze(e.value),e}var gs=V(`$ZodCustom`,(e,t)=>{za.init(e,t),io.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=>_s(t,n,r,e));_s(i,n,r,e)}});function _s(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(Vi(e))}}var vs,ys=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 bs(){return new ys}(vs=globalThis).__zod_globalRegistry??(vs.__zod_globalRegistry=bs());var xs=globalThis.__zod_globalRegistry;function Ss(e,t){return new e({type:`string`,...H(t)})}function Cs(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...H(t)})}function ws(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...H(t)})}function Ts(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...H(t)})}function Es(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...H(t)})}function Ds(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...H(t)})}function Os(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...H(t)})}function ks(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...H(t)})}function As(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...H(t)})}function js(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...H(t)})}function Ms(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...H(t)})}function Ns(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...H(t)})}function Ps(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...H(t)})}function Fs(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...H(t)})}function Is(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...H(t)})}function Ls(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...H(t)})}function Rs(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...H(t)})}function zs(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...H(t)})}function Bs(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...H(t)})}function Vs(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...H(t)})}function Hs(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...H(t)})}function Us(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...H(t)})}function Ws(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...H(t)})}function Gs(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...H(t)})}function Ks(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...H(t)})}function qs(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...H(t)})}function Js(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...H(t)})}function Ys(e,t){return new e({type:`number`,checks:[],...H(t)})}function Xs(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...H(t)})}function Zs(e,t){return new e({type:`boolean`,...H(t)})}function Qs(e,t){return new e({type:`null`,...H(t)})}function $s(e){return new e({type:`unknown`})}function ec(e,t){return new e({type:`never`,...H(t)})}function tc(e,t){return new Va({check:`less_than`,...H(t),value:e,inclusive:!1})}function nc(e,t){return new Va({check:`less_than`,...H(t),value:e,inclusive:!0})}function rc(e,t){return new Ha({check:`greater_than`,...H(t),value:e,inclusive:!1})}function ic(e,t){return new Ha({check:`greater_than`,...H(t),value:e,inclusive:!0})}function ac(e,t){return new Ua({check:`multiple_of`,...H(t),value:e})}function oc(e,t){return new Ga({check:`max_length`,...H(t),maximum:e})}function sc(e,t){return new Ka({check:`min_length`,...H(t),minimum:e})}function cc(e,t){return new qa({check:`length_equals`,...H(t),length:e})}function lc(e,t){return new Ya({check:`string_format`,format:`regex`,...H(t),pattern:e})}function uc(e){return new Xa({check:`string_format`,format:`lowercase`,...H(e)})}function dc(e){return new Za({check:`string_format`,format:`uppercase`,...H(e)})}function fc(e,t){return new Qa({check:`string_format`,format:`includes`,...H(t),includes:e})}function pc(e,t){return new $a({check:`string_format`,format:`starts_with`,...H(t),prefix:e})}function mc(e,t){return new eo({check:`string_format`,format:`ends_with`,...H(t),suffix:e})}function hc(e){return new to({check:`overwrite`,tx:e})}function gc(e){return hc(t=>t.normalize(e))}function _c(){return hc(e=>e.trim())}function vc(){return hc(e=>e.toLowerCase())}function yc(){return hc(e=>e.toUpperCase())}function bc(){return hc(e=>_i(e))}function xc(e,t,n){return new e({type:`array`,element:t,...H(n)})}function Sc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...H(n)})}function Cc(e,t){let n=wc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Vi(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Vi(r))}},e(t.value,t)),t);return n}function wc(e,t){let n=new za({check:`custom`,...H(t)});return n._zod.check=e,n}function Tc(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??xs,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ec(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ec(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&kc(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 Dc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
71
|
+
|
|
72
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Oc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:jc(t,`input`,e.processors),output:jc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function kc(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 kc(r.element,n);if(r.type===`set`)return kc(r.valueType,n);if(r.type===`lazy`)return kc(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return kc(r.innerType,n);if(r.type===`intersection`)return kc(r.left,n)||kc(r.right,n);if(r.type===`record`||r.type===`map`)return kc(r.keyType,n)||kc(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:kc(r.in,n)||kc(r.out,n);if(r.type===`object`){for(let e in r.shape)if(kc(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(kc(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(kc(e,n))return!0;return!!(r.rest&&kc(r.rest,n))}return!1}var Ac=(e,t={})=>n=>{let r=Tc({...n,processors:t});return Ec(e,r),Dc(r,e),Oc(r,e)},jc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Tc({...i??{},target:a,io:t,processors:n});return Ec(e,o),Dc(o,e),Oc(o,e)},Mc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Nc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Mc[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Pc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Fc=(e,t,n,r)=>{n.type=`boolean`},Ic=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Lc=(e,t,n,r)=>{n.not={}},Rc=(e,t,n,r)=>{let i=e._zod.def,a=oi(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},zc=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Bc=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Vc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ec(a.element,t,{...r,path:[...r.path,`items`]})},Hc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ec(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ec(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Uc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ec(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Wc=(e,t,n,r)=>{let i=e._zod.def,a=Ec(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ec(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Gc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ec(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ec(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ec(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Kc=(e,t,n,r)=>{let i=e._zod.def,a=Ec(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`}]},qc=(e,t,n,r)=>{let i=e._zod.def;Ec(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Jc=(e,t,n,r)=>{let i=e._zod.def;Ec(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Yc=(e,t,n,r)=>{let i=e._zod.def;Ec(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Xc=(e,t,n,r)=>{let i=e._zod.def;Ec(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Zc=(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;Ec(o,t,r);let s=t.seen.get(e);s.ref=o},Qc=(e,t,n,r)=>{let i=e._zod.def;Ec(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},$c=(e,t,n,r)=>{let i=e._zod.def;Ec(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},el=V(`ZodISODateTime`,(e,t)=>{yo.init(e,t),El.init(e,t)});function tl(e){return Gs(el,e)}var nl=V(`ZodISODate`,(e,t)=>{bo.init(e,t),El.init(e,t)});function rl(e){return Ks(nl,e)}var il=V(`ZodISOTime`,(e,t)=>{xo.init(e,t),El.init(e,t)});function al(e){return qs(il,e)}var ol=V(`ZodISODuration`,(e,t)=>{So.init(e,t),El.init(e,t)});function sl(e){return Js(ol,e)}var cl=V(`ZodError`,(e,t)=>{Ui.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ki(e,t)},flatten:{value:t=>Gi(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,si,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,si,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ll=qi(cl),ul=Ji(cl),dl=Yi(cl),fl=Zi(cl),pl=$i(cl),ml=ea(cl),hl=ta(cl),gl=na(cl),_l=ra(cl),vl=ia(cl),yl=aa(cl),bl=oa(cl),xl=new WeakMap;function Sl(e,t,n){let r=Object.getPrototypeOf(e),i=xl.get(r);if(i||(i=new Set,xl.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Cl=V(`ZodType`,(e,t)=>(io.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:jc(e,`input`),output:jc(e,`output`)}}),e.toJSONSchema=Ac(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>ll(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>dl(e,t,n),e.parseAsync=async(t,n)=>ul(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>fl(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>pl(e,t,n),e.decode=(t,n)=>ml(e,t,n),e.encodeAsync=async(t,n)=>hl(e,t,n),e.decodeAsync=async(t,n)=>gl(e,t,n),e.safeEncode=(t,n)=>_l(e,t,n),e.safeDecode=(t,n)=>vl(e,t,n),e.safeEncodeAsync=async(t,n)=>yl(e,t,n),e.safeDecodeAsync=async(t,n)=>bl(e,t,n),Sl(e,`ZodType`,{check(...e){let t=this.def;return this.clone(hi(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 Ti(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ru(e,t))},superRefine(e,t){return this.check(zu(e,t))},overwrite(e){return this.check(hc(e))},optional(){return yu(this)},exactOptional(){return xu(this)},nullable(){return Cu(this)},nullish(){return yu(Cu(this))},nonoptional(e){return ku(this,e)},array(){return iu(this)},or(e){return cu([this,e])},and(e){return uu(this,e)},transform(e){return Nu(this,_u(e))},default(e){return Tu(this,e)},prefault(e){return Du(this,e)},catch(e){return ju(this,e)},pipe(e){return Nu(this,e)},readonly(){return Iu(this)},describe(e){let t=this.clone();return xs.add(t,{description:e}),t},meta(...e){if(e.length===0)return xs.get(this);let t=this.clone();return xs.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return xs.get(e)?.description},configurable:!0}),e)),wl=V(`_ZodString`,(e,t)=>{ao.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nc(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Sl(e,`_ZodString`,{regex(...e){return this.check(lc(...e))},includes(...e){return this.check(fc(...e))},startsWith(...e){return this.check(pc(...e))},endsWith(...e){return this.check(mc(...e))},min(...e){return this.check(sc(...e))},max(...e){return this.check(oc(...e))},length(...e){return this.check(cc(...e))},nonempty(...e){return this.check(sc(1,...e))},lowercase(e){return this.check(uc(e))},uppercase(e){return this.check(dc(e))},trim(){return this.check(_c())},normalize(...e){return this.check(gc(...e))},toLowerCase(){return this.check(vc())},toUpperCase(){return this.check(yc())},slugify(){return this.check(bc())}})}),Tl=V(`ZodString`,(e,t)=>{ao.init(e,t),wl.init(e,t),e.email=t=>e.check(Cs(Dl,t)),e.url=t=>e.check(ks(Al,t)),e.jwt=t=>e.check(Ws(Gl,t)),e.emoji=t=>e.check(As(jl,t)),e.guid=t=>e.check(ws(Ol,t)),e.uuid=t=>e.check(Ts(kl,t)),e.uuidv4=t=>e.check(Es(kl,t)),e.uuidv6=t=>e.check(Ds(kl,t)),e.uuidv7=t=>e.check(Os(kl,t)),e.nanoid=t=>e.check(js(Ml,t)),e.guid=t=>e.check(ws(Ol,t)),e.cuid=t=>e.check(Ms(Nl,t)),e.cuid2=t=>e.check(Ns(Pl,t)),e.ulid=t=>e.check(Ps(Fl,t)),e.base64=t=>e.check(Vs(Hl,t)),e.base64url=t=>e.check(Hs(Ul,t)),e.xid=t=>e.check(Fs(Il,t)),e.ksuid=t=>e.check(Is(Ll,t)),e.ipv4=t=>e.check(Ls(Rl,t)),e.ipv6=t=>e.check(Rs(zl,t)),e.cidrv4=t=>e.check(zs(Bl,t)),e.cidrv6=t=>e.check(Bs(Vl,t)),e.e164=t=>e.check(Us(Wl,t)),e.datetime=t=>e.check(tl(t)),e.date=t=>e.check(rl(t)),e.time=t=>e.check(al(t)),e.duration=t=>e.check(sl(t))});function U(e){return Ss(Tl,e)}var El=V(`ZodStringFormat`,(e,t)=>{oo.init(e,t),wl.init(e,t)}),Dl=V(`ZodEmail`,(e,t)=>{lo.init(e,t),El.init(e,t)}),Ol=V(`ZodGUID`,(e,t)=>{so.init(e,t),El.init(e,t)}),kl=V(`ZodUUID`,(e,t)=>{co.init(e,t),El.init(e,t)}),Al=V(`ZodURL`,(e,t)=>{uo.init(e,t),El.init(e,t)}),jl=V(`ZodEmoji`,(e,t)=>{fo.init(e,t),El.init(e,t)}),Ml=V(`ZodNanoID`,(e,t)=>{po.init(e,t),El.init(e,t)}),Nl=V(`ZodCUID`,(e,t)=>{mo.init(e,t),El.init(e,t)}),Pl=V(`ZodCUID2`,(e,t)=>{ho.init(e,t),El.init(e,t)}),Fl=V(`ZodULID`,(e,t)=>{go.init(e,t),El.init(e,t)}),Il=V(`ZodXID`,(e,t)=>{_o.init(e,t),El.init(e,t)}),Ll=V(`ZodKSUID`,(e,t)=>{vo.init(e,t),El.init(e,t)}),Rl=V(`ZodIPv4`,(e,t)=>{Co.init(e,t),El.init(e,t)}),zl=V(`ZodIPv6`,(e,t)=>{wo.init(e,t),El.init(e,t)}),Bl=V(`ZodCIDRv4`,(e,t)=>{To.init(e,t),El.init(e,t)}),Vl=V(`ZodCIDRv6`,(e,t)=>{Eo.init(e,t),El.init(e,t)}),Hl=V(`ZodBase64`,(e,t)=>{Oo.init(e,t),El.init(e,t)}),Ul=V(`ZodBase64URL`,(e,t)=>{Ao.init(e,t),El.init(e,t)}),Wl=V(`ZodE164`,(e,t)=>{jo.init(e,t),El.init(e,t)}),Gl=V(`ZodJWT`,(e,t)=>{No.init(e,t),El.init(e,t)}),Kl=V(`ZodNumber`,(e,t)=>{Po.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pc(e,t,n,r),Sl(e,`ZodNumber`,{gt(e,t){return this.check(rc(e,t))},gte(e,t){return this.check(ic(e,t))},min(e,t){return this.check(ic(e,t))},lt(e,t){return this.check(tc(e,t))},lte(e,t){return this.check(nc(e,t))},max(e,t){return this.check(nc(e,t))},int(e){return this.check(Jl(e))},safe(e){return this.check(Jl(e))},positive(e){return this.check(rc(0,e))},nonnegative(e){return this.check(ic(0,e))},negative(e){return this.check(tc(0,e))},nonpositive(e){return this.check(nc(0,e))},multipleOf(e,t){return this.check(ac(e,t))},step(e,t){return this.check(ac(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function W(e){return Ys(Kl,e)}var ql=V(`ZodNumberFormat`,(e,t)=>{Fo.init(e,t),Kl.init(e,t)});function Jl(e){return Xs(ql,e)}var Yl=V(`ZodBoolean`,(e,t)=>{Io.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fc(e,t,n,r)});function Xl(e){return Zs(Yl,e)}var Zl=V(`ZodNull`,(e,t)=>{Lo.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r)});function Ql(e){return Qs(Zl,e)}var $l=V(`ZodUnknown`,(e,t)=>{Ro.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function eu(){return $s($l)}var tu=V(`ZodNever`,(e,t)=>{zo.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r)});function nu(e){return ec(tu,e)}var ru=V(`ZodArray`,(e,t)=>{Vo.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.element=t.element,Sl(e,`ZodArray`,{min(e,t){return this.check(sc(e,t))},nonempty(e){return this.check(sc(1,e))},max(e,t){return this.check(oc(e,t))},length(e,t){return this.check(cc(e,t))},unwrap(){return this.element}})});function iu(e,t){return xc(ru,e,t)}var au=V(`ZodObject`,(e,t)=>{Ko.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r),pi(e,`shape`,()=>t.shape),Sl(e,`ZodObject`,{keyof(){return hu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:eu()})},loose(){return this.clone({...this._zod.def,catchall:eu()})},strict(){return this.clone({...this._zod.def,catchall:nu()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Ai(this,e)},safeExtend(e){return ji(this,e)},merge(e){return Mi(this,e)},pick(e){return Oi(this,e)},omit(e){return ki(this,e)},partial(...e){return Ni(vu,this,e[0])},required(...e){return Pi(Ou,this,e[0])}})});function ou(e,t){return new au({type:`object`,shape:e??{},...H(t)})}var su=V(`ZodUnion`,(e,t)=>{Jo.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r),e.options=t.options});function cu(e,t){return new su({type:`union`,options:e,...H(t)})}var lu=V(`ZodIntersection`,(e,t)=>{Yo.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r)});function uu(e,t){return new lu({type:`intersection`,left:e,right:t})}var du=V(`ZodRecord`,(e,t)=>{Qo.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function fu(e,t,n){return!t||!t._zod?new du({type:`record`,keyType:U(),valueType:e,...H(t)}):new du({type:`record`,keyType:e,valueType:t,...H(n)})}function pu(e,t,n){let r=Ti(e);return r._zod.values=void 0,new du({type:`record`,keyType:r,valueType:t,...H(n)})}var mu=V(`ZodEnum`,(e,t)=>{$o.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new mu({...t,checks:[],...H(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 mu({...t,checks:[],...H(r),entries:i})}});function hu(e,t){return new mu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...H(t)})}var gu=V(`ZodTransform`,(e,t)=>{es.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ri(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Vi(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Vi(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function _u(e){return new gu({type:`transform`,transform:e})}var vu=V(`ZodOptional`,(e,t)=>{ns.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yu(e){return new vu({type:`optional`,innerType:e})}var bu=V(`ZodExactOptional`,(e,t)=>{rs.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xu(e){return new bu({type:`optional`,innerType:e})}var Su=V(`ZodNullable`,(e,t)=>{is.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cu(e){return new Su({type:`nullable`,innerType:e})}var wu=V(`ZodDefault`,(e,t)=>{as.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Tu(e,t){return new wu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Si(t)}})}var Eu=V(`ZodPrefault`,(e,t)=>{ss.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Du(e,t){return new Eu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Si(t)}})}var Ou=V(`ZodNonOptional`,(e,t)=>{cs.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ku(e,t){return new Ou({type:`nonoptional`,innerType:e,...H(t)})}var Au=V(`ZodCatch`,(e,t)=>{us.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ju(e,t){return new Au({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Mu=V(`ZodPipe`,(e,t)=>{ds.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zc(e,t,n,r),e.in=t.in,e.out=t.out});function Nu(e,t){return new Mu({type:`pipe`,in:e,out:t})}var Pu=V(`ZodPreprocess`,(e,t)=>{Mu.init(e,t),ps.init(e,t)}),Fu=V(`ZodReadonly`,(e,t)=>{ms.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Iu(e){return new Fu({type:`readonly`,innerType:e})}var Lu=V(`ZodCustom`,(e,t)=>{gs.init(e,t),Cl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r)});function Ru(e,t={}){return Sc(Lu,e,t)}function zu(e,t){return Cc(e,t)}function Bu(e,t){return new Pu({type:`pipe`,in:_u(e),out:t})}var Vu=[`chat`,`waypoint`,`converge`,`research`,`implement`,`review`,`prepare`,`project`,`smoke`],Hu=hu(Vu),Uu=[`claude-code`,`codex`],Wu=hu(Uu),Gu=`claude-code`,Ku=ou({id:U().min(1),runtime:Wu,note:U().optional()}),qu={"claude-code":{flagship:`claude-opus-5`,smoke:`claude-haiku-4-5`},codex:{flagship:`gpt-5.6-sol`,smoke:`gpt-5.6-luna`}},Ju=[{id:`claude-opus-5`,runtime:`claude-code`},{id:`claude-opus-5[1m]`,runtime:`claude-code`},{id:`claude-sonnet-5`,runtime:`claude-code`},{id:`claude-sonnet-5[1m]`,runtime:`claude-code`},{id:`claude-fable-5`,runtime:`claude-code`},{id:`claude-fable-5[1m]`,runtime:`claude-code`},{id:`claude-opus-4-8`,runtime:`claude-code`},{id:`claude-haiku-4-5`,runtime:`claude-code`},{id:`gpt-5.6-sol`,runtime:`codex`},{id:`gpt-5.6-terra`,runtime:`codex`},{id:`gpt-5.6-luna`,runtime:`codex`}],Yu=qu[Gu].smoke;Bu(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e},n=t.smokeModel;if(typeof n==`string`&&n.length>0){let e=typeof t.stepModels==`object`&&t.stepModels!==null&&!Array.isArray(t.stepModels)?t.stepModels:{};e.smoke===void 0&&(t.stepModels={...e,smoke:n})}return delete t.smokeModel,t},ou({serverPort:W().default(4512),model:U().default(qu[Gu].flagship),stepModels:pu(Hu,U()).default({smoke:Yu}),models:iu(Ku).default([]),sandbox:hu([`docker`,`podman`,`noSandbox`]).default(`docker`),sessionMcp:hu([`inherit`,`runcastleOnly`]).default(`inherit`),sandboxImage:U().optional(),burnConcurrency:W().int().min(1).max(8).default(3),burnCpus:W().positive().max(256).optional(),burnGuard:Xl().default(!0),burnMaxIterations:W().int().min(1).max(10).default(3),burnAttempts:W().int().min(1).max(5).default(3),burnConflictAttempts:W().int().min(0).max(3).default(2),setupCommand:U().optional(),verifyCommands:U().optional(),knownFailures:U().optional(),burnWorkspace:hu([`auto`,`mounted`,`isolated`]).default(`auto`),burnCache:hu([`volume`,`off`]).default(`volume`)}));function Xu(e,t){let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>n.get(e.id)??e),i=new Set(e.map(e=>e.id));return[...r,...t.filter(e=>!i.has(e.id))]}function Zu(e){return Xu(Xu(Ju,e.discovered??[]),e.models??[])}function Qu(e){return Uu.flatMap(t=>e.sources[t].models.map(({id:e})=>({id:e,runtime:t})))}function $u(e,t){return Zu(t).find(t=>t.id===e)??{id:e,runtime:`claude-code`}}var ed=hu([`planning`,`building`,`review`,`shipped`]);function td(e){let t=ed.safeParse(e);return t.success?t.data:null}var nd=hu([`pending`,`burning`,`done`,`failed`,`cancelled`]),rd=hu([`chat`,`waypoint`,`converge`,`prepare`,`project`,`drive-fix`]),id=hu([`resolve-conflict`]),ad=ou({mergeFrom:U(),mergeInto:U()}),od=hu([`running`,`succeeded`,`failed`,`cancelled`]),sd=hu([`draft`,`active`,`shipped`,`archived`]),cd=hu([`launching`,`live`,`ended`]),ld=hu([`implementation`,`review`]),ud=hu([`defect`,`observation`]),dd=hu([`high`,`medium`,`low`]),fd=hu([`open`,`fixing`,`fixed`,`failed`,`dismissed`,`carried`]),pd=hu([`over-cap`,`fix-failed`,`verification`]),md=hu([`fix-ticket`,`session`]);ou({kind:ud,severity:dd,title:U().min(1),location:U().min(1),citation:U().min(1),detail:U().min(1),reproStep:U().optional()}).superRefine((e,t)=>{e.kind===`defect`&&!e.reproStep?.trim()&&t.addIssue({code:`custom`,path:[`reproStep`],message:`defects require a repro step`})}).safeExtend({id:U(),featureId:U(),lap:W(),reviewTicketId:U(),reproStep:U(),status:fd,openReason:pd.nullable(),failureReason:U().nullable(),fixTicketId:U().nullable(),carriedLap:W().nullable(),resolvedBy:md.nullable(),resolutionNote:U().nullable(),createdAt:W()}),ou({title:U(),goal:U(),context:U(),acceptanceCriteria:iu(U()),seams:iu(U()),blockedBy:iu(W()),kind:ld.default(`implementation`),passKind:hu([`review`,`verification`]).default(`review`),model:U().optional(),originFindingId:U().optional()}).extend({id:U(),featureId:U(),seq:W(),status:nd,lap:W(),commits:iu(U()),reviewedCommit:U().nullable().default(null),reviewMode:hu([`drive`,`gates`]).nullable().optional(),reviewVerdict:hu([`verified`,`unverified`]).nullable().optional(),reviewVerdictReason:U().nullable().optional(),completedAt:W().nullable().default(null),error:U().optional(),attemptBranch:U().optional(),conflictFiles:iu(U()).optional(),digest:U().optional()});var hd=hu([`grilling`,`research`,`prototype`,`task`]),gd=hu([`open`,`claimed`,`resolved`,`dropped`]);hu([`resolved`,`dropped`]),ou({title:U(),type:hd,question:U(),blockedBy:iu(cu([W(),U()])),originWaypointId:U().optional()}).extend({id:U(),featureId:U(),seq:W(),blockedBy:iu(W()),status:gd,claimedBy:U().optional(),lastSessionId:U().optional(),summary:U().optional()});var _d=hu([`open`,`done`,`promoted`,`carried`]),vd=hu([`human`,`agent`]);ou({id:U(),featureId:U(),lap:W(),text:U(),status:_d,author:vd.default(`human`),ticketId:U().optional(),reviewTicketId:U().optional(),carriedLap:W().optional(),videoTimestamp:W().optional(),screenshotUrl:U().optional(),createdAt:W(),updatedAt:W()});var yd=hu([`open`,`triaged`]);ou({id:U(),projectId:U(),text:U(),status:yd,outcome:U().optional(),featureId:U().optional(),screenshotUrl:U().optional(),driveBranch:U().optional(),driveCommit:U().optional(),createdAt:W(),updatedAt:W()});var bd=[`setupCommand`,`verifyCommands`,`knownFailures`,`devCommand`,`driveSetupCommand`,`driveStopCommand`,`dbResetCommand`,`driveInstructions`];hu(bd);var xd=hu([...bd,`sandboxImage`]),Sd=[`devCommand`,`driveSetupCommand`,`driveStopCommand`],Cd=hu([`prep`,`human`,`session`,`build`]),wd=`runcastle:`;U().min(1,`a project needs a name`).max(80,`a project name can be at most 80 characters`),ou({id:U(),name:U(),repoPath:U(),sessionBranch:U().optional(),devCommand:U().optional(),model:U().optional(),sandboxImage:U().optional(),setupCommand:U().optional(),verifyCommands:U().optional(),knownFailures:U().optional(),dbResetCommand:U().optional(),driveSetupCommand:U().optional(),driveStopCommand:U().optional(),driveInstructions:U().optional(),docsCommitPrefix:U().optional(),closedAt:W().optional()}),ou({key:xd,source:Cd,evidence:U().optional(),establishedAt:W(),establishedSha:U().optional(),staleCommits:W().optional(),verifiedAt:W().optional(),verifiedSha:U().optional()}),ou({id:U(),projectId:U(),slug:U(),title:U(),oneLiner:U(),brief:U().optional(),mapped:Xl(),lap:W(),ticketsReadyLap:W().nullable(),phase:ed,branch:U(),baseBranch:U().optional(),status:sd,createdAt:W()}),ou({id:U(),featureId:U().optional(),projectId:U().optional(),lap:W(),kind:rd,purpose:id.optional(),purposeData:ad.optional(),ccSessionId:U().optional(),transcriptPath:U().optional(),status:cd,awaitingInput:Xl(),worktreePath:U(),model:U().optional(),runtime:Wu.optional(),title:U().nullable().optional(),transcriptMissing:Xl().optional(),createdAt:W().optional(),endedAt:W().optional()}),ou({id:U(),featureId:U(),workflow:U(),status:od,startedAt:W(),endedAt:W().optional(),summary:U().optional(),digest:U().optional()});var Td=hu([`env`,`project`,`file`,`default`]),Ed=hu([`global`,`project`]),Dd=ou({key:U(),value:eu(),source:Td,editable:Xl(),restartRequired:Xl(),scope:Ed}),Od=ou({id:U().min(1),runtime:Wu,displayName:U().optional(),description:U().optional(),retirement:ou({at:U(),replacement:U()}).optional()}),kd=ou({sources:fu(Wu,ou({status:hu([`never`,`ok`,`failed`]),lastSuccessAt:W().optional(),lastAttemptAt:W().optional(),error:U().optional(),models:iu(Od),newIds:iu(U()),knownIds:iu(U()).default([])}))}),Ad=()=>({status:`never`,models:[],newIds:[],knownIds:[]}),jd={sources:{"claude-code":Ad(),codex:Ad()}};ou({projectId:U().optional(),fields:iu(Dd),discovery:kd}),ou({projectId:U().optional(),key:U(),value:cu([U(),W(),Xl(),iu(Ku),Ql()])}),ou({id:W(),projectId:U(),featureId:U().optional(),runId:U().optional(),ticketId:U().optional(),ts:W(),type:U(),message:U(),data:eu().optional()}),hu([`idle`,`starting`,`serving`,`bare-checkout`,`setup-failed`,`review-agent-driving`]);function Md(e){let t=null;for(let n of e)if(n.type===`merge.conflict`){let e=n.data??{};t={base:typeof e.base==`string`?e.base:``,files:Array.isArray(e.files)?e.files.filter(e=>typeof e==`string`):[],at:n.ts}}else[`burn.started`,`merge.resolved`,`feature.shipped`].includes(n.type)&&(t=null);return t}var Nd=`/api/reviews`,Pd=`/:featureId`;function Fd(e){return`${Nd}${Pd.replace(`:featureId`,encodeURIComponent(e))}`}var Id=`/note/:noteId/screenshot`;`${Id}`;function Ld(e,t){return`${Nd}${e.replace(`:noteId`,encodeURIComponent(t))}`}function Rd(e){return Ld(Id,e)}var zd=`/project-note/:noteId/screenshot`;`${zd}`;function Bd(e){return Ld(zd,e)}function Vd(e){if(!Number.isFinite(e)||e<0)return`--:--`;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=n>0?String(r).padStart(2,`0`):String(r);return`${n>0?`${n}:`:``}${a}:${String(i).padStart(2,`0`)}`}var Hd=4e4;function Ud(e){return e.filter(e=>e.kind!==`review`)}function Wd(e){let t=[],n=Ud(e),r=n.filter(Jd);r.length>5&&t.push({code:`degenerate-batch`,message:`${r.length} tickets (${r.map(qd).join(`, `)}) carry their goal as their context — that is the quick-change door used as an importer. Work this size deserves a session first: shape it into a feature with a spec, or cut the batch to 5 tickets or fewer.`});for(let e of n){let n=e.context.trim();!Jd(e)&&n.length<300&&t.push({code:`thin-context`,message:`${qd(e)} has a ${n.length}-character context — under 300 there is nothing for a coder to read before it writes: name the files, the existing pattern to follow, and the evidence that proves it done.`}),Yd(n)&&t.push({code:`pasted-document`,message:`${qd(e)} has a ${n.length}-character context that reads like a pasted document — keep the ticket's own goal, context and acceptance criteria, and point at the doc for the rest.`})}return t}function Gd(e){return e<=4e4?null:{code:`oversized-docs-digest`,message:`the docs digest is ${e} bytes, over the ${Hd}-byte budget, and every ticket in this burn pays it — trim the feature docs, or move what only a ticket needs into that ticket.`}}function Kd(e,t=3){if(e.length===0)return;let n=e.slice(0,t),r=e.length-n.length;return`${n.map(e=>e.message).join(` `)}${r>0?` (+${r} more like this.)`:``}`}function qd(e){return`#${e.seq}`}function Jd(e){let t=e.context.trim();return t!==``&&t===e.goal.trim()}function Yd(e){return e.length<=1500?!1:/^\s{0,3}#{1,6}\s/m.test(e)}function Xd(e){return e.hasDecisions?e.hasSpec?e.hasTickets?null:`tickets`:`spec`:`ideation`}var G=Symbol.for(`drizzle:entityKind`);function Zd(e,t){if(!e||typeof e!=`object`)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,G))throw Error(`Class "${t.name??`<unknown>`}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(G in n&&n[G]===t[G])return!0;n=Object.getPrototypeOf(n)}return!1}var Qd=class{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[G]=`Column`;name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!==`byDefault`}},$d=class{static[G]=`ColumnBuilder`;config;constructor(e,t,n){this.config={name:e,keyAsName:e===``,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===``&&(this.config.name=e)}},ef=Symbol.for(`drizzle:Name`),tf=Symbol.for(`drizzle:isPgEnum`);function nf(e){return!!e&&typeof e==`function`&&tf in e&&e[tf]===!0}var rf=class{static[G]=`Subquery`;constructor(e,t,n,r=!1,i=[]){this._={brand:`Subquery`,sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}},af={startActiveSpan(e,t){return t()}},of=Symbol.for(`drizzle:ViewBaseConfig`),sf=Symbol.for(`drizzle:Schema`),cf=Symbol.for(`drizzle:Columns`),lf=Symbol.for(`drizzle:ExtraConfigColumns`),uf=Symbol.for(`drizzle:OriginalName`),df=Symbol.for(`drizzle:BaseName`),ff=Symbol.for(`drizzle:IsAlias`),pf=Symbol.for(`drizzle:ExtraConfigBuilder`),mf=Symbol.for(`drizzle:IsDrizzleTable`),hf=class{static[G]=`Table`;static Symbol={Name:ef,Schema:sf,OriginalName:uf,Columns:cf,ExtraConfigColumns:lf,BaseName:df,IsAlias:ff,ExtraConfigBuilder:pf};[ef];[uf];[sf];[cf];[lf];[df];[ff]=!1;[mf]=!0;[pf]=void 0;constructor(e,t,n){this[ef]=this[uf]=e,this[sf]=t,this[df]=n}};function gf(e){return e!=null&&typeof e.getSQL==`function`}function _f(e){let t={sql:``,params:[]};for(let n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||=[],t.typings.push(...n.typings));return t}var vf=class{static[G]=`StringChunk`;value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new yf([this])}},yf=class e{constructor(e){this.queryChunks=e;for(let t of e)if(Zd(t,hf)){let e=t[hf.Symbol.Schema];this.usedTables.push(e===void 0?t[hf.Symbol.Name]:e+`.`+t[hf.Symbol.Name])}}static[G]=`SQL`;decoder=xf;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return af.startActiveSpan(`drizzle.buildSQL`,t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(t,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:o,prepareTyping:s,inlineParams:c,paramStartIndex:l}=r;return _f(t.map(t=>{if(Zd(t,vf))return{sql:t.value.join(``),params:[]};if(Zd(t,bf))return{sql:a(t.value),params:[]};if(t===void 0)return{sql:``,params:[]};if(Array.isArray(t)){let e=[new vf(`(`)];for(let[n,r]of t.entries())e.push(r),n<t.length-1&&e.push(new vf(`, `));return e.push(new vf(`)`)),this.buildQueryFromSourceParams(e,r)}if(Zd(t,e))return this.buildQueryFromSourceParams(t.queryChunks,{...r,inlineParams:c||t.shouldInlineParams});if(Zd(t,hf)){let e=t[hf.Symbol.Schema],n=t[hf.Symbol.Name];return{sql:e===void 0||t[ff]?a(n):a(e)+`.`+a(n),params:[]}}if(Zd(t,Qd)){let e=i.getColumnCasing(t);if(n.invokeSource===`indexes`)return{sql:a(e),params:[]};let r=t.table[hf.Symbol.Schema];return{sql:t.table[ff]||r===void 0?a(t.table[hf.Symbol.Name])+`.`+a(e):a(r)+`.`+a(t.table[hf.Symbol.Name])+`.`+a(e),params:[]}}if(Zd(t,Df)){let e=t[of].schema,n=t[of].name;return{sql:e===void 0||t[of].isAlias?a(n):a(e)+`.`+a(n),params:[]}}if(Zd(t,Cf)){if(Zd(t.value,Tf))return{sql:o(l.value++,t),params:[t],typings:[`none`]};let n=t.value===null?null:t.encoder.mapToDriverValue(t.value);if(Zd(n,e))return this.buildQueryFromSourceParams([n],r);if(c)return{sql:this.mapInlineParam(n,r),params:[]};let i=[`none`];return s&&(i=[s(t.encoder)]),{sql:o(l.value++,n),params:[n],typings:i}}return Zd(t,Tf)?{sql:o(l.value++,t),params:[t],typings:[`none`]}:Zd(t,e.Aliased)&&t.fieldAlias!==void 0?{sql:a(t.fieldAlias),params:[]}:Zd(t,rf)?t._.isWith?{sql:a(t._.alias),params:[]}:this.buildQueryFromSourceParams([new vf(`(`),t._.sql,new vf(`) `),new bf(t._.alias)],r):nf(t)?t.schema?{sql:a(t.schema)+`.`+a(t.enumName),params:[]}:{sql:a(t.enumName),params:[]}:gf(t)?t.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([t.getSQL()],r):this.buildQueryFromSourceParams([new vf(`(`),t.getSQL(),new vf(`)`)],r):c?{sql:this.mapInlineParam(t,r),params:[]}:{sql:o(l.value++,t),params:[t],typings:[`none`]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return`null`;if(typeof e==`number`||typeof e==`boolean`)return e.toString();if(typeof e==`string`)return t(e);if(typeof e==`object`){let n=e.toString();return t(n===`[object Object]`?JSON.stringify(e):n)}throw Error(`Unexpected param value: `+e)}getSQL(){return this}as(t){return t===void 0?this:new e.Aliased(this,t)}mapWith(e){return this.decoder=typeof e==`function`?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}},bf=class{constructor(e){this.value=e}static[G]=`Name`;brand;getSQL(){return new yf([this])}},xf={mapFromDriverValue:e=>e},Sf={mapToDriverValue:e=>e};({...xf,...Sf});var Cf=class{constructor(e,t=Sf){this.value=e,this.encoder=t}static[G]=`Param`;brand;getSQL(){return new yf([this])}};function wf(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!==``)&&n.push(new vf(e[0]));for(let[r,i]of t.entries())n.push(i,new vf(e[r+1]));return new yf(n)}(e=>{function t(){return new yf([])}e.empty=t;function n(e){return new yf(e)}e.fromList=n;function r(e){return new yf([new vf(e)])}e.raw=r;function i(e,t){let n=[];for(let[r,i]of e.entries())r>0&&t!==void 0&&n.push(t),n.push(i);return new yf(n)}e.join=i;function a(e){return new bf(e)}e.identifier=a;function o(e){return new Tf(e)}e.placeholder=o;function s(e,t){return new Cf(e,t)}e.param=s})(wf||={}),(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static[G]=`SQL.Aliased`;isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(yf||={});var Tf=class{constructor(e){this.name=e}static[G]=`Placeholder`;getSQL(){return new yf([this])}},Ef=Symbol.for(`drizzle:IsDrizzleView`),Df=class{static[G]=`View`;[of];[Ef]=!0;constructor({name:e,schema:t,selectedFields:n,query:r}){this[of]={name:e,originalName:e,schema:t,selectedFields:n,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new yf([this])}};Qd.prototype.getSQL=function(){return new yf([this])},hf.prototype.getSQL=function(){return new yf([this])},rf.prototype.getSQL=function(){return new yf([this])};function Of(e,t){return{name:typeof e==`string`&&e.length>0?e:``,config:typeof e==`object`?e:t}}var kf=typeof TextDecoder>`u`?null:new TextDecoder,Af=class{static[G]=`SQLiteForeignKeyBuilder`;reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:n,foreignColumns:r}=e();return{name:t,columns:n,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new jf(e,this)}},jf=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[G]=`SQLiteForeignKey`;reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[ef],...r,n[0].table[ef],...i];return e??`${a.join(`_`)}_fk`}};function Mf(e,t){return`${e[ef]}_${t.join(`_`)}_unique`}var Nf=class extends $d{static[G]=`SQLiteColumnBuilder`;foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:`always`,mode:t?.mode??`virtual`},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>((n,r)=>{let i=new Af(()=>{let t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)})(n,r))}},Pf=class extends Qd{constructor(e,t){t.uniqueName||=Mf(e,[t.name]),super(e,t),this.table=e}static[G]=`SQLiteColumn`},Ff=class extends Nf{static[G]=`SQLiteBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteBigInt`)}build(e){return new If(e,this.config)}},If=class extends Pf{static[G]=`SQLiteBigInt`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString(`utf8`))}return BigInt(kf.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}},Lf=class extends Nf{static[G]=`SQLiteBlobJsonBuilder`;constructor(e){super(e,`json`,`SQLiteBlobJson`)}build(e){return new Rf(e,this.config)}},Rf=class extends Pf{static[G]=`SQLiteBlobJson`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString(`utf8`))}return JSON.parse(kf.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}},zf=class extends Nf{static[G]=`SQLiteBlobBufferBuilder`;constructor(e){super(e,`buffer`,`SQLiteBlobBuffer`)}build(e){return new Bf(e,this.config)}},Bf=class extends Pf{static[G]=`SQLiteBlobBuffer`;mapFromDriverValue(e){return Buffer.isBuffer(e)?e:Buffer.from(e)}getSQLType(){return`blob`}};function Vf(e,t){let{name:n,config:r}=Of(e,t);return r?.mode===`json`?new Lf(n):r?.mode===`bigint`?new Ff(n):new zf(n)}var Hf=class extends Nf{static[G]=`SQLiteCustomColumnBuilder`;constructor(e,t,n){super(e,`custom`,`SQLiteCustomColumn`),this.config.fieldConfig=t,this.config.customTypeParams=n}build(e){return new Uf(e,this.config)}},Uf=class extends Pf{static[G]=`SQLiteCustomColumn`;sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom==`function`?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo==`function`?this.mapTo(e):e}};function Wf(e){return(t,n)=>{let{name:r,config:i}=Of(t,n);return new Hf(r,i,e)}}var Gf=class extends Nf{static[G]=`SQLiteBaseIntegerBuilder`;constructor(e,t,n){super(e,t,n),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}},Kf=class extends Pf{static[G]=`SQLiteBaseInteger`;autoIncrement=this.config.autoIncrement;getSQLType(){return`integer`}},qf=class extends Gf{static[G]=`SQLiteIntegerBuilder`;constructor(e){super(e,`number`,`SQLiteInteger`)}build(e){return new Jf(e,this.config)}},Jf=class extends Kf{static[G]=`SQLiteInteger`},Yf=class extends Gf{static[G]=`SQLiteTimestampBuilder`;constructor(e,t){super(e,`date`,`SQLiteTimestamp`),this.config.mode=t}defaultNow(){return this.default(wf`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new Xf(e,this.config)}},Xf=class extends Kf{static[G]=`SQLiteTimestamp`;mode=this.config.mode;mapFromDriverValue(e){return this.config.mode===`timestamp`?new Date(e*1e3):new Date(e)}mapToDriverValue(e){let t=e.getTime();return this.config.mode===`timestamp`?Math.floor(t/1e3):t}},Zf=class extends Gf{static[G]=`SQLiteBooleanBuilder`;constructor(e,t){super(e,`boolean`,`SQLiteBoolean`),this.config.mode=t}build(e){return new Qf(e,this.config)}},Qf=class extends Kf{static[G]=`SQLiteBoolean`;mode=this.config.mode;mapFromDriverValue(e){return Number(e)===1}mapToDriverValue(e){return+!!e}};function $f(e,t){let{name:n,config:r}=Of(e,t);return r?.mode===`timestamp`||r?.mode===`timestamp_ms`?new Yf(n,r.mode):r?.mode===`boolean`?new Zf(n,r.mode):new qf(n)}var ep=class extends Nf{static[G]=`SQLiteNumericBuilder`;constructor(e){super(e,`string`,`SQLiteNumeric`)}build(e){return new tp(e,this.config)}},tp=class extends Pf{static[G]=`SQLiteNumeric`;mapFromDriverValue(e){return typeof e==`string`?e:String(e)}getSQLType(){return`numeric`}},np=class extends Nf{static[G]=`SQLiteNumericNumberBuilder`;constructor(e){super(e,`number`,`SQLiteNumericNumber`)}build(e){return new rp(e,this.config)}},rp=class extends Pf{static[G]=`SQLiteNumericNumber`;mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}mapToDriverValue=String;getSQLType(){return`numeric`}},ip=class extends Nf{static[G]=`SQLiteNumericBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteNumericBigInt`)}build(e){return new ap(e,this.config)}},ap=class extends Pf{static[G]=`SQLiteNumericBigInt`;mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return`numeric`}};function op(e,t){let{name:n,config:r}=Of(e,t),i=r?.mode;return i===`number`?new np(n):i===`bigint`?new ip(n):new ep(n)}var sp=class extends Nf{static[G]=`SQLiteRealBuilder`;constructor(e){super(e,`number`,`SQLiteReal`)}build(e){return new cp(e,this.config)}},cp=class extends Pf{static[G]=`SQLiteReal`;getSQLType(){return`real`}};function lp(e){return new sp(e??``)}var up=class extends Nf{static[G]=`SQLiteTextBuilder`;constructor(e,t){super(e,`string`,`SQLiteText`),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new dp(e,this.config)}},dp=class extends Pf{static[G]=`SQLiteText`;enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:``}`}},fp=class extends Nf{static[G]=`SQLiteTextJsonBuilder`;constructor(e){super(e,`json`,`SQLiteTextJson`)}build(e){return new pp(e,this.config)}},pp=class extends Pf{static[G]=`SQLiteTextJson`;getSQLType(){return`text`}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}};function K(e,t={}){let{name:n,config:r}=Of(e,t);return r.mode===`json`?new fp(n):new up(n,r)}function mp(){return{blob:Vf,customType:Wf,integer:$f,numeric:op,real:lp,text:K}}var hp=Symbol.for(`drizzle:SQLiteInlineForeignKeys`),gp=class extends hf{static[G]=`SQLiteTable`;static Symbol=Object.assign({},hf.Symbol,{InlineForeignKeys:hp});[hf.Symbol.Columns];[hp]=[];[hf.Symbol.ExtraConfigBuilder]=void 0};function _p(e,t,n,r,i=e){let a=new gp(e,r,i),o=typeof t==`function`?t(mp()):t,s=Object.fromEntries(Object.entries(o).map(([e,t])=>{let n=t;n.setName(e);let r=n.build(a);return a[hp].push(...n.buildForeignKeys(r,a)),[e,r]})),c=Object.assign(a,s);return c[hf.Symbol.Columns]=s,c[hf.Symbol.ExtraConfigColumns]=s,n&&(c[gp.Symbol.ExtraConfigBuilder]=n),c}var vp=(e,t,n)=>_p(e,t,n),yp=class{constructor(e,t){this.name=e,this.unique=t}static[G]=`SQLiteIndexBuilderOn`;on(...e){return new bp(this.name,e,this.unique)}},bp=class{static[G]=`SQLiteIndexBuilder`;config;constructor(e,t,n){this.config={name:e,columns:t,unique:n,where:void 0}}where(e){return this.config.where=e,this}build(e){return new xp(this.config,e)}},xp=class{static[G]=`SQLiteIndex`;config;constructor(e,t){this.config={...e,table:t}}};function Sp(e){return new yp(e,!1)}function Cp(...e){return e[0].columns?new wp(e[0].columns,e[0].name):new wp(e)}var wp=class{static[G]=`SQLitePrimaryKeyBuilder`;columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new Tp(e,this.columns,this.name)}},Tp=class{constructor(e,t,n){this.table=e,this.columns=t,this.name=n}static[G]=`SQLitePrimaryKey`;columns;name;getName(){return this.name??`${this.table[gp.Symbol.Name]}_${this.columns.map(e=>e.name).join(`_`)}_pk`}};vp(`projects`,{id:K(`id`).primaryKey(),name:K(`name`).notNull(),repoPath:K(`repo_path`).notNull(),sessionBranch:K(`session_branch`),devCommand:K(`dev_command`),model:K(`model`),sandbox:K(`sandbox`),sandboxImage:K(`sandbox_image`),closedAt:$f(`closed_at`),setupCommand:K(`setup_command`),verifyCommands:K(`verify_commands`),knownFailures:K(`known_failures`),dbResetCommand:K(`db_reset_command`),driveInstructions:K(`drive_instructions`),driveSetupCommand:K(`drive_setup_command`),driveStopCommand:K(`drive_stop_command`),docsCommitPrefix:K(`docs_commit_prefix`)}),vp(`project_findings`,{projectId:K(`project_id`).notNull(),key:K(`key`).notNull(),source:K(`source`).notNull().$type(),evidence:K(`evidence`),establishedAt:$f(`established_at`).notNull(),establishedSha:K(`established_sha`),verifiedAt:$f(`verified_at`),verifiedSha:K(`verified_sha`)},e=>[Cp({columns:[e.projectId,e.key]})]),vp(`features`,{id:K(`id`).primaryKey(),projectId:K(`project_id`).notNull(),slug:K(`slug`).notNull(),title:K(`title`).notNull(),oneLiner:K(`one_liner`).notNull(),brief:K(`brief`),mapped:$f(`mapped`,{mode:`boolean`}).notNull().default(!1),lap:$f(`lap`).notNull().default(1),ticketsReadyLap:$f(`tickets_ready_lap`),phase:K(`phase`).notNull().$type(),branch:K(`branch`).notNull(),baseBranch:K(`base_branch`),status:K(`status`).notNull().$type(),createdAt:$f(`created_at`).notNull()}),vp(`sessions`,{id:K(`id`).primaryKey(),featureId:K(`feature_id`),projectId:K(`project_id`),lap:$f(`lap`).notNull().default(1),kind:K(`kind`).notNull().$type(),purpose:K(`purpose`).$type(),purposeData:K(`purpose_data`,{mode:`json`}).$type(),ccSessionId:K(`cc_session_id`),transcriptPath:K(`transcript_path`),status:K(`status`).notNull().$type(),awaitingInput:$f(`awaiting_input`,{mode:`boolean`}).notNull().default(!1),worktreePath:K(`worktree_path`).notNull(),model:K(`model`),runtime:K(`runtime`).$type(),title:K(`title`),createdAt:$f(`created_at`),endedAt:$f(`ended_at`)}),vp(`tickets`,{id:K(`id`).primaryKey(),featureId:K(`feature_id`).notNull(),seq:$f(`seq`).notNull(),title:K(`title`).notNull(),goal:K(`goal`).notNull(),context:K(`context`).notNull(),acceptanceCriteria:K(`acceptance_criteria`,{mode:`json`}).notNull().$type(),seams:K(`seams`,{mode:`json`}).notNull().$type(),blockedBy:K(`blocked_by`,{mode:`json`}).notNull().$type(),kind:K(`kind`).notNull().$type().default(`implementation`),passKind:K(`pass_kind`).notNull().$type().default(`review`),reviewedCommit:K(`reviewed_commit`),reviewMode:K(`review_mode`).$type(),reviewVerdict:K(`review_verdict`).$type(),reviewVerdictReason:K(`review_verdict_reason`),completedAt:$f(`completed_at`),model:K(`model`),lap:$f(`lap`).notNull().default(1),status:K(`status`).notNull().$type(),commits:K(`commits`,{mode:`json`}).notNull().$type(),error:K(`error`),attemptBranch:K(`attempt_branch`),conflictFiles:K(`conflict_files`,{mode:`json`}).$type(),digest:K(`digest`),originFindingId:K(`origin_finding_id`)}),vp(`review_findings`,{id:K(`id`).primaryKey(),featureId:K(`feature_id`).notNull(),lap:$f(`lap`).notNull(),reviewTicketId:K(`review_ticket_id`).notNull(),kind:K(`kind`).notNull().$type(),severity:K(`severity`).notNull().$type(),title:K(`title`).notNull(),location:K(`location`).notNull(),citation:K(`citation`).notNull(),detail:K(`detail`).notNull(),reproStep:K(`repro_step`).notNull(),status:K(`status`).notNull().$type(),openReason:K(`open_reason`).$type(),failureReason:K(`failure_reason`),fixTicketId:K(`fix_ticket_id`),carriedLap:$f(`carried_lap`),resolvedBy:K(`resolved_by`).$type(),resolutionNote:K(`resolution_note`),createdAt:$f(`created_at`).notNull()}),vp(`test_notes`,{id:K(`id`).primaryKey(),featureId:K(`feature_id`).notNull(),lap:$f(`lap`).notNull(),text:K(`text`).notNull(),status:K(`status`).notNull().$type(),author:K(`author`).notNull().$type().default(`human`),ticketId:K(`ticket_id`),reviewTicketId:K(`review_ticket_id`),carriedLap:$f(`carried_lap`),videoTimestamp:lp(`video_timestamp`),createdAt:$f(`created_at`).notNull(),updatedAt:$f(`updated_at`).notNull()}),vp(`project_notes`,{id:K(`id`).primaryKey(),projectId:K(`project_id`).notNull(),text:K(`text`).notNull(),status:K(`status`).notNull().$type(),outcome:K(`outcome`),featureId:K(`feature_id`),driveBranch:K(`drive_branch`),driveCommit:K(`drive_commit`),createdAt:$f(`created_at`).notNull(),updatedAt:$f(`updated_at`).notNull()}),vp(`waypoints`,{id:K(`id`).primaryKey(),featureId:K(`feature_id`).notNull(),seq:$f(`seq`).notNull(),title:K(`title`).notNull(),type:K(`type`).notNull().$type(),question:K(`question`).notNull(),blockedBy:K(`blocked_by`,{mode:`json`}).notNull().$type(),originWaypointId:K(`origin_waypoint_id`),status:K(`status`).notNull().$type(),claimedBy:K(`claimed_by`),lastSessionId:K(`last_session_id`),summary:K(`summary`)}),vp(`runs`,{id:K(`id`).primaryKey(),featureId:K(`feature_id`).notNull(),workflow:K(`workflow`).notNull(),status:K(`status`).notNull().$type(),startedAt:$f(`started_at`).notNull(),endedAt:$f(`ended_at`),summary:K(`summary`),digest:K(`digest`)}),vp(`events`,{id:$f(`id`).primaryKey({autoIncrement:!0}),projectId:K(`project_id`).notNull(),featureId:K(`feature_id`),runId:K(`run_id`),ticketId:K(`ticket_id`),lap:$f(`lap`).notNull().default(1),ts:$f(`ts`).notNull(),type:K(`type`).notNull(),message:K(`message`).notNull(),data:K(`data`,{mode:`json`})},e=>[Sp(`events_project_id_id_idx`).on(e.projectId,e.id),Sp(`events_feature_id_id_idx`).on(e.featureId,e.id)]);var Ep={setupCommand:`Setup`,verifyCommands:`Verify`,knownFailures:`Known failing tests`,devCommand:`Dev server`,dbResetCommand:`Reset dev database`,driveSetupCommand:`Before a test drive`,driveStopCommand:`After a test drive`,driveInstructions:`How to drive this app`,sandboxImage:`Sandbox image`},Dp=new Set([`devCommand`,`dbResetCommand`,`driveSetupCommand`,`driveStopCommand`]);function Op(e,t=Date.now()){let n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<36?`${i}h ago`:`${Math.round(i/24)}d ago`}function kp(e){return Sd.includes(e)}function Ap(e,t=Date.now()){return kp(e.key)?e.verifiedAt===void 0?`unverified`:`verified ${Op(e.verifiedAt,t)}`:null}function jp(e){return Sd.filter(t=>e.some(e=>e.key===t&&e.verifiedAt===void 0))}function Mp(e){return`${Pp(e)}${Np(e)}`}function Np(e){return kp(e.key)?e.verifiedAt===void 0?` Unverified — never proven by a dry run.`:` Verified ${Op(e.verifiedAt)} by a dry run.`:``}function Pp(e){if(e.source===`human`)return`You set this ${Op(e.establishedAt)}.`;let t=e.source===`build`?`Built by runcastle from the repo Dockerfile`:e.source===`session`?`Established in a conversation on this machine`:Dp.has(e.key)?`Proposed by preparation from config (not executed)`:`Established by preparation`,n=Op(e.establishedAt);return e.staleCommits===void 0?`${t} ${n}${e.establishedSha?` — age against main unknown`:``}.`:e.staleCommits===0?`${t} ${n} — main has not moved since.`:`${t} ${n} — main has moved ${e.staleCommits} commit${e.staleCommits===1?``:`s`} since.`}function Fp(e){return e.source!==`human`&&(e.staleCommits??0)>=100}var Ip={serverPort:`RUNCASTLE_SERVER_PORT`,model:`RUNCASTLE_MODEL`,sandbox:`RUNCASTLE_SANDBOX`,sandboxImage:`RUNCASTLE_SANDBOX_IMAGE`,sessionMcp:`RUNCASTLE_SESSION_MCP`,burnConcurrency:`RUNCASTLE_BURN_CONCURRENCY`,burnMaxIterations:`RUNCASTLE_BURN_MAX_ITERATIONS`,burnAttempts:`RUNCASTLE_BURN_ATTEMPTS`,burnConflictAttempts:`RUNCASTLE_BURN_CONFLICT_ATTEMPTS`,burnCpus:`RUNCASTLE_BURN_CPUS`,setupCommand:`RUNCASTLE_SETUP_COMMAND`,verifyCommands:`RUNCASTLE_VERIFY_COMMANDS`,knownFailures:`RUNCASTLE_KNOWN_FAILURES`},Lp={"claude-code":`Claude Code`,codex:`Codex`},Rp={general:[`server`,`sessions`],models:[`default`],burns:[`width`],project:[`model`,`commands`,`chat`]};function zp(e){let t=e?.fields.find(e=>e.key===`models`)?.value;return Array.isArray(t)?t.flatMap(e=>{let t=Ku.safeParse(e);return t.success?[t.data]:[]}):[]}function Bp(e){return Zu({discovered:Qu(e?.discovery??jd),models:zp(e)})}function Vp(e){return Uu.map(t=>({runtime:t,label:Lp[t],entries:e.filter(e=>e.runtime===t)})).filter(e=>e.entries.length>0)}function Hp(e,t,n){let r=e.trim();if(r===``)return{error:`Enter a model id.`};if(!Uu.includes(t))return{error:`Choose which runtime this model runs on.`};let i=n.trim();return{entry:{id:r,runtime:t,...i?{note:i}:{}}}}var Up=`stepModels.`;function Wp(e){return e.startsWith(Up)}function Gp(e){return e.slice(11)}var Kp=[{step:`chat`,label:`Chat`,group:`sessions`,description:`The feature conversation`},{step:`waypoint`,label:`Waypoint`,group:`sessions`,description:`Works one waypoint of a mapped feature`},{step:`converge`,label:`Converge`,group:`sessions`,description:`Folds a map back into one spec`},{step:`project`,label:`Project chat`,group:`sessions`,description:`The project-level conversation`},{step:`research`,label:`Research`,group:`unattended`,description:`Reads the repo before a burn`},{step:`implement`,label:`Implement`,group:`unattended`,description:`Burns a ticket in the sandbox`},{step:`review`,label:`Review`,group:`unattended`,description:`Reads the finished branch`},{step:`prepare`,label:`Prepare`,group:`unattended`,description:`Measures setup, verify and baseline`},{step:`smoke`,label:`Smoke`,group:`unattended`,description:`Cheap scripted end-to-end check`}],qp=Object.fromEntries(Kp.map(e=>[e.step,e.label]));function Jp(e){return`${Up}${e}`}Vu.map(Jp);var Yp=`Applies inside the app under test only — it changes no review rule and permits no edit to the repo under review.`,Xp={serverPort:{label:`Server port`,tooltip:`The port the runcastle server listens on. Changing it takes effect at the next server restart.`,control:`number`,page:`general`,group:`server`},model:{label:`Default model`,tooltip:`Runs every step that has no model of its own below — and every project that has not set one.`,control:`select`,page:`models`,group:`default`},sandbox:{label:`Sandbox`,tooltip:`Where launched sessions and burns run. A Docker container isolates them from this machine; “no sandbox” runs them directly on it.`,control:`select`,page:`general`,group:`sessions`,options:[`docker`,`noSandbox`],optionLabels:{docker:`Docker container (isolated)`,noSandbox:`No sandbox — run directly on this machine`}},sandboxImage:{label:`Sandbox image`,tooltip:`The Docker image sessions and burns are sandboxed in. Leave blank to use sandcastle:runcastle, the image “Build image” on the Burns page produces.`,control:`text`,page:`general`,group:`sessions`,placeholder:`sandcastle:runcastle`},sessionMcp:{label:`MCP servers in sessions`,tooltip:`Inherit mine — sessions see your own MCP servers (user, project and plugin) alongside runcastle’s. runcastle only — sessions see runcastle’s server and nothing else; use it for a reproducible tool surface or to keep a heavy personal MCP set out of the context window.`,control:`select`,page:`general`,group:`sessions`,options:[`inherit`,`runcastleOnly`],optionLabels:{inherit:`Inherit mine — my servers alongside runcastle’s`,runcastleOnly:`runcastle only — nothing else`}},burnConcurrency:{label:`Concurrency`,tooltip:`Tickets burned in parallel per run (1–8). Each is a full agent with its own container, sizing its install and test workers from the whole core count — lower it if suites die under load.`,control:`number`,page:`burns`,group:`width`,unit:`tickets at once`},burnMaxIterations:{label:`Iterations per attempt`,tooltip:`Turns one healthy burn agent may take before it is stopped (1–10). A ticket that finishes early stops the loop itself.`,control:`number`,page:`burns`,group:`width`,shortHelp:`Distinct from attempts: an attempt restarts an agent that crashed.`,unit:`turns`},burnAttempts:{label:`Attempts per ticket`,tooltip:`Fresh agent attempts per ticket per run (1–5). A transient crash — API drop, network, rate limit — retries with committed work preserved; auth errors and conflicts never retry.`,control:`number`,page:`burns`,group:`width`,unit:`attempts`},burnConflictAttempts:{label:`Conflict resolver passes`,tooltip:`Agent passes spent resolving a ticket’s landing conflict before asking you (0–3). 0 sends every conflict straight to you.`,control:`number`,page:`burns`,group:`width`,unit:`passes before asking you`},burnCpus:{label:`CPU limit per burn`,tooltip:`CPU ceiling per burn container (--cpus). Blank leaves it unconstrained. Roughly cores ÷ concurrency keeps parallel tickets from oversubscribing the machine.`,control:`number`,page:`burns`,group:`width`,placeholder:`unlimited`,unit:`cores · e.g. 4 on a 12-thread box at width 3`},setupCommand:{label:`Setup`,tooltip:`Takes a clean checkout to a buildable state inside the burn sandbox — dependency install plus any codegen. Blank auto-detects from the lockfile.`,control:`text`,page:`project`,group:`commands`,placeholder:`e.g. pnpm install --frozen-lockfile && pnpm prisma:generate`},verifyCommands:{label:`Verify`,tooltip:`The exact typecheck / test / lint commands a burn agent runs, one per line. Rendered verbatim into the agent’s prompt; runcastle never runs them itself.`,control:`textarea`,page:`project`,group:`commands`,placeholder:`one per line, e.g.
|
|
73
|
+
pnpm --filter @acme/web test`},knownFailures:{label:`Known failing tests`,tooltip:`Tests already red on main — a count plus suite names is enough. Saves every burn agent a full pre-work run to establish its own baseline.`,control:`textarea`,page:`project`,group:`commands`,placeholder:`e.g. 2 failing: dev-pane.test.ts (Windows only)`},devCommand:{label:`Dev server`,tooltip:`Starts this project’s dev server for a test drive. The URL it prints becomes the “Open app” link.`,control:`text`,page:`project`,group:`commands`,placeholder:`e.g. pnpm dev`},driveSetupCommand:{label:`Before a test drive`,tooltip:`Runs on your machine before the dev server starts a test drive — bring up services, apply schema. A failure is reported, never fatal.`,control:`text`,page:`project`,group:`commands`,placeholder:`e.g. docker compose up -d && pnpm db:migrate`},driveStopCommand:{label:`After a test drive`,tooltip:`Runs when a test drive stops, while the feature branch is still checked out — stop services, drop the branch database.`,control:`text`,page:`project`,group:`commands`,placeholder:`e.g. docker compose down`},dbResetCommand:{label:`Reset dev database`,tooltip:`Rebuilds the dev database from the migrations in the working tree. Offered — never run automatically — after a test drive whose branch carried migrations this one does not have.`,control:`text`,page:`project`,group:`commands`,placeholder:`e.g. pnpm db:reset`},driveInstructions:{label:`How to drive this app`,tooltip:`How to exercise this app once it is up: the sample project or scratch data a driver should use and may change, how to reach the states worth reviewing, and what to leave alone. Written by preparation, edited here, and injected verbatim into every drive-mode review and verification prompt.`,control:`textarea`,page:`project`,group:`commands`,shortHelp:Yp,placeholder:`e.g. drive the sample project at ./examples/demo — change anything inside it freely`},docsCommitPrefix:{label:`Docs commit prefix`,tooltip:`Prefix for checkpoint commits runcastle creates from feature docs. Use a form accepted by this repository’s commit message policy.`,control:`text`,page:`project`,group:`chat`,placeholder:wd},sessionBranch:{label:`Commits land on`,tooltip:`The branch the project chat’s commits (charter, ADRs) land on when its terminal closes. Blank uses the repo’s detected main line; a pick takes effect at the next chat you open.`,control:`text`,page:`project`,group:`chat`,placeholder:`main (detected)`}},Zp=Object.keys(Xp),Qp={model:{label:`Model`,tooltip:`A model set here runs every step of this project — it beats the global default and the per-step models.`,page:`project`,group:`model`},sandbox:{page:`project`,group:`model`},sandboxImage:{tooltip:`The Docker image THIS project’s sessions and burns are sandboxed in — where a repo needs a toolchain the stock image has none of. Blank inherits the machine-wide image.`,page:`project`,group:`model`}},$p=new Set([`model`,`sandbox`,`sandboxImage`,`setupCommand`,`verifyCommands`,`knownFailures`]);function em(e,t=`global`){if(Wp(e)){let t=Gp(e),n=qp[t]??t;return{label:n,tooltip:`Model for the ${n} step.`,control:`select`,page:`models`,group:`default`}}let n=Xp[e]??{label:e,tooltip:``,control:`text`,page:`general`,group:`server`};return t===`project`?{...n,...Qp[e]}:n}function tm(e){return e==null?``:String(e)}function nm(e,t){let n=t.trim();if(e===`textarea`&&n===``)return{value:null};if(e!==`number`)return{value:n};if(n===``)return{value:null};let r=Number(n);return Number.isFinite(r)?{value:r}:{error:`Enter a number, or leave it blank to unset it.`}}function rm(e){return e===`model`||Wp(e)}function im(e,t){if(t.unit!==void 0)return e.key!==`burnConcurrency`||e.source!=="default"?t.unit:`${t.unit} · default on this machine: ${tm(e.value)}`}function am(e){if(e.scope!==`project`)return e.key===`burnConcurrency`&&e.source==="default"&&tm(e.value)||void 0;if($p.has(e.key)&&!(e.source!==`file`&&e.source!=="default"))return tm(e.value)||void 0}var om=new Set([`sandboxImage`]);function sm(e){return e.scope===`global`&&e.source===`file`&&om.has(e.key)}function cm(e){if(e.source===`env`)return`env`;if(!(e.scope!==`project`||!$p.has(e.key)))return e.source===`project`?`project`:`global`}function lm(e){let t=[e.source===`human`?`You`:e.source===`session`?`Set in a session`:e.source===`build`?`Built by runcastle`:`Prepared`,Op(e.establishedAt)];e.source!==`human`&&e.staleCommits&&t.push(`main +${e.staleCommits}`);let n=kp(e.key)?e.verifiedAt===void 0?`unverified`:`verified by a dry run ${Op(e.verifiedAt)}`:null;return n&&t.push(n),{text:t.join(` · `),tone:Fp(e)?`warn`:n===`unverified`?`muted`:`ok`,...e.evidence?{evidence:e.evidence}:{}}}function um(e,t,n=Ju){let r=em(e.key,e.scope),i=rm(e.key),a=!e.editable,o=e.source===`project`,s=null;e.source===`env`?s=`Set by ${Ip[e.key]??`the environment`}`:t&&o?s=Mp(t):e.scope===`project`&&(s=o?`Overridden for this project`:`Inherited from global`);let c=im(e,r),l=am(e),u=cm(e);return{key:e.key,label:r.label,tooltip:r.tooltip,...r.shortHelp?{shortHelp:r.shortHelp}:{},placeholder:r.placeholder??``,...c?{unit:c}:{},page:r.page,group:r.group,value:tm(e.value),control:r.control,options:i?n.map(e=>e.id):r.options??[],modelGroups:i?Vp(n):[],optionLabels:r.optionLabels??{},readOnly:a,restartRequired:e.restartRequired,overridden:o,source:e.source,note:s,...l?{ghostValue:l}:{},...u?{sourceChip:u}:{},clearable:sm(e),...t?{provenanceChip:lm(t)}:{},...t?.evidence?{evidence:t.evidence}:{},stale:t?Fp(t):!1,allowCustom:i}}function dm(e){return!Wp(e)&&e!==`models`}function fm(e,t,n=[]){let r=new Map(n.map(e=>[e.key,e])),i=Bp(e),a=Rp[t];return e.fields.filter(e=>dm(e.key)?t===`project`?e.scope===`project`:e.scope!==`project`&&em(e.key).page===t:!1).map(e=>um(e,r.get(e.key),i)).sort((e,t)=>a.indexOf(e.group)-a.indexOf(t.group)||Zp.indexOf(e.key)-Zp.indexOf(t.key))}function pm(e,t){let n=t=>e?.fields.find(e=>e.key===t),r=n(`model`),i=n(`${Up}${t}`),a=(r?.source===`project`?r:void 0)??(i?.source===`file`?i:void 0)??r;return typeof a?.value==`string`?a.value:void 0}function mm(e){return tm(e.fields.find(e=>e.key===`model`)?.value)}function hm(e,t){let n=e.fields.find(e=>e.key===`${Up}${t}`);return n?.source===`file`&&typeof n.value==`string`&&n.value!==``?n.value:null}var gm={"claude-code":`Claude`,codex:`Codex`};function _m(e){return e.discovery??jd}function vm(e){let t=Uu.filter(t=>e[t].status===`ok`);return t.length===0?null:t.length===1?t[0]:Gu}function ym(e){let t=mm(e),n=new Map(Vu.map(n=>[n,hm(e,n)??t])),r=new Set(Ju.map(e=>e.id)),{sources:i}=_m(e),a=new Map(Uu.flatMap(e=>i[e].models.map(t=>[t.id,{model:t,runtime:e}]))),o=Bp(e),s=new Set(o.map(e=>e.id)),c=vm(i),l=new Set([t,...n.values()].filter(e=>e!==``&&!s.has(e)));return[...o,...[...l].map(e=>({id:e,runtime:c??`claude-code`}))].map(e=>{let o=e.note??``,s=Vu.filter(t=>n.get(t)===e.id),c=e.id===t,u=a.get(e.id),d=!r.has(e.id)&&!u&&!l.has(e.id),f=c||s.length>0||o!==``;return{id:e.id,runtime:e.runtime,displayName:u?.model.displayName??null,note:o,usedFor:s,isDefault:c,custom:d,discovered:u!==void 0,isNew:u!==void 0&&i[u.runtime].newIds.includes(e.id),noLongerOffered:f&&!u&&(r.has(e.id)||l.has(e.id)||i[e.runtime].knownIds.includes(e.id))&&i[e.runtime].status===`ok`?e.runtime:null,retirement:u?.model.retirement??null}})}function bm(e){return e.filter(e=>e.isDefault||e.usedFor.length>0||e.note!==``||e.custom||e.isNew)}function xm(e){return e.length-bm(e).length}function Sm(e,t=Date.now()){let{sources:n}=_m(e);return Uu.map(e=>{let r=n[e],i=gm[e],a=r.lastSuccessAt;if(r.status===`never`)return{runtime:e,text:`${i}: not run yet`,failed:!1};if(r.status===`failed`){let n=a===void 0?``:` (last good ${Op(a,t)})`;return{runtime:e,text:`${i}: failed — ${r.error??`unknown error`}${n}`,failed:!0}}let o=r.models.length,s=a===void 0?``:` · ${Op(a,t)}`;return{runtime:e,text:`${i}: ${o} ${o===1?`model`:`models`}${s}`,failed:!1}})}function Cm(e){let t={discovered:Qu(_m(e)),models:zp(e)},n=mm(e);return Kp.map(r=>{let i=hm(e,r.step),a=i??n;return{...r,value:i,effectiveModel:a,effectiveRuntime:$u(a,t).runtime}})}function wm(e){let t=e?.fields.find(e=>e.key===`model`);return t?.source===`project`&&tm(t.value)||null}function Tm(e){return[e.label,e.key,e.tooltip]}function Em(e,t){let n=fm(e,t).map(e=>({id:e.key,page:t,terms:Tm(e)}));return t===`models`?[...n,...ym(e).map(e=>({id:e.id,page:t,terms:[e.id,e.note,Lp[e.runtime]]})),...Cm(e).map(e=>({id:Jp(e.step),page:t,terms:[e.label,e.description,e.step]}))]:n}function Dm(e,t){let n={general:0,models:0,burns:0,project:0},r=e.trim().toLowerCase();if(r===``)return{counts:n,matches:new Set(t.map(e=>e.id))};let i=new Set;for(let e of t)e.terms.some(e=>e.toLowerCase().includes(r))&&(i.add(e.id),n[e.page]+=1);return{counts:n,matches:i}}function Om(e){return km.test(e)?{page:`burns`,field:`sandcastle-image`}:null}var km=/Settings\s*→\s*(?:AFK burns|Burns)/i;function Am(e){let t=km.exec(e),n=Om(e);return!t||!n?null:{before:e.slice(0,t.index),phrase:t[0],after:e.slice(t.index+t[0].length),location:n}}var jm=[{key:`identity`,label:`Git identity`},{key:`runtimes`,label:`Coding agents`},{key:`afk`,label:`AFK burns`},{key:`project`,label:`First project`}];function Mm(e){return e?.status===`ok`?`runtimes`:`identity`}function Nm(e){return jm[jm.findIndex(t=>t.key===e)+1]?.key}function Pm(e,t){if(e!==Mm(t))return jm[jm.findIndex(t=>t.key===e)-1]?.key}var Fm={"claude-code":{kind:`claude-login`,command:`claude auth login`},codex:{kind:`codex-login`,command:`codex login`}};function Im(e){return Uu.map(t=>{let n=n=>e.find(e=>e.runtime===t&&e.check===n),r=n(`binary`),i=r?.status===`ok`,a=n(`auth`)?.status===`ok`,o=t===`codex`?a:n(`afk-key`)?.status===`ok`;return{runtime:t,label:Lp[t],installed:i,authed:a,afkReady:o,talkReady:i&&(a||o),detail:r?.detail??`not checked`,...i||!r?.fix?{}:{installFix:r.fix}}})}function Lm(e){return e.filter(e=>e.talkReady).map(e=>e.runtime)}function Rm(e){return e.find(e=>e.id===`git-identity`)?.status===`ok`&&Lm(Im(e)).length>0}function zm(e){return e?.status===`ok`?`detected from git config: ${e.detail}`:void 0}function Bm(e,t){let n=jm.findIndex(t=>t.key===e),r=zm(t);return jm.map((e,t)=>e.key===`identity`&&t<n&&r?{...e,state:`passed`,detected:r}:{...e,state:t<n?`done`:t===n?`current`:`todo`})}var Vm=`review-artifacts`;function Hm(e,t=!0){return ut({enabled:t,queryKey:[Vm,e],queryFn:async()=>{let t=await fetch(Fd(e));if(!t.ok)throw Error(`review artifacts: ${t.status}`);return await t.json()}})}function Um(e){if(!e)return null;for(let t of Array.from(e.files))if(t.type.startsWith(`image/`))return t;for(let t of Array.from(e.items)){if(t.kind!==`file`||!t.type.startsWith(`image/`))continue;let e=t.getAsFile();if(e)return e}return null}async function Wm(e){if(e.type===`image/png`)return e;let t=await createImageBitmap(e),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height;let r=n.getContext(`2d`);if(!r)throw Error(`this browser offered no 2d canvas to convert the image with`);return r.drawImage(t,0,0),t.close(),await new Promise((e,t)=>{n.toBlob(n=>{n?e(n):t(Error(`the browser produced no PNG from that image`))},`image/png`)})}async function Gm(e,t){let n=await fetch(Rd(e),{method:`POST`,headers:{"content-type":`image/png`},body:t});if(!n.ok)throw Error(`screenshot upload: ${n.status}`)}var Km=`connecting`,qm=new Set;function Jm(e){if(e!==Km){Km=e;for(let e of qm)e()}}function Ym(e){return qm.add(e),()=>qm.delete(e)}function Xm(){return(0,L.useSyncExternalStore)(Ym,()=>Km)}var Zm=3e4,Qm=1500;function $m(e=Qm){return eh(Xm(),e)}function eh(e,t=Qm){return e===`live`?Zm:t}var th=5e3;function nh(e){let t=null,n=null,r=Date.now(),i=!1,a=()=>{n?.(),n=null,t?.close(),t=null},o=()=>{if(i)return;a(),Jm(`connecting`),r=Date.now();let o=new EventSource(`/api/stream`);t=o;let s=()=>{r=Date.now(),Jm(`live`),e.resyncAll(),e.resyncTranscript()},c=t=>{r=Date.now(),Jm(`live`);let n;try{n=JSON.parse(t.data)}catch{e.resyncAll();return}n.kind===`transcript`?e.resyncTranscript():e.resyncAll()},l=()=>{r=Date.now()},u=()=>{Jm(o.readyState===EventSource.CLOSED?`offline`:`connecting`)};o.addEventListener(`ready`,s),o.addEventListener(`live`,c),o.addEventListener(`ping`,l),o.addEventListener(`error`,u),n=()=>{o.removeEventListener(`ready`,s),o.removeEventListener(`live`,c),o.removeEventListener(`ping`,l),o.removeEventListener(`error`,u)}},s=()=>{i||Date.now()-r<=35e3||o()},c=setInterval(s,th),l=()=>{document.visibilityState===`visible`&&s()};return window.addEventListener(`focus`,s),window.addEventListener(`online`,s),document.addEventListener(`visibilitychange`,l),o(),()=>{i=!0,clearInterval(c),window.removeEventListener(`focus`,s),window.removeEventListener(`online`,s),document.removeEventListener(`visibilitychange`,l),a(),Jm(`connecting`)}}function rh(){let e=B.useUtils(),t=qe(),n=Xm(),r=(0,L.useRef)(e);return r.current=e,(0,L.useEffect)(()=>nh({resyncAll:()=>{let e=r.current;e.events.invalidate(),e.feature.list.invalidate(),e.feature.get.invalidate(),e.feature.driveInfo.invalidate(),e.notes.invalidate(),e.projectNotes.invalidate(),e.findings.invalidate(),e.project.prep.invalidate(),e.run.get.invalidate(),e.run.listByFeature.invalidate(),e.project.list.invalidate(),e.docs.invalidate(),e.settings.get.invalidate(),e.setup.imageBuildTarget.invalidate(),e.project.sessionBranch.invalidate(),e.feature.commitCount.invalidate(),e.feature.mergeDelta.invalidate(),e.feature.burnWarnings.invalidate(),e.project.prepSession.invalidate(),e.project.projectSession.invalidate(),t.invalidateQueries({queryKey:[Vm]})},resyncTranscript:()=>{r.current.run.agentTranscript.invalidate()}}),[]),n}function ih(e){return e.length===0?{view:`open`,projectId:null}:e.length===1?{view:`project`,projectId:e[0].id}:{view:`home`,projectId:null}}function ah(e,t,n){return n?t?.view===`project`&&e.some(e=>e.id===t.projectId)?{view:`project`,projectId:t.projectId}:t?.view===`home`&&e.length>0?{view:`home`,projectId:null}:ih(e):{view:`setup`,projectId:null}}function oh(e,t,n,r){let i=t&&t.kind!==`home`?t.projectId:null;return r&&i&&e.some(e=>e.id===i)?{view:`project`,projectId:i}:ah(e,n,r)}function sh(e,t){return(e.view===`project`?!t.some(t=>t.id===e.projectId):e.view===`home`&&t.length===0)?ih(t):null}function ch(e){return e.status===`shipped`||e.activeRun?!1:e.ticketCounts.failed>0||e.phase===`planning`||e.phase===`review`}function lh(e){let t=e.filter(e=>e.activeRun).length,n=e.filter(ch).length,r=e.filter(e=>e.status===`shipped`).length,i=e.length;return{total:i,needsYou:n,activeRuns:t,shipped:r,health:i===0?`empty`:n>0?`attention`:t>0?`working`:`steady`}}function uh(e,t){return e.reduce((e,n)=>n.projectId===t?e:e+n.activeRuns,0)}function dh(e){let t=fh(e),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?t:t.slice(n+1)}function fh(e){return e.replace(/[\\/]+$/,``)}var ph=/does not exist|cannot read/i;function mh(e,t){let n=e?.trim()||void 0;return!n||!t||!ph.test(t)?{dir:n,keepTyped:!1}:{dir:hh(n),keepTyped:!0}}function hh(e){let t=fh(e),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));if(n<=0)return;let r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?`${r}\\`:/^[\\/]+$/.test(r)?void 0:r}var gh=[{match:/path does not exist: (.*)$/i,message:`Path does not exist`,hint:`Check the path, or pick a folder from the rail.`},{match:/cannot read (?:path|directory): (.*?)(?: \(.*\))?$/i,message:`Cannot read that folder`,hint:`It may need permissions this machine does not have.`},{match:/path is not absolute: (.*)$/i,message:`Enter an absolute path`,hint:`A path from the root of the machine runcastle runs on.`}];function _h(e){for(let t of gh){let n=t.match.exec(e);if(n)return{message:t.message,hint:t.hint,path:n[1].trim()||null}}return{message:e,hint:null,path:null}}function vh(e,t){let n=t.trim()||null;if(/not a git repository/i.test(e))return{message:`Not a git repository`,hint:`runcastle tracks work as branches, so it needs a git repository. Initialize one here, or pick a folder that already is one.`,path:n,offer:`init-repo`};let r=/does not exist/i.test(e);return r||/cannot read/i.test(e)?{message:r?`Path does not exist`:`Cannot read that path`,hint:`Check the path, or use Browse… to find the folder.`,path:n}:{message:e,hint:null,path:null}}function yh(e){return e.kind===`home`?null:e.projectId}function bh(e){if(e.kind===`home`)return`/`;let t=`/p/${encodeURIComponent(e.projectId)}`;switch(e.kind){case`project`:return t;case`chat`:return`${t}/chat`;case`prepare`:return`${t}/prepare`;case`feature`:return`${t}/f/${encodeURIComponent(e.featureSlug)}`}}function xh(e){try{return e.split(`/`).filter(e=>e.length>0).map(decodeURIComponent)}catch{return null}}function Sh(e){let t=xh(e);if(!t)return null;if(t.length===0)return{kind:`home`};if(t[0]!==`p`)return null;let n=t[1];return n?t.length===2?{kind:`project`,projectId:n}:t.length===3&&t[2]===`chat`?{kind:`chat`,projectId:n}:t.length===3&&t[2]===`prepare`?{kind:`prepare`,projectId:n}:t.length===4&&t[2]===`f`&&t[3]?{kind:`feature`,projectId:n,featureSlug:t[3]}:null:null}function Ch(e,t){return!e||e.kind===`home`||e.kind===`project`?null:e.projectId===t?e:null}function wh(e){let{projectId:t}=e;return e.preparing?{kind:`prepare`,projectId:t}:e.projectSelected?{kind:`chat`,projectId:t}:e.featureSlug?{kind:`feature`,projectId:t,featureSlug:e.featureSlug}:{kind:`project`,projectId:t}}function Th(){return typeof window>`u`?`/`:window.location.pathname}function Eh(e){typeof window>`u`||Th()===e||window.history.pushState(null,``,e)}function Dh(e){typeof window>`u`||Th()===e||window.history.replaceState(null,``,e)}function Oh(e,t){let n=e?bh(e):null,r=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(n===null){r.current=!1;return}Th()!==n&&(r.current?window.history.pushState(null,``,n):window.history.replaceState(null,``,n)),r.current=!0},[n]);let i=(0,L.useRef)(t);(0,L.useEffect)(()=>{i.current=t}),(0,L.useEffect)(()=>{let e=()=>i.current(Sh(Th()));return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[])}var kh=`runcastle.project.v1`;function Ah(){let e;try{e=localStorage.getItem(kh)}catch{return null}if(!e)return null;try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t;return n.view===`home`?{view:`home`}:n.view===`project`&&typeof n.projectId==`string`?{view:`project`,projectId:n.projectId}:null}catch{return null}}function jh(e){try{localStorage.setItem(kh,JSON.stringify(e))}catch{}}function Mh(){let e=B.project.list.useQuery(void 0,{refetchInterval:$m(5e3)}),t=e.data,n=B.setup.doctor.useQuery(void 0,{refetchOnWindowFocus:!1,retry:!1,retryOnMount:!1}),[r]=(0,L.useState)(Ah),[i]=(0,L.useState)(()=>Sh(Th())),[a,o]=(0,L.useState)(null),s=(0,L.useRef)(null),c=!n.data||Rm(n.data.results);!s.current&&t&&!n.isLoading&&(s.current=oh(t,i,r,c));let l=a??s.current,u=l?.view??`home`,d=l?.projectId??null,f=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(!t||!l)return;let e=sh(l,t);e&&(f.current=!1,o(e))},[t,l]),(0,L.useEffect)(()=>{f.current||!l||(f.current=!0,l.view===`project`&&l.projectId?yh(Sh(Th())??{kind:`home`})!==l.projectId&&Dh(bh({kind:`project`,projectId:l.projectId})):Dh(`/`))},[l]),(0,L.useEffect)(()=>{let e=()=>{let e=yh(Sh(Th())??{kind:`home`});o(e?{view:`project`,projectId:e}:{view:`home`,projectId:null})};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let p=(0,L.useCallback)(()=>{o({view:`home`,projectId:null}),jh({view:`home`}),Eh(`/`)},[]),m=(0,L.useCallback)(e=>{o({view:`project`,projectId:e}),jh({view:`project`,projectId:e}),Eh(bh({kind:`project`,projectId:e}))},[]),h=(0,L.useCallback)(()=>o({view:`open`,projectId:d}),[d]),g=(0,L.useCallback)(()=>{u===`open`&&o(d?{view:`project`,projectId:d}:{view:`home`,projectId:null})},[u,d]),_=t?.find(e=>e.id===d),v=n.refetch,y=(0,L.useCallback)(()=>{v()},[v]);return{projects:t,loading:e.isLoading||n.isLoading,doctorError:n.error?.message??null,recheckDoctor:y,view:u,currentProjectId:d,currentProject:_,goHome:p,enterProject:m,showOpen:h,cancelOpen:g}}function Nh({size:e=16,...t}){return{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,...t}}function Ph(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`}),(0,R.jsx)(`path`,{d:`M10.5 10.5 L14 14`})]})}function Fh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2`}),(0,R.jsx)(`path`,{d:`M8 1.8v2M8 12.2v2M1.8 8h2M12.2 8h2M3.6 3.6l1.4 1.4M11 11l1.4 1.4M12.4 3.6 11 5M5 11l-1.4 1.4`})]})}function Ih(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`rect`,{x:`1.8`,y:`2.8`,width:`12.4`,height:`10.4`,rx:`1.6`}),(0,R.jsx)(`path`,{d:`M10.2 2.8v10.4`})]})}function Lh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`circle`,{cx:`4.5`,cy:`3.8`,r:`1.7`}),(0,R.jsx)(`circle`,{cx:`4.5`,cy:`12.2`,r:`1.7`}),(0,R.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.7`}),(0,R.jsx)(`path`,{d:`M4.5 5.5v5M11.5 6.7c0 2.6-3 3-5.4 3.6`})]})}function Rh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`path`,{d:`M8 2a4 4 0 0 0-4 4v2.6L2.8 11h10.4L12 8.6V6a4 4 0 0 0-4-4Z`}),(0,R.jsx)(`path`,{d:`M6.5 13.4a1.6 1.6 0 0 0 3 0`})]})}function zh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`path`,{d:`M5.2 3.2A4 4 0 0 1 12 6v2.6L13.2 11H6.5M4 6.5V8.6L2.8 11h2.4`}),(0,R.jsx)(`path`,{d:`M6.5 13.4a1.6 1.6 0 0 0 3 0`}),(0,R.jsx)(`path`,{d:`M2 2l12 12`})]})}function Bh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M8 3.2v9.6M3.2 8h9.6`})})}function Vh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`m3 8.4 3.2 3.2L13 5`})})}function Hh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`m4 4 8 8M12 4l-8 8`})})}function Uh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M3 4.5h10M6.5 4.5V3h3v1.5M4.5 4.5l.6 8.5h5.8l.6-8.5`})})}function Wh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`path`,{d:`M5 6h5a3 3 0 0 1 0 6H7`}),(0,R.jsx)(`path`,{d:`M7 3.5 4.5 6 7 8.5`})]})}function Gh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`m4 6 4 4 4-4`})})}function Kh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`m6 4 4 4-4 4`})})}function qh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`circle`,{cx:`3.2`,cy:`8`,r:`1.1`,fill:`currentColor`,stroke:`none`}),(0,R.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.1`,fill:`currentColor`,stroke:`none`}),(0,R.jsx)(`circle`,{cx:`12.8`,cy:`8`,r:`1.1`,fill:`currentColor`,stroke:`none`})]})}function Jh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`rect`,{x:`1.8`,y:`2.8`,width:`12.4`,height:`10.4`,rx:`1.6`}),(0,R.jsx)(`path`,{d:`m4.5 6.2 2.3 2-2.3 2M8.5 10.4h3`})]})}function Yh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M2 4.4a1.6 1.6 0 0 1 1.6-1.6h8.8A1.6 1.6 0 0 1 14 4.4v5.2a1.6 1.6 0 0 1-1.6 1.6H6.4L3.2 14v-2.8A1.6 1.6 0 0 1 2 9.6z`})})}function Xh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`path`,{d:`M4 1.8h5.2L13 5.6v8.6H4z`}),(0,R.jsx)(`path`,{d:`M9 2v3.8h3.8M6 8.4h4M6 10.8h4`})]})}function Zh(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`path`,{d:`M10.6 2.4a1.7 1.7 0 0 1 2.4 2.4L5.5 12.3 2.4 13.1l.8-3.1z`}),(0,R.jsx)(`path`,{d:`M9.4 3.6l2.4 2.4`})]})}function Qh(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M1.8 4.2c0-.8.6-1.4 1.4-1.4h3l1.4 1.7h5.2c.8 0 1.4.6 1.4 1.4v6.5c0 .8-.6 1.4-1.4 1.4H3.2c-.8 0-1.4-.6-1.4-1.4z`})})}function $h(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`path`,{d:`M8 1.6l5.4 3v6.8L8 14.4l-5.4-3V4.6z`}),(0,R.jsx)(`path`,{d:`M8 7.6l5.4-3M8 7.6L2.6 4.6M8 7.6v6.8`})]})}function eg(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M8 14.4c2.7 0 4.7-2 4.7-4.7 0-2-1.3-3.4-2-4.7-.7 1.3-1.3 2-2 2 0-2-.7-4-2.7-5.4 0 2.7-2.7 4-2.7 8.1 0 2.7 2 4.7 4.7 4.7z`})})}function tg(e){return(0,R.jsxs)(`svg`,{...Nh(e),children:[(0,R.jsx)(`rect`,{x:`3.4`,y:`7.2`,width:`9.2`,height:`6.6`,rx:`1.3`}),(0,R.jsx)(`path`,{d:`M5.6 7.2V5a2.4 2.4 0 0 1 4.8 0v2.2`})]})}function ng(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M5 3.2v9.6L13 8z`,fill:`currentColor`,stroke:`none`})})}function rg(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M8 1.8 13 3.6v4.2c0 3.2-2.1 5.3-5 6.4-2.9-1.1-5-3.2-5-6.4V3.6z`})})}function ig(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M8 2.4v11.2M3.2 5.2l9.6 5.6M12.8 5.2l-9.6 5.6`})})}function ag(e){return(0,R.jsx)(`svg`,{...Nh(e),children:(0,R.jsx)(`path`,{d:`M5.6 4.8 2.4 8l3.2 3.2M10.4 4.8 13.6 8l-3.2 3.2`})})}var og=`M4 29 V6 H10 V11 H13 V6 H19 V11 H22 V6 H28 V29 H4 Z M12.5 15 L21.5 20 L12.5 25 Z`;function sg({size:e=16,variant:t=`solid`,...n}){let r=t===`solid`?`var(--accent)`:t===`mono`?`currentColor`:t===`ink`?`var(--accent-ink)`:`none`;return(0,R.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 32 32`,fill:`none`,"aria-hidden":!0,...n,children:(0,R.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:og,fill:r,stroke:t===`outline`?`var(--accent-hi)`:`none`,strokeWidth:t===`outline`?1.5:0,strokeLinejoin:`miter`})})}function cg({large:e}){return(0,R.jsxs)(`span`,{className:`wordmark${e?` is-lg`:``}`,children:[(0,R.jsx)(`span`,{className:`wordmark-run`,children:`run`}),(0,R.jsx)(`span`,{className:`wordmark-castle`,children:`castle`})]})}var lg=`runcastle.selected.v1`,ug=`runcastle.preparing.v1`,dg=`runcastle.inspector.collapsed`,fg=`runcastle.maprail.collapsed`,pg=`runcastle.artifact.collapsed`,mg=`runcastle.chatpanel.open`,hg=`runcastle.guidance`;function gg(e,t){return e===null?t===`planning`:e}function _g(e){return`${lg}:${e}`}function vg(e){return`${ug}:${e}`}function yg(e){try{return localStorage.getItem(e)}catch{return null}}function bg(e,t){try{localStorage.setItem(e,t)}catch{}}function xg(e){try{localStorage.removeItem(e)}catch{}}function Sg(e){let t=_g(e),n=vg(e),[r,i]=(0,L.useState)(()=>yg(t)),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(()=>yg(n)===`1`),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(()=>{let e=yg(dg);return e===null?null:e===`1`}),[h,g]=(0,L.useState)(()=>yg(fg)===`1`),[_,v]=(0,L.useState)(()=>yg(pg)===`1`),[y,b]=(0,L.useState)(()=>yg(mg)===`1`),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(()=>yg(hg)!==`0`);(0,L.useEffect)(()=>{r?bg(t,r):xg(t)},[r,t]),(0,L.useEffect)(()=>{bg(n,l?`1`:`0`)},[l,n]),(0,L.useEffect)(()=>{p!==null&&bg(dg,p?`1`:`0`)},[p]),(0,L.useEffect)(()=>{bg(fg,h?`1`:`0`)},[h]),(0,L.useEffect)(()=>{bg(pg,_?`1`:`0`)},[_]),(0,L.useEffect)(()=>{bg(mg,y?`1`:`0`)},[y]),(0,L.useEffect)(()=>{bg(hg,T?`1`:`0`)},[T]);let D=(0,L.useCallback)(e=>{i(e),o(null),c(!1),u(!1),f(!1),S(!1)},[]),O=(0,L.useCallback)(()=>{f(!0),o(null),c(!1),u(!1),S(!1)},[]),k=(0,L.useCallback)(e=>o(e),[]),A=(0,L.useCallback)(()=>{c(!0),u(!1),f(!1),S(!1)},[]),j=(0,L.useCallback)(()=>{u(!0),c(!1),f(!1),S(!1)},[]),M=(0,L.useCallback)((e={page:`general`})=>{w(e),S(!1)},[]),N=(0,L.useCallback)(()=>w(null),[]),P=(0,L.useCallback)(()=>c(!1),[]),F=(0,L.useCallback)(()=>u(!1),[]),ee=(0,L.useCallback)(e=>m(t=>!(e??t??!1)),[]),te=(0,L.useCallback)(()=>g(e=>!e),[]),ne=(0,L.useCallback)(()=>v(e=>!e),[]),I=(0,L.useCallback)(()=>b(e=>!e),[]),re=(0,L.useCallback)(()=>E(e=>!e),[]);return{selectedFeatureId:r,projectSelected:d,viewedPhase:a,creating:s,preparing:l,inspectorCollapsed:p??!1,inspectorPreference:p,mapRailCollapsed:h,artifactPaneCollapsed:_,chatPanelOpen:y,cmdkOpen:x,settings:C,guidance:T,select:D,selectProject:O,viewPhase:k,startDraft:A,startPreparation:j,cancelCreate:P,closePreparation:F,toggleInspector:ee,toggleMapRail:te,toggleArtifactPane:ne,toggleChatPanel:I,setCmdk:S,openSettings:M,closeSettings:N,toggleGuidance:re}}function Cg(e){return e.branches.includes(e.current)?e.current:e.branches.includes(e.detected)?e.detected:``}function wg(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40)}function Tg(e,t){let n=wg(e);if(n===``)return null;let r=t.find(e=>e.slug===n);if(!r)return null;let i=r.status===`shipped`?`was already shipped`:`already exists`;return`“${r.title}” ${i} on feature/${r.slug}. Creating this makes a second feature and a second branch.`}function Eg(e){return e.split(/\r?\n/).filter(e=>e.startsWith(`## `)).length}function Dg(e,t,n){return`Proceed with your task: RESOLVE A MERGE CONFLICT. Merging ${e} into ${t} conflicts on: ${n.length?n.join(`, `):`(run git status to see the conflicts)`}. Your working directory IS the talk worktree, already checked out on ${t}. Run \`git merge ${e}\`, then resolve every conflict using this feature’s spec.md and decisions.md for intent, and commit the merge. Do NOT push and do NOT advance the phase (never call complete_phase). When the merge commit is in, tell me to click “Merge & ship” again for a clean retry.`}function Og(e){let t=e.files.length?e.files.join(`, `):`(run git status after the merge to see them)`;return`Proceed with your task: RESOLVE A MERGE CONFLICT. Ticket #${e.seq} (“${e.title}”) is fully implemented on branch ${e.branch}, but landing it on ${e.featureBranch} conflicts on: ${t}. Your working directory IS the talk worktree, already checked out on ${e.featureBranch}. Run \`git merge ${e.branch}\`, read both sides before resolving (the ticket's work on one side, the sibling tickets that landed first on the other), and resolve by intent using this feature's spec.md and decisions.md — keep BOTH sides working. Run the tests over the touched code, then commit the merge. Do NOT push and do NOT advance the phase (never call complete_phase). When the merge commit is in, tell me to click Retry on the ticket so runcastle records it as landed.`}var kg=`One terminal per feature — your live session will be closed to open the resolve session.`,Ag=[`burn.started`,`merge.resolved`,`feature.shipped`];function jg(e){let t=e.data?.sessionId;return typeof t==`string`?t:void 0}function Mg(e,t){let n=new Set(t.filter(e=>e.purpose===`resolve-conflict`).map(e=>e.id)),r=!1;for(let t of e)if(t.type===`merge.conflict`||Ag.includes(t.type))r=!1;else if(t.type===`session.ended`||t.type===`session.reconciled`){let e=jg(t);e&&n.has(e)&&(r=!0)}return r}function Ng(e){return e.some(e=>e.type===`testdrive.started`)}function Pg(e){let t=1,n=null;for(let r of e)r.type===`lap.started`?t+=1:r.type===`testdrive.started`&&(n=t);return n}function Fg(e){if(typeof e!=`object`||!e)return;let t=e.wallMs;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:void 0}function Ig(e){let t=new Map,n=new Map;for(let r of e){if(!r.ticketId)continue;if(r.type===`ticket.timing`){let e=Fg(r.data);e!==void 0&&n.set(r.ticketId,e)}let e=t.get(r.ticketId);e?(e.min=Math.min(e.min,r.ts),e.max=Math.max(e.max,r.ts)):t.set(r.ticketId,{min:r.ts,max:r.ts})}let r=new Map(n);for(let[e,n]of t)!r.has(e)&&n.max>n.min&&r.set(e,n.max-n.min);return r}function Lg(e,t,n=Date.now()){if(e.status!==`launching`)return!1;let r=t.find(t=>t.type===`session.launching`&&t.data?.sessionId===e.id);return!!r&&n-r.ts>3e4}function Rg(e,t){let n=!1;for(let r of e)r.data?.sessionId===t&&(r.type===`session.not_ready`?n=!0:r.type===`session.ended`&&(n=!1));return n}function zg(e){return e.status===`launching`||e.status===`live`}function Bg(e){return e.status===`launching`?`launching…`:`live`}function Vg(e){return e.find(e=>zg(e))}function Hg(e,t){return e.some(e=>(!t||e.kind===t)&&e.status===`ended`&&!!e.ccSessionId)}function Ug(e){let t=e.map(e=>Ep[e]??e);return`${t.length===1?t[0]:`${t.slice(0,-1).join(`, `)} and ${t[t.length-1]}`} ${t.length===1?`was`:`were`} never proven by a dry run — run preparation to verify.`}function Wg(e,t){let n=(e??[]).filter(e=>t===void 0||e.lap===t),r=n.filter(e=>e.kind===`review`).at(-1)?.digest?.trim();if(r)return{source:`review`,prose:r};let i=n.flatMap(e=>{let t=e.kind===`review`?``:e.digest?.trim()??``;return t?[{seq:e.seq,title:e.title,digest:t}]:[]});return i.length>0?{source:`tickets`,entries:i}:null}function Gg(e){if(e?.source!==`review`)return null;let[t]=e.prose.trim().split(`
|
|
74
|
+
`);return t?.trim()||null}function Kg(e,t){let n=[...new Set(e.map(e=>e.lap))].sort((e,t)=>e-t),r=n.includes(t)?t:n[n.length-1];return n.map(t=>({lap:t,rows:e.filter(e=>e.lap===t),current:t===r}))}function qg(e,t){let n=e.model?.trim();if(!n)return null;let{runtime:r}=$u(n,{discovered:[],models:t});return{id:n,runtime:r,runtimeLabel:Lp[r]}}function Jg(e,t){let n=e.filter(e=>e.kind!==`review`&&(e.landedLap??e.lap)===t.lap),r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>e.lap<t.lap).length,a=t.lapSessionRan?`Lap ${t.lap}'s session digested your notes and emitted this lap's tickets`:`Lap ${t.lap} is open — its session will digest your notes and emit this lap's tickets`;return{label:`Lap ${t.lap} · ${r} of ${n.length} tickets landed`,story:a,promotedFromEarlier:i}}var Yg=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Xg(e){let t=[];e.quickFix>0&&t.push(`${Yg(e.quickFix,`ticket`)} will mint`),e.carried>0&&t.push(`${Yg(e.carried,`note`)} carried into the lap conversation`),e.quickFix===0&&e.carried>0&&t.push(`review what you're bringing to the conversation → Start lap ${e.nextLap}`);for(let n of e.standing)n.count>0&&t.push(`${Yg(n.count,`unburned fix ticket`)} from lap ${n.lap} will burn with these`);return t.join(` · `)}function Zg(e){let{quickFix:t,carried:n,nextLap:r,live:i}=e,a=i?`End session & start lap ${r}`:`Start lap ${r}`;return t>0&&n===0?[{label:`${a} anyway`,carry:!0},{label:`Mint ${Yg(t,`ticket`)} and burn`,carry:!1}]:t===0?[{label:a,carry:!0}]:[{label:`Mint ${t} · carry ${n} → ${a}`,carry:!0}]}function Qg(e){return e.filter(e=>e.status!==`done`&&e.status!==`failed`&&e.status!==`cancelled`)}function $g(e,t){let n=e.filter(e=>e.lap===t).length,r=e.length-n,i=`Burn ${Yg(e.length,`ticket`)}`;if(r===0)return i;let a=[...new Set(e.filter(e=>e.lap!==t).map(e=>e.lap))];return`${i} — ${n} from lap ${t}${a.length===1?` · ${r} carried from lap ${a[0]}`:` · ${r} carried from earlier laps`}`}function e_(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function t_(e){return new Date(e).toLocaleString()}var n_=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})/g;function r_(e,t=t_){return e.replace(n_,e=>{let n=Date.parse(e);return Number.isNaN(n)?e:t(n)})}function i_(e){return e.slice(0,7)}var a_=[`B`,`kB`,`MB`,`GB`,`TB`];function o_(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=Math.min(Math.floor(Math.log10(e)/3),a_.length-1),n=e/1e3**t;return`${n.toFixed(+(t>0&&n<10))} ${a_[t]}`}function s_(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<5)return`now`;if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function c_(e,t=Date.now()){let n=s_(e,t);return n===`now`?`just now`:`${n} ago`}function l_(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60;return r>0?`${r}h ${String(i).padStart(2,`0`)}m`:i>0?`${i}m ${String(a).padStart(2,`0`)}s`:`${a}s`}function u_(e){return!!e.liveSession&&!e.liveSession.awaitingInput}function d_(e){return e.status===`draft`||e.status===`shipped`||e.status===`archived`||e.activeRun?null:e.liveSession?e.liveSession.awaitingInput?{kind:`grill`,label:`the session is waiting on you`}:null:e.ticketCounts.failed>0?{kind:`attention`,label:`run failed — needs attention`}:e.phase===`planning`?e.ticketCounts.total>0?{kind:`burn`,label:`review & burn tickets`}:{kind:`grill`,label:`needs planning`}:e.phase===`review`?{kind:`ship`,label:`test & merge`}:null}function f_(e,t=Date.now()){let n=d_(e);if(n)return{kind:`needsMe`,text:`Needs you`,title:n.label,needs:n.kind};if(e.activeRun)return{kind:`working`,text:`Working`,title:`agent working`};if(u_(e))return{kind:`working`,text:`Working`,title:`the agent is working in the session`};if(e.status===`shipped`)return{kind:`shipped`,text:``,title:`shipped`};if(e.status===`draft`)return{kind:`draft`,text:`Draft`,title:`parked — click Start to cut its branch`};let r=s_(e.lastActivityAt,t);return{kind:`age`,text:r,title:`last activity ${r===`now`?`just now`:`${r} ago`}`}}function p_(e){let{total:t,done:n}=e.ticketCounts;return t>0?`${n}/${t} done`:null}function m_(e){if(e.length!==0)return[...e].sort((e,t)=>t.startedAt-e.startedAt)[0]}function h_(e){return e.status===`archived`?`archived`:e.status===`shipped`?`shipped`:e.status===`draft`?`drafts`:e.activeRun?`agentWorking`:d_(e)?`needsYou`:u_(e)?`agentWorking`:`inProgress`}function g_(e,t={}){let n={needsYou:[],agentWorking:[],inProgress:[],drafts:[],shipped:[],archived:[]};for(let t of e)n[h_(t)].push(t);let r=[{key:`needsYou`,label:`Needs you`},{key:`agentWorking`,label:`Agent working`},{key:`inProgress`,label:`In progress`},{key:`drafts`,label:`Drafts`},{key:`shipped`,label:`Shipped`}];return t.showArchived&&r.push({key:`archived`,label:`Archived`}),r.map(({key:e,label:t})=>({key:e,label:t,features:n[e]})).filter(e=>e.features.length>0)}var __=[`needsYou`,`agentWorking`,`inProgress`];function v_(e){for(let t of __){let n=e.find(e=>h_(e)===t);if(n)return n}return null}var y_=5;function b_(e,t){return e.key!==`shipped`||e.features.length<=y_?{visible:e.features,expanderLabel:null}:{visible:t?e.features:e.features.slice(0,y_),expanderLabel:t?`Show fewer`:`Show all (${e.features.length})`}}function x_(e,t){if(!t)return;let n=[...e].reverse().find(e=>e.type===`run.reconciled`&&e.runId===t);if(!n?.runId||typeof n.data!=`object`||n.data===null)return;let{workflow:r,landedTickets:i,pendingTickets:a}=n.data;if(!(r!==`ticket-burner`||typeof i!=`number`||typeof a!=`number`))return{runId:n.runId,landedTickets:i,pendingTickets:a}}function S_(e){let t=new Map;for(let n of e){if(n.type!==`ticket.gate_unrunnable`||typeof n.data!=`object`||n.data===null)continue;let{command:e,error:r}=n.data;typeof e!=`string`||typeof r!=`string`||e.trim()&&r.trim()&&!t.has(e.trim())&&t.set(e.trim(),{command:e.trim(),error:r.trim()})}return[...t.values()]}var C_=e=>e.error?.toLowerCase().startsWith(`stopped`)||e.orphaned||e.error?.toLowerCase().includes(`orphaned`),w_=(e=``)=>/\b(?:git|docker|podman|mount|sandbox)\b/i.test(e);function T_(e){return e.status===`cancelled`?`waived`:e.status===`failed`?C_(e)?`stopped`:e.hadOutput===!1&&w_(e.error??``)?`launch-failed`:`failed`:e.status===`done`?`done`:e.status===`burning`||e.status===`running`?`burning`:`pending`}function E_(e){if(![`failed`,`launch-failed`].includes(T_(e)))return null;let t=e.error?.trim()||`The ticket did not complete.`,n=/agent made no commits/i.test(t)?`The burner verifies commits landed on the ticket branch — none did`:T_(e)===`launch-failed`?`The agent sandbox never started.`:t,r=/windows|path too long|long path/i.test(t)?`A long Windows path may have prevented the sandbox mount.`:void 0;return{text:n,...r?{hint:r}:{}}}function D_(e){return{done:e.filter(e=>T_(e)===`done`).length,failed:e.filter(e=>[`failed`,`launch-failed`].includes(T_(e))).length,stopped:e.filter(e=>T_(e)===`stopped`).length,waived:e.filter(e=>T_(e)===`waived`).length}}function O_(e,t={},n){if(n!==void 0)return`Retrying #${n}`;let r=e.some(e=>e.kind===`review`&&e.reviewVerdict===`unverified`);if(t.status===`succeeded`&&r)return`Succeeded-unverified · nothing verified`;let i=e.filter(e=>e.kind!==`review`&&!e.reviewFix).length,a=e.filter(e=>e.reviewFix).length,o=D_(e);if(t.status===`succeeded`&&e.length>0&&o.done===e.length)return`All ${e.length} ticket${e.length===1?``:`s`} landed ✓`;let s=[`${t.status&&t.status!==`running`?`Burned`:`Burning`} ${i} ticket${i===1?``:`s`}`];return a&&s.push(`+${a} fixes from review`),o.done&&s.push(`${o.done} done`),o.failed&&s.push(`${o.failed} failed`),o.stopped&&s.push(`${o.stopped} stopped`),o.waived&&s.push(`${o.waived} waived`),s.join(` · `)}function k_(e){let t=e/6e4;if(t<1)return`under a minute`;if(t<60)return`~${Math.round(t)} min`;let n=t/60;return`~${n<10?String(Math.round(n*10)/10):Math.round(n)}h`}function A_(e){return!e||e.sampleSize===0||e.medianMs<=0?`Typically a few minutes per ticket.`:`Tickets have been taking ${k_(e.medianMs)} each.`}var j_=/<promise>\s*COMPLETE\s*<\/promise>/i,M_=new RegExp(j_,`gi`);function N_(e){return e.replace(M_,``).replace(/\n{3,}/g,`
|
|
75
|
+
|
|
76
|
+
`).trim()}function P_(e){return j_.test(e)}function F_(e){return e.replace(/^.*?(?:\/|\\)repo(?:\/|\\)/,``)}var I_=/[^\s"'`,)]*[/\\]repo[/\\][^\s"'`,)]*/g;function L_(e){return e.replace(I_,F_)}function R_(e){let t=[];for(let n of e){if(n.kind===`tool`){t.push({kind:`tool`,name:n.name??`tool`,args:z_(n.text)});continue}let e=t[t.length-1];e&&e.kind===`text`?e.text+=n.text:t.push({kind:`text`,text:n.text})}let n=!1;return{blocks:t.map(e=>e.kind===`text`?(P_(e.text)&&(n=!0),{...e,text:N_(e.text)}):e).filter(e=>e.kind!==`text`||e.text.length>0),completed:n}}function z_(e){let t=L_(e.replace(/\s+/g,` `).trim());return t.length>300?`${t.slice(0,300)}…`:t}function B_(e){let t=[...e].sort((e,t)=>e.seq-t.seq),n=t.filter(e=>e.kind===`review`&&e.passKind!==`verification`).at(-1),r=t.filter(e=>e.kind===`review`&&e.passKind===`verification`),i=n?t.filter(e=>e.originFindingId&&e.seq>n.seq):[],a=new Set([...r,...i]),o=t.filter(e=>!a.has(e)),s=i.length||o.filter(e=>e.kind!==`review`).length,c=[];return o.length>0&&c.push({kind:`plain`,rows:o}),i.length>0&&c.push({kind:`review-fixes`,title:`Review fixes`,rows:i}),r.length>0&&c.push({kind:`verification`,title:`Verifying ${s} fixes — recording a fresh walkthrough`,rows:r}),c}function V_(e){let t=new Map;for(let n of e){if(!n.ticketId)continue;let e=t.get(n.ticketId),r=n.type===`burn.text`||n.type===`burn.tool`;e?r&&(e.hadOutput=!0):t.set(n.ticketId,{hadOutput:r,startedAt:n.ts})}return t}function H_(e,t){if(e.length<2)return;let n=e.filter(e=>[`pending`,`burning`].includes(T_(e)));if(n.length===1)return t.some(e=>e.type===`ticket.retry`&&e.ticketId===n[0].id)?n[0].seq:void 0}function U_(e){let t=Gd(e.ctx.docsDigestBytes??0);return Kd([...t?[t]:[],...Wd(e.pendingTickets)])}var W_={label:`Chat`,kind:`chat`};function G_(e){let{full:t,ctx:n,live:r,resumableChat:i,ticketCount:a,done:o,failed:s,pending:c,pendingTickets:l,run:u,running:d}=e,f={label:`Merge & ship`,kind:`merge`},p=A_(n.burnStats),m=U_(e);if(d)return{kick:`IN PROGRESS`,title:`Burning tickets`,desc:`Burning ${a} ticket${a===1?``:`s`} — ${o} done${s?`, ${s} failed`:``}.`,primary:{label:`Cancel run`,kind:`cancelRun`,danger:!0},secondary:[W_,f],busy:!0};let h=n.interruptedBurn;if(h&&h.runId===u?.id){let e=h.landedTickets;return h.pendingTickets>0?{alert:!0,kick:`INTERRUPTED`,title:`A burn was interrupted by a server restart: ${e} ticket${e===1?``:`s`} landed, ${h.pendingTickets} pending`,desc:`Resume the burn to sweep orphaned work and continue the remaining tickets.`,primary:{label:`Resume burn`,kind:`burn`},secondary:[W_],busy:!1}:{kick:`RECOVERED`,title:`A burn was interrupted by a server restart: ${e} ticket${e===1?``:`s`} landed, 0 pending`,desc:`All ticket work landed before the restart. Resume the burn to finalize it — it hands off to review on its own.`,primary:{label:`Resume burn`,kind:`burn`},secondary:[W_],busy:!1}}return a===0?r?{kick:`WAITING`,title:`No tickets to burn`,desc:`This feature reached the build state with an empty ledger. The live session breaks the work into tickets — they appear here as they land.`,primary:void 0,secondary:[W_,f],busy:!1}:{kick:`WAITING`,title:`No tickets to burn`,desc:`This feature reached the build state with an empty ledger. A session breaks the work into tickets — open one, and the burn has something to run.`,primary:{label:i?`Resume the session`:`Open a session`,kind:`chat`},secondary:[f],busy:!1}:u?{kick:`NEXT STEP`,title:`Resume the burn`,desc:`${u.status===`failed`?`The run failed — resume the burn to retry.`:u.status===`cancelled`?`The run was cancelled — resume the burn to continue.`:`The burn has not started — resume to run the tickets.`} ${p}`,primary:{label:`Resume burn`,kind:`burn`},secondary:[W_,f],busy:!1,...m?{note:m}:{}}:{kick:`NEXT STEP`,title:c===1?`Review & burn the ticket`:`Review & burn the tickets`,desc:`Read the card — edit it if it is not quite right — then burn it into commits. ${p}`,primary:{label:$g(l,t.feature.lap),kind:`burn`},secondary:[W_,f],busy:!1,...m?{note:m}:{}}}var K_={loading:`Loading the branch list…`,unpicked:`pick a branch first`};function q_({ctx:e}){return{kick:`NEXT STEP`,title:`Start this feature`,desc:`Parked as a draft — Start cuts its branch, writes the brief, and opens the ideation session.`,primary:{label:`Start`,kind:`startDraft`,...e.draftBaseMissing?{disabled:K_[e.draftBaseMissing]}:{}},secondary:[],busy:!1}}function J_(e){if(e.feature.mapped)return e.docs.find(e=>e.relPath.endsWith(`map.md`))?.relPath}function Y_(e){let t={},n=null,r=[],i=()=>{n!==null&&(t[n]=r.join(`
|
|
77
|
+
`)),r.length=0};for(let t of e.split(`
|
|
78
|
+
`)){let e=t.match(/^##\s+(.+?)\s*$/);e?(i(),n=e[1]):n!==null&&r.push(t)}return i(),t}var X_={ready:`Ready`,working:`Working`,waiting:`Waiting`,done:`Done`};function Z_(e){return e.status===`resolved`||e.status===`dropped`}function Q_(e){let t=new Set(e.frontierIds);return e.waypoints.filter(e=>t.has(e.id)).sort((e,t)=>e.seq-t.seq)[0]}function $_(e,t){let n=new Set(t);return{done:e.filter(Z_).length,total:e.length,ready:e.filter(e=>n.has(e.id)).length}}function ev(e,t,n=!1){let r=new Set(t),i=new Map(e.map(e=>[e.id,e])),a=new Map(e.map(e=>[e.seq,e])),o=e=>Z_(e)?`done`:e.status===`claimed`?`working`:r.has(e.id)?`ready`:`waiting`,s={ready:[],working:[],waiting:[],done:[]};for(let t of e){let e=o(t),r=t.blockedBy.map(e=>a.get(e)).filter(e=>!!e&&!Z_(e)).map(e=>e.title);s[e].push({waypoint:t,blockerTitles:r,originTitle:t.originWaypointId?i.get(t.originWaypointId)?.title:void 0,stateWord:e===`ready`?`Ready`:e===`working`?`Working`:e===`waiting`&&r[0]?`Waiting on "${r[0]}"`:e===`waiting`?`Waiting`:`Done`,openByDefault:n||e===`ready`})}return s.ready.sort((e,t)=>e.waypoint.seq-t.waypoint.seq),[`ready`,`working`,`waiting`,`done`].map(e=>({key:e,label:X_[e],waypoints:s[e]})).filter(e=>e.waypoints.length>0)}var tv={"claude-code":`Claude`,codex:`Codex`};function nv(e){return e?tv[e]:`the agent`}function rv(e){return nv(e.runtime??`claude-code`)}var iv=`A map breaks a big idea into waypoints — questions each worked in its own session. The feature converges once every waypoint is done.`,av=`Burning runs each ticket as its own sandboxed agent, in parallel, committing to the feature branch.`,ov=`Notify me when agents finish a run`,sv=`stop timed out — the process may still be running`,cv=`An AFK burn is a burn you walk away from: runcastle runs the tickets in containers, unattended, and you read the result when you are back.`;function lv(e){return e<=1?`Lap 1 — this feature’s first pass through the pipeline. Iterate, from review, opens the next one.`:`Lap ${e} — Iterate sent this feature back through the pipeline for another pass. Earlier laps’ docs, tickets and commits are all kept.`}function uv(e){let{full:t,ctx:n,live:r,pending:i,pendingTickets:a}=e,{feature:o,sessions:s,waypoints:c,frontierIds:l}=t,u={label:`Merge & ship`,kind:`merge`},d=e=>o.lap>1?pv(`LAP LIVE`,`Lap ${o.lap} in progress`,`The lap session digests the drive, amends the docs and emits this lap’s tickets.`,void 0,[u]):e===`tickets`?pv(`WAITING`,`Emitting tickets`,`The session is breaking the spec into tickets. They appear below as they land; review them, then burn.`,void 0,[u]):pv(`SESSION LIVE`,`Planning session in progress`,`Shape the feature with ${rv(r)} in the terminal. It writes each decision to the pane on the left, then the spec, then this lap’s tickets.`,void 0,[u]),f=dv(e),p=f.hasTickets?null:Xd(f);if(i>0&&r&&o.ticketsReadyLap!==o.lap)return pv(`WAITING`,`Finishing the tickets`,`The session is finishing the tickets — enriching them, then closing out this lap’s planning. Burn arms the moment it does.`,void 0,[u]);if(p===null){let t=U_(e);return{kick:`NEXT STEP`,title:`Review the tickets, then burn`,desc:`${i} ticket${i===1?``:`s`} ready. Each one runs as its own sandboxed agent, in parallel, committing to the feature branch. Set a model per ticket, or for all of them, before you burn.`,primary:{label:$g(a,o.lap),kind:`burn`},secondary:[{...W_,hint:`Open the chat to change the tickets before burning`},u],busy:!1,...t?{note:t}:{}}}let m=!!r||s.some(e=>e.lap===o.lap&&[`chat`,`converge`].includes(e.kind));if(o.lap>1&&!m){let e=Hg(s,`chat`);return pv(`NEXT STEP`,`Work lap ${o.lap}`,`Your test-drive notes are waiting. The lap session reads them, amends the spec, and emits this lap’s tickets — then hands back to Burn.`,{label:`${e?`Resume`:`Start`} lap ${o.lap} session`,kind:`chat`},[u])}if(o.mapped&&c.length>0&&c.every(Z_))return pv(`MAP`,`The map is complete`,`Every waypoint is done. Converge to turn the map and its decisions into a spec and tickets in one session.`,{label:`Converge`,kind:`converge`},[u]);if(r)return d(p);if(o.mapped){let e=Q_(t),r=n.mapContent?Y_(n.mapContent)[`Not yet specified`]?.trim():void 0;if(e){let t=c.filter(Z_).length;return{...pv(`MAP`,`Work the map`,`${t} of ${c.length} waypoints done · ${l.length} ready to work — next: ${e.title} · pick a different one in the map.`,{label:`Work next`,kind:`workNext`,waypointId:e.id},[u]),...r?{note:`Still unspecified: ${r}`}:{}}}let i=c.filter(e=>e.claimedBy?.startsWith(`run_`)).length;if(i>0)return pv(`WAITING`,`Waiting on ${i} research run${i===1?``:`s`}`,`Research is running unattended. Its waypoints open up when it finishes.`,void 0,[u])}switch(p){case`ideation`:return Hg(s,`chat`)?pv(`NEXT STEP`,`Pick the conversation back up`,`The chat ended. Resume it to carry on where you left off — the conversation is still on disk.`,{label:`Resume session`,kind:`chat`},[u]):pv(`NEXT STEP`,`Shape the idea with the agent`,`Start a session: the agent asks about the idea until it is concrete enough to write up, and every decision lands in the pane on the left.`,{label:`Start session`,kind:`chat`},[u]);case`spec`:return o.mapped?pv(`NEXT STEP`,`Finish converging`,`The converge session ended before the spec and tickets were written. Resume it — it picks up from the map and the decisions.`,{label:`Resume converge`,kind:`resumeConverge`},[u]):pv(`NEXT STEP`,`Write the spec`,`The decisions are settled. The session turns them into a spec — the approach, the seams and what is out of scope — and then breaks it into tickets.`,{label:fv(s),kind:`chat`},[u]);case`tickets`:return pv(`NEXT STEP`,`Emit the tickets`,`The spec is written and nothing is pending. A session breaks it into tickets — each one burns as its own sandboxed agent.`,{label:fv(s),kind:`chat`},[u])}}function dv(e){let{docs:t}=e.full,n=e=>t.some(t=>t.relPath.endsWith(e));return{hasDecisions:n(`decisions.md`),hasSpec:n(`spec.md`),hasTickets:e.pending>0}}function fv(e){return Hg(e,`chat`)||Hg(e,`converge`)?`Resume session`:`Start session`}function pv(e,t,n,r,i=[]){return{kick:e,title:t,desc:n,primary:r,secondary:r?.kind===`chat`?i:[W_,...i],busy:!1}}function mv(e){return e?.devUrl?e.devReady?{url:e.devUrl,state:`ready`}:{url:e.devUrl,state:e.devReadyTimedOut?`timedOut`:`starting`}:null}function hv(e){return e.state===`timedOut`?`${e.url} — not answering`:`starting… ${e.url}`}function gv(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function _v(e){return`${gv(e)} is running — stop it first`}function vv(e,t={}){let n=e?.hookFailure;return n?{command:n.command,outcome:n.timedOut?`timed out`:`exited ${n.exitCode??`without a code`}`,output:n.output,canFix:!t.sessionLive}:null}var yv=[`ticket.retry`,`burn.started`,`feature.shipped`];function bv(e,t=[],n){let r=null;for(let t of e)if(t.type===`reviewdrive.denied`){let e=t.data??{};r={eventId:t.id,dirtyFiles:Array.isArray(e.dirtyFiles)?e.dirtyFiles.filter(e=>typeof e==`string`):[],message:t.message,at:t.ts}}else yv.includes(t.type)&&(r=null);return!r||r.eventId===n||r.at<Math.max(...t.map(e=>e.startedAt),-1/0)?null:r}var xv=e=>({showDevChip:e,showBranch:e,showOutput:e}),Sv={idle:{barTitle:`Review the build`,barDesc:`Open the app when you are ready to test it.`,primary:`start`,stageKind:`player`,footer:xv(!1)},starting:{barTitle:`Starting the test drive`,barDesc:`Preparing the branch and development server.`,primary:`stop`,stageKind:`starting`,footer:xv(!0)},serving:{barTitle:`Test-driving the branch — merge when it looks right`,barDesc:`The development server is ready.`,primary:`stop`,stageKind:`panel`,footer:xv(!0)},"bare-checkout":{barTitle:`Branch checked out for inspection`,barDesc:`Branch checked out — nothing started. This project has no dev command · Set one in Settings`,primary:`stop`,stageKind:`bare`,footer:xv(!0)},"setup-failed":{barTitle:`Drive setup failed — fix it or stop the drive`,barDesc:`The project setup command did not complete.`,primary:`fixDrive`,stageKind:`failed`,footer:xv(!0)},"review-agent-driving":{barTitle:`Review agent driving`,barDesc:`review agent driving — notes land below as it finds things`,primary:`stop`,stageKind:`agent`,footer:xv(!0)}};function Cv(e,t={}){return Sv[e]}var wv=[`starting`,`bare-checkout`,`setup-failed`,`review-agent-driving`];function Tv(e){let{full:t,ctx:n,live:r,failed:i,pending:a,pendingTickets:o,run:s}=e,{feature:c}=t,l=a>0?[{label:$g(o,c.lap),kind:`burn`}]:[],u=n.driveState&&n.driveState!==`idle`?n.driveState:n.driving?`serving`:`idle`,d=u!==`idle`,f=Cv(u),p=d?{label:`Stop test drive`,kind:`testDriveStop`}:{label:`Start test drive`,kind:`testDriveStart`,...n.slotHolder?{disabled:_v(n.slotHolder)}:{}},m=n.openNotes??0,h=n.openDefects??0,g=m+h,_=g>0?{pills:[...h>0?[{label:Yg(h,`defect`),tone:`danger`}]:[],...m>0?[{label:Yg(m,`note`),tone:`note`}]:[]],trailing:`open`}:{pills:[{label:`Nothing open`,tone:`clear`}]},v={label:r?`End session & iterate`:`Iterate`,kind:r?`endSessionAndIterate`:`iterate`,...d?{disabled:`Stop the test drive first — the branch is checked out`,escape:{label:`Stop drive and iterate`,kind:`stopDriveAndIterate`}}:{}},y=[v];if(n.conflict)return{kick:`MERGE CONFLICT`,title:`Resolve the merge conflict`,desc:r?`Merging ${n.conflict.base} in hit conflicts. An agent can resolve them on this branch — or type the resolution into the session you already have open.`:`Merging ${n.conflict.base} in hit conflicts. An agent can resolve them on this branch, then Merge & ship retries.`,primary:{label:r?`End session & resolve`:`Resolve the merge conflict`,kind:`resolveConflict`},secondary:[W_,{label:`Retry Merge & ship`,kind:`merge`},...l,p,...y],busy:!1,counts:_,...r?{note:kg}:{}};if(wv.includes(u)){let e=f.primary===`fixDrive`?{label:`Fix drive`,kind:`fixDrive`}:p;return{kick:`NEXT STEP`,title:f.barTitle,desc:f.barDesc,primary:e,secondary:[W_,{label:`Merge & ship`,kind:`merge`},...l,...e.kind===`testDriveStop`?[]:[p],...y],busy:!1,counts:_}}if(g>0)return{kick:`NEXT STEP`,primary:v,secondary:[W_,{label:`Merge & ship`,kind:`merge`},...l,p],busy:!1,counts:_};if(a>0)return{kick:`NEXT STEP`,title:`Burn the fix tickets`,desc:d?`Test-driving the branch — burn the fix tickets when you’re ready.`:`${a} fix ticket${a===1?``:`s`} ready — burn to run them, then review again.`,primary:{label:$g(o,c.lap),kind:`burn`},secondary:[W_,{label:`Merge & ship`,kind:`merge`},p,...y],busy:!1,counts:_};if(n.laterLaps)return{kick:`NEXT STEP`,title:`Lap ${c.lap} is done — the spec plans lap ${c.lap+1}`,desc:`This lap is reviewable, and the spec still lists scope it deliberately deferred. Start lap ${c.lap+1} to take it on — or ship what landed, if lap ${c.lap} is enough.`,primary:{...v,label:r?`End session & start lap ${c.lap+1}`:`Start lap ${c.lap+1}`},secondary:[W_,{label:`Merge & ship`,kind:`merge`},p],busy:!1,counts:_};if(n.unverifiedReview){let e=n.unverifiedReview.reason?.trim();return{kick:`NEXT STEP`,title:`Nothing was verified this lap`,desc:`The review pass produced no evidence${e?` — ${e}`:``}. Run another agentic review from the review page, or drive the branch yourself, before you ship.`,secondary:[{label:`Merge & ship`,kind:`merge`},...l,p,...y],busy:!1,counts:_}}let b=d?`${f.barTitle}.`:i>0?`Run finished with ${i} failed ticket${i===1?``:`s`} — review, then ship.`:s?`Checks are in. Test-drive the branch, then merge to ship.`:`No run has been recorded on this branch — test-drive it yourself before merging.`;return{kick:`NEXT STEP`,title:d?`Merge when it looks right`:`Test drive, then ship`,desc:b,primary:{label:`Merge & ship`,kind:`merge`},secondary:[W_,p,...y],busy:!1,counts:_}}function Ev(e){return{kick:`SHIPPED`,title:`Shipped to main`,desc:`The branch is merged and the pipeline is complete. The chat is still here — ask it anything, or draft the next lap.`,primary:void 0,secondary:[W_],busy:!1}}function Dv(e,t){let{feature:n,tickets:r,sessions:i,runs:a}=e,o=Vg(i),s=Hg(i,`chat`),c=r.filter(e=>e.lap===n.lap),l=c.filter(e=>e.status!==`cancelled`).length,u=r.length,d=r.filter(e=>e.status===`done`).length,f=r.filter(e=>e.status===`failed`).length,p=Qg(r),m=p.length,h=m_(a),g={full:e,ctx:t,live:o,resumableChat:s,lapTickets:c,lapTicketCount:l,ticketCount:u,done:d,failed:f,pending:m,pendingTickets:p,run:h,running:h?.status===`running`};if(n.status===`draft`)return q_(g);if(n.status===`archived`)return{kick:`ARCHIVED`,title:`Feature archived`,desc:`This feature is archived and out of the pipeline. Unarchive it to pick the work back up.`,primary:{label:`Unarchive`,kind:`unarchive`},secondary:[],busy:!1};switch(n.phase){case`planning`:return uv(g);case`building`:return G_(g);case`review`:return Tv(g);case`shipped`:return Ev(g)}}var Ov=[`planning`,`building`,`review`,`shipped`],kv={planning:`planning`,building:`build`,review:`review`,shipped:`shipped`},Av={planning:`Shape the feature, write its spec, and emit tickets`,building:`Agents implement each ticket in a sandbox`,review:`Test-drive the branch, plan more work, or merge`,shipped:`Merged to main`},jv={building:`Opens when you click Burn`,review:`Opens when the burn finishes`,shipped:`Opens when you merge`};function Mv(e){return Ov.indexOf(e)}function Nv(e,t){let n=Mv(t)-Mv(e.phase);return n<0?`done`:n===0?`current`:`upcoming`}function Pv(e){return Ov.map(t=>({phase:t,state:Nv(e,t)}))}function Fv(e,t){return t??e.phase}function Iv(e,t){return Mv(t)<Mv(e.phase)}function Lv(e,t,n={}){return Ov.map(r=>{let i=Nv(e,r),a=i===`done`?`${n[r]||kv[r]} — click to review`:i===`current`||r===`planning`?Av[r]:jv[r];return{phase:r,label:kv[r],state:i,isViewed:r===t,clickable:i!==`upcoming`,tip:a}})}function Rv(e){let t=e.length,n=e.filter(e=>e.status===`done`).length,r=e.filter(e=>e.status===`failed`).length;return{key:`tickets`,value:`${n}/${t} done${r>0?` · ${r} failed`:``}`,tone:r>0?`danger`:t===0?`idle`:n===t?`ok`:`warn`}}function zv(e){if(!e)return{key:`run`,value:`no run recorded`,tone:`idle`};let t=e.status===`succeeded`?`ok`:e.status===`failed`?`danger`:`warn`;return{key:`run`,value:`${e.status}${e.summary?` · ${e.summary}`:``}`,tone:t}}function Bv(e){return e===void 0?{key:`changes`,value:`commit count unknown`,tone:`idle`}:{key:`changes`,value:`${e} commit${e===1?``:`s`}`,tone:e>0?`ok`:`warn`}}function Vv(e){return[...e].sort((e,t)=>(e.completedAt??-1/0)-(t.completedAt??-1/0)||e.seq-t.seq).at(-1)}function Hv(e){return Vv(e.filter(e=>e.completedAt!==null))??null}function Uv(e){let t=Vv((e.tickets??[]).filter(e=>e.kind===`review`).map((e,t)=>({...e,seq:e.seq??t})));return t?t.status===`failed`?{state:`failed`,...t.error?{reason:t.error}:{}}:t.status===`done`?{state:`ran`,...e.findings===void 0?{}:{findings:e.findings}}:{state:`waiting`,status:t.status}:{state:`none`}}function Wv(e,t,n){if(n?.state===`running`)return{tone:`verifying`,text:`Verification running — evidence below predates it`};if(n?.state===`failed`){let e=n.reason?.trim();return{tone:`failed`,text:`verification could not run${e?`: ${e}`:``}`}}return e?t.landedSince===0?{tone:`fresh`,text:`Reviewed ✓ · this build`}:{tone:`stale`,text:`Reviewed ${t.lap!==void 0&&t.lap>e.lap?`${t.lap-e.lap} ${t.lap-e.lap===1?`lap`:`laps`} ago`:`earlier this lap`} · ${t.landedSince} tickets landed since — evidence may be outdated`}:{tone:`none`,text:`no review yet`}}function Gv(e){let t=e.filter(e=>e.kind===`review`&&e.passKind===`verification`).at(-1);if(t){if(t.status===`failed`)return{state:`failed`,...t.error?{reason:t.error}:{}};if(!(t.status===`done`||t.status===`cancelled`))return{state:`running`}}}function Kv(e){let t=Wv(e.artifact,{landedSince:e.landedSince,lap:e.currentLap},e.verification),n=e.unverifiedKeys??[],r=e.tickets.filter(t=>t.kind!==`review`&&(t.landedLap??t.lap)===e.currentLap),i=r.filter(e=>e.status===`done`).length,a=r.filter(e=>e.status===`cancelled`).length,o=e.shipped?`Shipped after ${e.currentLap} lap${e.currentLap===1?``:`s`}`:`Lap ${e.currentLap} · ${i} of ${r.length} tickets landed · ${a} waived`;return[{key:`review`,label:t.text,tone:t.tone===`fresh`?`ok`:t.tone===`none`?`idle`:`warn`},{key:`checks`,label:`${e.checks.passed}/${e.checks.total} checks passed`,tone:e.checks.total>0&&e.checks.passed===e.checks.total?`ok`:`warn`},...n.length===0?[]:[{key:`unverified`,label:`${n.length} check${n.length===1?``:`s`} unverified in drive`,tone:`warn`,detail:Ug([...n])}],{key:`lap`,label:o,tone:a?`warn`:`idle`},...e.driveLap===void 0?[]:[e.driveLap===null?{key:`drive`,label:`never test-driven`,tone:`warn`}:{key:`drive`,label:`test drive taken · lap ${e.driveLap}`,tone:`ok`}],{key:`run`,label:e.runState,tone:e.runState===`succeeded`?`ok`:e.runState===`failed`?`danger`:`warn`}]}function qv(e){let t=`review agent`;switch(e.state){case`none`:return null;case`waiting`:return{key:t,value:`ticket ${e.status}`,tone:`warn`};case`failed`:return{key:t,value:`could not run${e.reason?` · ${e.reason}`:``}`,tone:`warn`};case`ran`:{let n=e.findings;return n===void 0?{key:t,value:`ran · findings unknown`,tone:`idle`}:n===0?{key:t,value:`no findings`,tone:`ok`}:{key:t,value:`${n} finding${n===1?``:`s`}`,tone:`warn`}}}}var Jv={key:`review agent`,value:`no review ran this lap`,tone:`warn`};function Yv(e){return[qv(Uv({tickets:e.tickets,findings:e.findings}))??Jv,Rv(e.tickets??[]),zv(e.run),Bv(e.commitCount)]}function Xv(e){if(!e||e.found+e.observations===0)return null;let t=[e.found===0?`no defects found`:`${e.found} defect${e.found===1?``:`s`} found`];return e.fixed>0&&t.push(`${e.fixed} fixed automatically`),e.open>0&&t.push(`${e.open} still open`),t.join(` · `)}function Zv(e){if(e.openReason===`over-cap`)return`over the auto-fix cap`;if(e.openReason===`fix-failed`){let t=e.failureReason?.trim();return t?`fix failed: ${t}`:`fix failed`}return e.openReason===`verification`?`found by the verification pass — not auto-fixed`:null}function Qv(e){let t=e.resolutionNote?.trim()||void 0;return e.status===`carried`?{text:`captured lap ${e.lap}, carried into lap ${e.carriedLap}`,evidence:`carried`,...t?{note:t}:{}}:e.status===`fixed`?e.resolvedBy===`session`?{text:`closed by a lap session as addressed — no fix ticket verified it`,evidence:`attested`,...t?{note:t}:{}}:e.resolvedBy===`fix-ticket`?{text:`fixed by its fix ticket`,evidence:`verified`}:null:null}function $v(e){let[t]=(e??``).trim().split(`
|
|
79
|
+
`);return t?.trim()||null}function ey(e,t){if(!e)return{kind:`none`};let n=t.find(t=>t.id===e.ticketId);if(n?.status===`failed`)return{kind:`could-not-run`};if(e.reviewVerdict===`verified`)return{kind:`verified`,mode:e.reviewMode};if(e.reviewVerdict===`unverified`){let t=$v(n?.digest),r=e.reviewVerdictReason?.trim()||null;return{kind:`unverified`,line:t,reason:t&&r&&t.includes(r)?null:r}}return{kind:`none`}}function ty(e){let t=e.passes??[],n=e.tickets??[],r=e.findings??[],i=e.notes??[];return[...new Set([e.currentLap,...t.map(e=>e.lap),...n.map(e=>e.lap),...r.map(e=>e.lap),...i.map(e=>e.lap)])].sort((e,t)=>t-e).map(e=>{let a=t.filter(t=>t.lap===e),o=Hv(a),s=r.filter(t=>t.lap===e&&t.kind===`defect`);return{lap:e,completedAt:o?.completedAt??null,outcome:ey(o,n),burned:n.filter(t=>t.lap===e&&t.kind!==`review`&&t.status===`done`).length,passes:a.map(e=>({ticketId:e.ticketId,seq:e.seq,passKind:e.passKind,mode:e.reviewMode,verdict:e.reviewVerdict,couldNotRun:n.find(t=>t.id===e.ticketId)?.status===`failed`,videoUrl:e.videoUrl})),defects:{found:s.length,fixed:s.filter(e=>e.status===`fixed`||e.fixTicketId&&n.find(t=>t.id===e.fixTicketId)?.status===`done`).length,carried:s.filter(e=>e.status===`carried`).length},notes:i.filter(t=>t.lap===e).length}})}function ny(e){let t=ey(Hv((e.passes??[]).filter(t=>t.lap===e.currentLap)),e.tickets??[]);return t.kind===`unverified`?t:null}var ry=80;function iy(e){let t=e.trim(),n=t.indexOf(`
|
|
80
|
+
`),r=n===-1?t:t.slice(0,n);if(r.length<=ry)return{head:r,rest:t.slice(r.length).trim()};let i=r.lastIndexOf(` `,ry),a=i>ry/2?i:ry;return{head:`${r.slice(0,a).trimEnd()}…`,rest:t.slice(a).trim()}}function ay(e){return e.docs.find(e=>e.relPath.endsWith(`spec.md`))?.relPath}function oy(e){return e.docs.find(e=>e.relPath.endsWith(`outcome.md`))?.relPath}function sy(e){return e&&Y_(e)[`Later laps`]?.trim()||null}var cy=180;function ly(e){let t=e.replace(/\s+/g,` `).trim();return t.length>cy?`${t.slice(0,cy).trimEnd()}…`:t}function uy(e){let t=`what lands`;if(e?.commits===void 0)return{key:t,value:`scale unknown`,tone:`warn`};let n=e.files===void 0?[]:[Yg(e.files,`file`)];return{key:t,value:[Yg(e.commits,`commit`),...n].join(` · `),tone:e.commits>0?`ok`:`warn`}}function dy(e){let t=e.filter(e=>e.kind!==`review`);if(t.length===0)return{key:`run`,value:`no tickets burned`,tone:`warn`};let n=t.filter(e=>e.status===`done`).length,r=t.filter(e=>e.status===`cancelled`).length,i=t.filter(e=>e.status===`failed`).length,a=[`${n}/${t.length} tickets done`];return r>0&&a.push(`${r} waived`),i>0&&a.push(`${i} failed`),{key:`run`,value:a.join(` · `),tone:n===t.length?`ok`:`warn`}}function fy(e,t){let n=e.filter(e=>e.kind!==`review`&&e.status===`pending`&&e.lap<t);return[...new Set(n.map(e=>e.lap))].sort((e,t)=>t-e).map(e=>({lap:e,count:n.filter(t=>t.lap===e).length}))}function py(e){switch(e.tone){case`fresh`:return null;case`none`:return`No review has run on this branch — nothing was checked for you.`;case`verifying`:return`A verification pass is still running — this summary predates it.`;case`failed`:return`The review evidence is not fresh: ${e.text}.`;case`stale`:return`${e.text}.`}}function my(e){let t=e.tickets??[],n=e.driveTaken?{key:`test drive`,value:`taken`,tone:`ok`}:{key:`test drive`,value:`never test-driven`,tone:`warn`},r={key:`review`,value:e.freshness.text,tone:e.freshness.tone===`fresh`?`ok`:`warn`},i=[];e.burning&&i.push(`A burn is live — work landing after this merge stays unshipped on the branch.`),e.projectDrive&&i.push(`${gv(e.projectDrive.holderLabel)} is running on your checkout — merging stops it.`);let a=e.openNotes??0;a>0&&i.push(`${Yg(a,`open test-drive note`)}.`);let o=t.filter(e=>e.kind!==`review`&&e.status===`cancelled`).length;o>0&&i.push(`${Yg(o,`ticket`)} waived — set aside unfinished, not delivered.`);for(let n of fy(t,e.lap??1))i.push(`${Yg(n.count,`unburned fix ticket`)} from lap ${n.lap} — merging leaves them behind.`);let s=py(e.freshness);return s&&i.push(s),e.laterLaps&&i.push(`The spec still lists deferred scope: ${ly(e.laterLaps)}`),{conflictRow:e.conflict?`⚠ A merge conflict is standing (${e.conflict.files.join(`, `)||e.conflict.base}) — this merge will fail unless it’s been resolved.`:null,rows:[uy(e.delta),dy(t),n,r],warnings:i,next:`Merges ${e.branch} into ${e.base??`its base branch`}, writes the outcome doc, and moves the feature to Shipped.`}}function hy(e){return e.filter(e=>e.workflow===`ticket-burner`).length+1}function gy(e,t){let n=[...new Set(e.flatMap(e=>{let t=e.model?.trim();return t?[t]:[]}))],r=e.some(e=>!e.model?.trim()),i=t||`the project model`;return{key:`model`,value:[...n,...r||n.length===0?[i]:[]].join(` · `),tone:`ok`}}function _y(e){let t=e.pendingTickets,n=t.filter(t=>t.lap!==e.lap).length;return{rows:[{key:`what burns`,value:n>0?`${Yg(t.length,`ticket`)} · ${n} carried from earlier laps`:Yg(t.length,`ticket`),tone:t.length>0?`ok`:`warn`},{key:`lap`,value:`lap ${e.lap} — stamped by this click`,tone:`ok`},gy(t,e.defaultModel)],warnings:e.warnings??[],next:`Burns ${Yg(t.length,`ticket`)} in parallel sandboxes, each committing to ${e.branch}, and moves the feature to Building.`}}function vy(e,t){let n=e.waypoints.find(e=>e.lastSessionId===t.id);if(!n||!Z_(n))return{kind:`notDone`};let r=e.waypoints.filter(t=>e.frontierIds.includes(t.id)).sort((e,t)=>e.seq-t.seq)[0];if(r)return{kind:`workNext`,waypoint:n,next:r};let i=e.waypoints.filter(e=>e.status===`claimed`).length;return i>0?{kind:`awaitingResearch`,waypoint:n,claimed:i}:{kind:`mapComplete`,waypoint:n}}function yy(e,t){let n=Vg(e);if(!n)return;let r=t.find(e=>e.status===`claimed`&&e.claimedBy===n.id);return{sessionId:n.id,kind:n.kind,waypointTitle:r?.title}}function by(e){let t=[...e.filter(e=>e.kind===`chat`)].reverse();return t.find(e=>e.status!==`ended`)??t[0]}function xy(e,t){return t?e.filter(e=>e.kind!==`chat`):[...e]}function Sy(e){let t=e.filter(e=>e.kind===`chat`);return t.some(e=>e.status!==`ended`||!!e.ccSessionId||e.transcriptMissing)?t:[]}function Cy(e){let t=[...e].reverse().find(e=>e.type===`feature.shipped`);return t?t.ts:null}function wy(e){switch(e){case`chat`:case`waypoint`:return`planning`;case`converge`:return`planning`;case`drive-fix`:case`prepare`:case`project`:return null}}function Ty(e){let t=Vg(e);if(!t)return null;let n=Ey(t);return{sessionId:t.id,text:`${n} session still live from lap ${t.lap}`,phase:wy(t.kind)}}function Ey(e){switch(e.kind){case`chat`:return`Chat`;case`converge`:return`Converge`;case`waypoint`:return`Waypoint`;case`drive-fix`:return`Drive fix`;case`prepare`:return`Preparation`;case`project`:return`Project`}}function Dy(e){return e===`planning`}function Oy(e){let t=ky(e);return Dy(e.phase)?`Planning${t?` · ${t}`:``}`:null}function ky({phase:e,full:t,decisions:n}){if(!Dy(e))return null;let r=[`${t.tickets.length} tickets`];return n!==void 0&&r.unshift(`${Eg(n)} decisions`),t.feature.mapped&&r.push(`${t.waypoints.length} waypoints`),r.join(` · `)}var Ay=`runcastle/project`;function jy(e){return!e||!zg(e)?`none`:e.status===`launching`?`launching`:`live`}function My(e,t){if(!e)return null;let n=e.stored?t&&!t.includes(e.stored)?`vanished`:`picked`:`detected`;return{value:e.effective,origin:n}}function Ny(e){return e.creating?`create`:e.preparing?`prepare`:e.projectSelected?`project`:e.selectedFeatureId?`feature`:e.featureCount===0&&!e.prepared&&!e.empty?`prepare`:`empty`}function Py(e,t){return e===`feature`&&!t}var Fy=`preparation prepare re-prepare reprepare redo re-run rerun again findings evidence stale project commands baseline secrets database`,Iy=`project chat talk ask conversation conversations idea intake discuss advice new chat`;function Ly(e,t){return t===``||e.includes(t)}function Ry(e){return Ly(Fy,e)}function zy(e){return Ly(Iy,e)}function By(e){if(!e)return null;let{prepared:t,pendingCount:n,staleCount:r}=e;return t?{variant:`done`,count:n,stale:r,label:`Re-prepare the project`,badge:r>0?`${r} stale`:null,title:r>0?`${r} established fact${r===1?` has`:`s have`} not been re-measured in a long time`:`See what was established about this repo, or establish it again`}:{variant:`todo`,count:n,stale:r,label:`Prepare this project`,badge:n>0?`${n} to establish`:null,title:`${n} repo fact${n===1?``:`s`} nobody has established yet — how to install, how to verify, what is already red`}}var Vy=(0,L.createContext)(null),Hy=`cursor-pointer animate-toast-in rounded-md border bg-panel px-3.5 py-2.5 text-sm break-words shadow-[0_12px_30px_-14px_rgba(0,0,0,0.8)]`,Uy={error:`border-danger/55 text-danger`,success:`border-ok/50 text-ok`,info:`border-hairline text-text-2`},Wy=null;function Gy(e,t=`error`){Wy?.(e,t)}function Ky({children:e}){let[t,n]=(0,L.useState)([]),r=(0,L.useCallback)((e,t=`error`)=>{let r=Date.now()+Math.random();n(n=>[...n,{id:r,kind:t,message:e}]),setTimeout(()=>n(e=>e.filter(e=>e.id!==r)),6e3)},[]);return(0,L.useEffect)(()=>(Wy=r,()=>{Wy===r&&(Wy=null)}),[r]),(0,R.jsxs)(Vy.Provider,{value:{push:r},children:[e,(0,R.jsx)(`div`,{className:`fixed right-4 bottom-8.5 z-[400] flex max-w-95 flex-col gap-2`,children:t.map(e=>(0,R.jsx)(`div`,{className:`${Hy} ${Uy[e.kind]}`,onClick:()=>n(t=>t.filter(t=>t.id!==e.id)),children:e.message},e.id))})]})}function qy(){let e=(0,L.useContext)(Vy);if(!e)throw Error(`useToast used outside ToastProvider`);return e}function Jy(e){let t=B.useUtils(),n=qy(),r=B.project.projectSession.useQuery({projectId:e},{refetchInterval:$m()}),i=B.project.conversations.useQuery({projectId:e},{refetchInterval:$m()}),a=B.project.talkToProject.useMutation({onSuccess:()=>{t.project.projectSession.invalidate(),t.project.conversations.invalidate()},onError:e=>n.push(e.message)}),o=(0,L.useRef)(void 0),s=B.feature.endSession.useMutation({onSuccess:()=>a.mutate({projectId:e,fresh:!0,...o.current?{purpose:o.current}:{}}),onError:e=>n.push(e.message)}),c=r.data??null,l=jy(c),u=()=>l===`none`&&!a.isPending;return{session:c,state:l,conversations:i.data??[],conversationsPending:i.isPending,start:()=>{u()&&a.mutate({projectId:e,fresh:!0})},triage:()=>{u()&&a.mutate({projectId:e,purpose:`triage`})},replace:e=>{c&&!a.isPending&&!s.isPending&&(o.current=e,s.mutate({sessionId:c.id}))},resume:t=>{u()&&a.mutate({projectId:e,resumeSessionId:t})},starting:a.isPending||s.isPending}}async function Yy(e,t){let n=await fetch(Bd(e),{method:`POST`,headers:{"content-type":`image/png`},body:t});if(!n.ok)throw Error(`screenshot upload: ${n.status}`)}function Xy(e){return(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`j`}function Zy(e,t){return!!(e?.projectDrive&&e.projectId===t)}function Qy({empty:e,setupCommand:t,devCommand:n,drive:r,projectId:i}){return e?{state:`hidden`}:Zy(r,i)?{state:`running`}:!t?.trim()&&!n?.trim()?{state:`prepare`}:r?{state:`blocked`,reason:`${gv(r.holderLabel)} is running`}:{state:`ready`}}function $y(e,t){let n=e.filter(e=>e.status===`open`).sort((e,t)=>t.createdAt-e.createdAt);return t===void 0?{thisDrive:[],alreadyOpen:n}:{thisDrive:n.filter(e=>e.createdAt>=t),alreadyOpen:n.filter(e=>e.createdAt<t)}}function eb(e){return e.driveBranch?{label:`drive · ${e.driveBranch}`,title:e.driveCommit?`noted while driving ${e.driveBranch} @ ${e.driveCommit}`:`noted while driving ${e.driveBranch}`}:null}function tb(e,t){return Number.isFinite(t)?Math.min(e.max,Math.max(e.min,Math.round(t))):e.default}function nb(e){let t=null;try{t=localStorage.getItem(e.key)}catch{return e.default}if(t===null)return e.default;let n=Number(t);return Number.isFinite(n)?tb(e,n):e.default}function rb(e,t){try{localStorage.setItem(e.key,String(t))}catch{}}function ib(e){let[t,n]=(0,L.useState)(()=>nb(e));return(0,L.useEffect)(()=>{rb(e,t)},[e,t]),{width:t,setWidth:(0,L.useCallback)(t=>n(tb(e,t)),[e])}}var ab={key:`runcastle.sidebar.w`,min:240,max:420,default:300};function ob(e){return tb(ab,e)}function sb(){return ib(ab)}function cb(e,t=``){return/mac|iphone|ipad|ipod/i.test(e)||/mac os x/i.test(t)}function lb(e,t=``){return/win/i.test(e)||/windows/i.test(t)}function ub(e,t,n=``){return cb(t,n)?`⌘${e}`:`Ctrl+${e}`}function db(e,t=``){return ub(`K`,e,t)}function fb(e,t=``){return lb(e,t)?`C:\\Users\\you\\code\\your-repo`:`/path/to/your/repo`}function pb(e,t,n=``){let r=e.trim();return lb(t,n)?/^[A-Za-z]:[\\/]/.test(r)||/^\\\\/.test(r):r.startsWith(`/`)}function mb(){return typeof navigator>`u`?{platform:``,userAgent:``}:{platform:navigator.platform??``,userAgent:navigator.userAgent??``}}function hb(){let e=mb();return db(e.platform,e.userAgent)}function gb(e){let t=mb();return ub(e,t.platform,t.userAgent)}function _b(){let e=mb();return fb(e.platform,e.userAgent)}function vb(e){let t=mb();return pb(e,t.platform,t.userAgent)}var yb=l(dr(),1),bb=1,xb=.9,Sb=.8,Cb=.17,wb=.1,Tb=.999,Eb=.9999,Db=.99,Ob=/[\\\/_+.#"@\[\(\{&]/,kb=/[\\\/_+.#"@\[\(\{&]/g,Ab=/[\s-]/,jb=/[\s-]/g;function Mb(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?bb:Db;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Mb(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=bb:Ob.test(e.charAt(l-1))?(d*=Sb,p=e.slice(i,l-1).match(kb),p&&i>0&&(d*=Tb**+p.length)):Ab.test(e.charAt(l-1))?(d*=xb,m=e.slice(i,l-1).match(jb),m&&i>0&&(d*=Tb**+m.length)):(d*=Cb,i>0&&(d*=Tb**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Eb)),(d<wb&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Mb(e,t,n,r,l+1,a+2,o),f*wb>d&&(d=f*wb)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Nb(e){return e.toLowerCase().replace(jb,` `)}function Pb(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Mb(e,t,Nb(e),Nb(t),0,0,{})}var Fb=Object.defineProperty,Ib=(e,t)=>Fb(e,`name`,{value:t,configurable:!0}),Lb=!!(typeof window<`u`&&window.document&&window.document.createElement);function q(e,t,{checkForDefaultPrevented:n=!0}={}){return Ib(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Ib(q,`composeEventHandlers`);function Rb(e){if(!Lb)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Ib(Rb,`getOwnerWindow`);function zb(e){if(!Lb)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Ib(zb,`getOwnerDocument`);function Bb(e,t=!1){let{activeElement:n}=zb(e);if(!n?.nodeName)return null;if(Vb(n)&&n.contentDocument)return Bb(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=zb(n).getElementById(e);if(t)return t}}return n}Ib(Bb,`getActiveElement`);function Vb(e){return e.tagName===`IFRAME`}Ib(Vb,`isFrame`);var Hb=Object.defineProperty,Ub=(e,t)=>Hb(e,`name`,{value:t,configurable:!0});function Wb(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ub(Wb,`setRef`);function Gb(...e){return t=>{let n=!1,r=e.map(e=>{let r=Wb(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Wb(e[t],null)}}}}Ub(Gb,`composeRefs`);function Kb(...e){return L.useCallback(Gb(...e),e)}Ub(Kb,`useComposedRefs`);var qb=Object.defineProperty,Jb=(e,t)=>qb(e,`name`,{value:t,configurable:!0});function Yb(e,t){let n=L.createContext(t);n.displayName=e+`Context`;let r=Jb(e=>{let{children:t,...r}=e,i=L.useMemo(()=>r,Object.values(r));return(0,R.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=L.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Jb(i,`useContext`),[r,i]}Jb(Yb,`createContext`);function Xb(e,t=[]){let n=[];function r(t,r){let i=L.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Jb(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=L.useMemo(()=>o,Object.values(o));return(0,R.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=L.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Jb(s,`useContext`),[o,s]}Jb(r,`createContext`);let i=Jb(()=>{let t=n.map(e=>L.createContext(e));return Jb(function(n){let r=n?.[e]||t;return L.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Zb(i,...t)]}Jb(Xb,`createContextScope`);function Zb(...e){let t=e[0];if(e.length===1)return t;let n=Jb(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Jb(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Jb(Zb,`composeContextScopes`);var Qb=globalThis?.document?L.useLayoutEffect:()=>{},$b=Object.defineProperty,ex=(e,t)=>$b(e,`name`,{value:t,configurable:!0}),tx=L.useId||(()=>void 0),nx=0;function rx(e){let[t,n]=L.useState(tx());return Qb(()=>{e||n(e=>e??String(nx++))},[e]),e||(t?`radix-${t}`:``)}ex(rx,`useId`);var ix=Object.defineProperty,ax=(e,t)=>ix(e,`name`,{value:t,configurable:!0}),ox=L.useEffectEvent,sx=L.useInsertionEffect;function cx(e){if(typeof ox==`function`)return ox(e);let t=L.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof sx==`function`?sx(()=>{t.current=e}):Qb(()=>{t.current=e}),L.useMemo(()=>((...e)=>t.current?.(...e)),[])}ax(cx,`useEffectEvent`);var lx=Object.defineProperty,ux=(e,t)=>lx(e,`name`,{value:t,configurable:!0}),dx=L.useInsertionEffect||Qb;function fx({prop:e,defaultProp:t,onChange:n=ux(()=>{},`onChange`),caller:r}){let[i,a,o]=px({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,L.useCallback(t=>{if(s){let n=mx(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}ux(fx,`useControllableState`);function px({defaultProp:e,onChange:t}){let[n,r]=L.useState(e),i=L.useRef(n),a=L.useRef(t);return dx(()=>{a.current=t},[t]),L.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}ux(px,`useUncontrolledState`);function mx(e){return typeof e==`function`}ux(mx,`isFunction`);var hx=Symbol(`RADIX:SYNC_STATE`);function gx(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=cx(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=L.useReducer((t,n)=>{if(n.type===hx)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=L.useRef(p);L.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=L.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return L.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:hx,state:i})},[i,d.state,c]),[h,f]}ux(gx,`useControllableStateReducer`);var _x=Object.defineProperty,vx=(e,t)=>_x(e,`name`,{value:t,configurable:!0});function yx(e){let t=L.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Dx(r)&&typeof jx==`function`&&(r=jx(r._payload)),L.Children.forEach(r,e=>{if(Tx(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Dx(n)&&typeof jx==`function`&&(n=jx(n._payload)),a=Sx(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=L.cloneElement(a,void 0,s):!o&&L.Children.count(r)===1&&L.isValidElement(r)&&(a=r);let c=a?wx(a):void 0,l=Kb(n,c);if(!a){if(r||r===0)throw Error(o?Ax(e):kx(e));return r}let u=Cx(i,a.props??{});return a.type!==L.Fragment&&(u.ref=n?l:c),L.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}vx(yx,`createSlot`);var bx=Symbol.for(`radix.slottable`);function xx(e){let t=vx(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=bx,t}vx(xx,`createSlottable`);var Sx=vx((e,t)=>{if(`child`in e.props){let t=e.props.child;return L.isValidElement(t)?L.cloneElement(t,void 0,e.props.children(t.props.children)):null}return L.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Cx(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}vx(Cx,`mergeProps`);function wx(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}vx(wx,`getElementRef`);function Tx(e){return L.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===bx}vx(Tx,`isSlottable`);var Ex=Symbol.for(`react.lazy`);function Dx(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ex&&`_payload`in e&&Ox(e._payload)}vx(Dx,`isLazyComponent`);function Ox(e){return typeof e==`object`&&!!e&&`then`in e}vx(Ox,`isPromiseLike`);var kx=vx(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Ax=vx(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),jx=L.use,Mx=Object.defineProperty,Nx=(e,t)=>Mx(e,`name`,{value:t,configurable:!0}),Px=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=yx(`Primitive.${t}`),r=L.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,R.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Fx(e,t){e&&yb.flushSync(()=>e.dispatchEvent(t))}Nx(Fx,`dispatchDiscreteCustomEvent`);var Ix=Object.defineProperty,Lx=(e,t)=>Ix(e,`name`,{value:t,configurable:!0});function Rx(e){let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>((...e)=>t.current?.(...e)),[])}Lx(Rx,`useCallbackRef`);var zx=Object.defineProperty,Bx=(e,t)=>zx(e,`name`,{value:t,configurable:!0}),Vx=`dismissableLayer.update`,Hx=`dismissableLayer.pointerDownOutside`,Ux=`dismissableLayer.focusOutside`,Wx,Gx=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Kx=L.forwardRef(Bx(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=L.useContext(Gx),[d,f]=L.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=L.useState({}),h=Kb(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=L.useRef(!1),C=Yx(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:L.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Xx(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=Rx(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return L.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),L.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Wx=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Zx(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Wx))}},[d,p,n,u]),L.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Zx())},[d,u]),L.useEffect(()=>{let e=Bx(()=>m({}),`handleUpdate`);return document.addEventListener(Vx,e),()=>document.removeEventListener(Vx,e)},[]),(0,R.jsx)(Px.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:q(e.onFocusCapture,w.onFocusCapture),onBlurCapture:q(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:q(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function qx(){let e=L.useContext(Gx),[t,n]=L.useState(null);return L.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Bx(qx,`useDismissableLayerSurface`);var Jx=Bx(()=>!0,`IS_TRUE`);function Yx(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Jx}=t,s=Rx(e),c=L.useRef(!1),l=L.useRef(!1),u=L.useRef(new Map),d=L.useRef(()=>{});return L.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}Bx(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}Bx(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}Bx(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}Bx(p,`handleInteractionBubble`);let m=Bx(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Qx(Hx,s,p,{discrete:!0})};if(Bx(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:Bx(()=>c.current=!0,`onPointerDownCapture`)}}Bx(Yx,`usePointerDownOutside`);function Xx(e,t=globalThis?.document){let n=Rx(e),r=L.useRef(!1);return L.useEffect(()=>{let e=Bx(e=>{e.target&&!r.current&&Qx(Ux,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:Bx(()=>r.current=!0,`onFocusCapture`),onBlurCapture:Bx(()=>r.current=!1,`onBlurCapture`)}}Bx(Xx,`useFocusOutside`);function Zx(){let e=new CustomEvent(Vx);document.dispatchEvent(e)}Bx(Zx,`dispatchUpdate`);function Qx(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Fx(i,a):i.dispatchEvent(a)}Bx(Qx,`handleAndDispatchCustomEvent`);var $x=Object.defineProperty,eS=(e,t)=>$x(e,`name`,{value:t,configurable:!0}),tS=`focusScope.autoFocusOnMount`,nS=`focusScope.autoFocusOnUnmount`,rS={bubbles:!1,cancelable:!0},iS=L.forwardRef(eS(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=L.useState(null),l=Rx(i),u=Rx(a),d=L.useRef(null),f=Kb(t,c),p=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:dS(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||dS(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&dS(s)};eS(e,`handleFocusIn`),eS(t,`handleFocusOut`),eS(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),L.useEffect(()=>{if(s){fS.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(tS,rS);s.addEventListener(tS,l),s.dispatchEvent(t),t.defaultPrevented||(aS(hS(sS(s)),{select:!0}),document.activeElement===e&&dS(s))}return()=>{s.removeEventListener(tS,l),setTimeout(()=>{let t=new CustomEvent(nS,rS);s.addEventListener(nS,u),s.dispatchEvent(t),t.defaultPrevented||dS(e??document.body,{select:!0}),s.removeEventListener(nS,u),fS.remove(p)},0)}}},[s,l,u,p]);let m=L.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=oS(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&dS(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&dS(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,R.jsx)(Px.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function aS(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(dS(r,{select:t}),document.activeElement!==n)return}eS(aS,`focusFirst`);function oS(e){let t=sS(e);return[cS(t,e),cS(t.reverse(),e)]}eS(oS,`getTabbableEdges`);function sS(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:eS(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}eS(sS,`getTabbableCandidates`);function cS(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):lS(r,{upTo:t})))return r}eS(cS,`findVisible`);function lS(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}eS(lS,`isHidden`);function uS(e){return e instanceof HTMLInputElement&&`select`in e}eS(uS,`isSelectableInput`);function dS(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&uS(e)&&t&&e.select()}}eS(dS,`focus`);var fS=pS();function pS(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=mS(e,t),e.unshift(t)},remove(t){e=mS(e,t),e[0]?.resume()}}}eS(pS,`createFocusScopesStack`);function mS(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}eS(mS,`arrayRemove`);function hS(e){return e.filter(e=>e.tagName!==`A`)}eS(hS,`removeLinks`);var gS=Object.defineProperty,_S=L.forwardRef(((e,t)=>gS(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=L.useState(!1);Qb(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?yb.createPortal((0,R.jsx)(Px.div,{...r,ref:t}),o):null},`Portal`)),vS=Object.defineProperty,yS=(e,t)=>vS(e,`name`,{value:t,configurable:!0});function bS(e,t){return L.useReducer((e,n)=>t[e][n]??e,e)}yS(bS,`useStateMachine`);var xS=yS(e=>{let{present:t,children:n}=e,r=SS(t),i=typeof n==`function`?n({present:r.isPresent}):L.Children.only(n),a=wS(r.ref,ES(i));return typeof n==`function`||r.isPresent?L.cloneElement(i,{ref:a}):null},`Presence`);function SS(e){let[t,n]=L.useState(),r=L.useRef(null),i=L.useRef(e),a=L.useRef(`none`),o=L.useRef(void 0),[s,c]=bS(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return L.useEffect(()=>{s===`mounted`?(a.current=o.current??TS(r.current),o.current=void 0):a.current=`none`},[s]),Qb(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=TS(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Qb(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=yS(a=>{let o=TS(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=yS(e=>{e.target===t&&(a.current=TS(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:L.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=TS(t)}else r.current=null;n(e)},[])}}yS(SS,`usePresence`);function CS(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}yS(CS,`setRef`);function wS(...e){let t=L.useRef(e);return t.current=e,L.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=CS(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():CS(n[e],null)}}},[])}yS(wS,`useStableComposedRefs`);function TS(e){return e?.animationName||`none`}yS(TS,`getAnimationName`);function ES(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}yS(ES,`getElementRef`);var DS=Object.defineProperty,OS=(e,t)=>DS(e,`name`,{value:t,configurable:!0}),kS=0,AS=null;function jS(e){return MS(),e.children}OS(jS,`FocusGuards`);function MS(){L.useEffect(()=>{AS||={start:NS(),end:NS()};let{start:e,end:t}=AS;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),kS++,()=>{kS===1&&(AS?.start.remove(),AS?.end.remove(),AS=null),kS=Math.max(0,kS-1)}},[])}OS(MS,`useFocusGuards`);function NS(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}OS(NS,`createFocusGuard`);var PS=function(){return PS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},PS.apply(this,arguments)};function FS(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function IS(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var LS=`right-scroll-bar-position`,RS=`width-before-scroll-bar`,zS=`with-scroll-bars-hidden`,BS=`--removed-body-scroll-bar-size`;function VS(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function HS(e,t){var n=(0,L.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var US=typeof window<`u`?L.useLayoutEffect:L.useEffect,WS=new WeakMap;function GS(e,t){var n=HS(t||null,function(t){return e.forEach(function(e){return VS(e,t)})});return US(function(){var t=WS.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||VS(e,null)}),i.forEach(function(e){r.has(e)||VS(e,a)})}WS.set(n,e)},[e]),n}function KS(e){return e}function qS(e,t){t===void 0&&(t=KS);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function JS(e){e===void 0&&(e={});var t=qS(null);return t.options=PS({async:!0,ssr:!1},e),t}var YS=function(e){var t=e.sideCar,n=FS(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return L.createElement(r,PS({},n))};YS.isSideCarExport=!0;function XS(e,t){return e.useMedium(t),YS}var ZS=JS(),QS=function(){},$S=L.forwardRef(function(e,t){var n=L.useRef(null),r=L.useState({onScrollCapture:QS,onWheelCapture:QS,onTouchMoveCapture:QS}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=FS(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=GS([n,t]),C=PS(PS({},b),i);return L.createElement(L.Fragment,null,u&&L.createElement(x,{sideCar:ZS,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?L.cloneElement(L.Children.only(s),PS(PS({},C),{ref:S})):L.createElement(v,PS({},C,{className:c,ref:S}),s))});$S.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},$S.classNames={fullWidth:RS,zeroRight:LS};var eC,tC=function(){if(eC)return eC;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function nC(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=tC();return t&&e.setAttribute(`nonce`,t),e}function rC(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iC(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var aC=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nC())&&(rC(t,n),iC(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},oC=function(){var e=aC();return function(t,n){L.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sC=function(){var e=oC();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},cC={left:0,top:0,right:0,gap:0},lC=function(e){return parseInt(e||``,10)||0},uC=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[lC(n),lC(r),lC(i)]},dC=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return cC;var t=uC(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},fC=sC(),pC=`data-scroll-locked`,mC=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
81
|
+
.${zS} {
|
|
82
|
+
overflow: hidden ${r};
|
|
83
|
+
padding-right: ${s}px ${r};
|
|
84
|
+
}
|
|
85
|
+
body[${pC}] {
|
|
86
|
+
overflow: hidden ${r};
|
|
87
|
+
overscroll-behavior: contain;
|
|
88
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
89
|
+
padding-left: ${i}px;
|
|
90
|
+
padding-top: ${a}px;
|
|
91
|
+
padding-right: ${o}px;
|
|
92
|
+
margin-left:0;
|
|
93
|
+
margin-top:0;
|
|
94
|
+
margin-right: ${s}px ${r};
|
|
95
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.${LS} {
|
|
99
|
+
right: ${s}px ${r};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.${RS} {
|
|
103
|
+
margin-right: ${s}px ${r};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.${LS} .${LS} {
|
|
107
|
+
right: 0 ${r};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.${RS} .${RS} {
|
|
111
|
+
margin-right: 0 ${r};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
body[${pC}] {
|
|
115
|
+
${BS}: ${s}px;
|
|
116
|
+
}
|
|
117
|
+
`},hC=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},gC=function(){L.useEffect(function(){return document.body.setAttribute(pC,(hC()+1).toString()),function(){var e=hC()-1;e<=0?document.body.removeAttribute(pC):document.body.setAttribute(pC,e.toString())}},[])},_C=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;gC();var a=L.useMemo(function(){return dC(i)},[i]);return L.createElement(fC,{styles:mC(a,!t,i,n?``:`!important`)})},vC=!1;if(typeof window<`u`)try{var yC=Object.defineProperty({},"passive",{get:function(){return vC=!0,!0}});window.addEventListener(`test`,yC,yC),window.removeEventListener(`test`,yC,yC)}catch{vC=!1}var bC=vC?{passive:!1}:!1,xC=function(e){return e.tagName===`TEXTAREA`},SC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!xC(e)&&n[t]===`visible`)},CC=function(e){return SC(e,`overflowY`)},wC=function(e){return SC(e,`overflowX`)},TC=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),OC(e,r)){var i=kC(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},EC=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},DC=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},OC=function(e,t){return e===`v`?CC(t):wC(t)},kC=function(e,t){return e===`v`?EC(t):DC(t)},AC=function(e,t){return e===`h`&&t===`rtl`?-1:1},jC=function(e,t,n,r,i){var a=AC(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=kC(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&OC(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},MC=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},NC=function(e){return[e.deltaX,e.deltaY]},PC=function(e){return e&&`current`in e?e.current:e},FC=function(e,t){return e[0]===t[0]&&e[1]===t[1]},IC=function(e){return`
|
|
118
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
119
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
120
|
+
`},LC=0,RC=[];function zC(e){var t=L.useRef([]),n=L.useRef([0,0]),r=L.useRef(),i=L.useState(LC++)[0],a=L.useState(sC)[0],o=L.useRef(e);L.useEffect(function(){o.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=IS([e.lockRef.current],(e.shards||[]).map(PC),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=L.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=MC(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=TC(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=TC(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return jC(h,t,e,h===`h`?s:c,!0)},[]),c=L.useCallback(function(e){var n=e;if(!(!RC.length||RC[RC.length-1]!==a)){var r=`deltaY`in n?NC(n):MC(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&FC(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(PC).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=L.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:BC(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=L.useCallback(function(e){n.current=MC(e),r.current=void 0},[]),d=L.useCallback(function(t){l(t.type,NC(t),t.target,s(t,e.lockRef.current))},[]),f=L.useCallback(function(t){l(t.type,MC(t),t.target,s(t,e.lockRef.current))},[]);L.useEffect(function(){return RC.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,bC),document.addEventListener(`touchmove`,c,bC),document.addEventListener(`touchstart`,u,bC),function(){RC=RC.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,bC),document.removeEventListener(`touchmove`,c,bC),document.removeEventListener(`touchstart`,u,bC)}},[]);var p=e.removeScrollBar,m=e.inert;return L.createElement(L.Fragment,null,m?L.createElement(a,{styles:IC(i)}):null,p?L.createElement(_C,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function BC(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var VC=XS(ZS,zC),HC=L.forwardRef(function(e,t){return L.createElement($S,PS({},e,{ref:t,sideCar:VC}))});HC.classNames=$S.classNames;var UC=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},WC=new WeakMap,GC=new WeakMap,KC={},qC=0,JC=function(e){return e&&(e.host||JC(e.parentNode))},YC=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=JC(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},XC=function(e,t,n,r){var i=YC(t,Array.isArray(e)?e:[e]);KC[n]||(KC[n]=new WeakMap);var a=KC[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(WC.get(e)||0)+1,l=(a.get(e)||0)+1;WC.set(e,c),a.set(e,l),o.push(e),c===1&&i&&GC.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),qC++,function(){o.forEach(function(e){var t=WC.get(e)-1,i=a.get(e)-1;WC.set(e,t),a.set(e,i),t||(GC.has(e)||e.removeAttribute(r),GC.delete(e)),i||e.removeAttribute(n)}),qC--,qC||(WC=new WeakMap,WC=new WeakMap,GC=new WeakMap,KC={})}},ZC=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||UC(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),XC(r,i,n,`aria-hidden`)):function(){return null}},QC=Object.defineProperty,$C=(e,t)=>QC(e,`name`,{value:t,configurable:!0}),ew=`Dialog`,[tw,nw]=Xb(ew),[rw,iw]=tw(ew),aw=$C(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=L.useRef(null),c=L.useRef(null),[l,u]=fx({prop:r,defaultProp:i??!1,onChange:a,caller:ew}),[d,f]=L.useState(0),[p,m]=L.useState(0);return(0,R.jsx)(rw,{scope:t,triggerRef:s,contentRef:c,contentId:rx(),titleId:rx(),descriptionId:rx(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:L.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),ow=`DialogPortal`,[sw,cw]=tw(ow,{forceMount:void 0}),lw=$C(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=iw(ow,t);return(0,R.jsx)(sw,{scope:t,forceMount:n,children:L.Children.map(r,e=>(0,R.jsx)(xS,{present:n||a.open,children:(0,R.jsx)(_S,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),uw=`DialogOverlay`,dw=L.forwardRef($C(function(e,t){let n=cw(uw,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=iw(uw,e.__scopeDialog);return a.modal?(0,R.jsx)(xS,{present:r||a.open,children:(0,R.jsx)(pw,{...i,ref:t})}):null},`DialogOverlay`)),fw=yx(`DialogOverlay.RemoveScroll`),pw=L.forwardRef($C(function(e,t){let{__scopeDialog:n,...r}=e,i=iw(uw,n),a=Kb(t,qx());return(0,R.jsx)(HC,{as:fw,allowPinchZoom:!0,shards:[i.contentRef],children:(0,R.jsx)(Px.div,{"data-state":yw(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),mw=`DialogContent`,hw=L.forwardRef($C(function(e,t){let n=cw(mw,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=iw(mw,e.__scopeDialog);return(0,R.jsx)(xS,{present:r||a.open,children:a.modal?(0,R.jsx)(gw,{...i,ref:t}):(0,R.jsx)(_w,{...i,ref:t})})},`DialogContent`)),gw=L.forwardRef($C(function(e,t){let n=iw(mw,e.__scopeDialog),r=L.useRef(null),i=Kb(t,n.contentRef,r);return L.useEffect(()=>{let e=r.current;if(e)return ZC(e)},[]),(0,R.jsx)(vw,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:q(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),_w=L.forwardRef($C(function(e,t){let n=iw(mw,e.__scopeDialog),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(vw,{...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()}})},`DialogContentNonModal`)),vw=L.forwardRef($C(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=iw(mw,n);return MS(),(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(iS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(Kx,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":yw(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function yw(e){return e?`open`:`closed`}$C(yw,`getState`);var bw=`[cmdk-group=""]`,xw=`[cmdk-group-items=""]`,Sw=`[cmdk-group-heading=""]`,Cw=`[cmdk-item=""]`,ww=`${Cw}:not([aria-disabled="true"])`,Tw=`cmdk-item-select`,Ew=`data-value`,Dw=(e,t,n)=>Pb(e,t,n),Ow=L.createContext(void 0),kw=()=>L.useContext(Ow),Aw=L.createContext(void 0),jw=()=>L.useContext(Aw),Mw=L.createContext(void 0),Nw=L.forwardRef((e,t)=>{let n=qw(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=qw(()=>new Set),i=qw(()=>new Map),a=qw(()=>new Map),o=qw(()=>new Set),s=Gw(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=rx(),y=rx(),b=rx(),x=L.useRef(null),S=Xw();Kw(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Kw(()=>{S(6,k)},[]);let C=L.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=L.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Dw;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(xw);t?t.appendChild(e.parentElement===t?e:e.closest(`${xw} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${xw} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${bw}[${Ew}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Ew);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(bw)?.querySelector(Sw))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Cw}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(ww)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(Ew))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Ew))}function P(e){let t=A()?.closest(bw),n;for(;t&&!n;)t=e>0?Uw(t,bw):Ww(t,bw),n=t?.querySelector(ww);n?C.setState(`value`,n.getAttribute(Ew)):N(e)}let F=()=>M(j().length-1),ee=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},te=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return L.createElement(Px.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ee(e);break;case`ArrowDown`:ee(e);break;case`p`:case`k`:g&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Tw);t.dispatchEvent(e)}}}}},L.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:$w},c),Qw(e,e=>L.createElement(Aw.Provider,{value:C},L.createElement(Ow.Provider,{value:w},e))))}),Pw=L.forwardRef((e,t)=>{let n=rx(),r=L.useRef(null),i=L.useContext(Mw),a=kw(),o=Gw(e),s=o.current?.forceMount??i?.forceMount;Kw(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Yw(n,r,[e.value,e.children,r],e.keywords),l=jw(),u=Jw(e=>e.value&&e.value===c.current),d=Jw(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);L.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Tw,f),()=>t.removeEventListener(Tw,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return L.createElement(Px.div,{ref:Gb(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Fw=L.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=rx(),s=L.useRef(null),c=L.useRef(null),l=rx(),u=kw(),d=Jw(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Kw(()=>u.group(o),[]),Yw(o,s,[e.value,e.heading,c]);let f=L.useMemo(()=>({id:o,forceMount:i}),[i]);return L.createElement(Px.div,{ref:Gb(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&L.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Qw(e,e=>L.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},L.createElement(Mw.Provider,{value:f},e))))}),Iw=L.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=L.useRef(null),a=Jw(e=>!e.search);return!n&&!a?null:L.createElement(Px.div,{ref:Gb(i,t),...r,"cmdk-separator":``,role:`separator`})}),Lw=L.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=jw(),o=Jw(e=>e.search),s=Jw(e=>e.selectedItemId),c=kw();return L.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),L.createElement(Px.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Rw=L.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=L.useRef(null),o=L.useRef(null),s=Jw(e=>e.selectedItemId),c=kw();return L.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),L.createElement(Px.div,{ref:Gb(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Qw(e,e=>L.createElement(`div`,{ref:Gb(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),zw=L.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return L.createElement(aw,{open:n,onOpenChange:r},L.createElement(lw,{container:o},L.createElement(dw,{"cmdk-overlay":``,className:i}),L.createElement(hw,{"aria-label":e.label,"cmdk-dialog":``,className:a},L.createElement(Nw,{ref:t,...s}))))}),Bw=L.forwardRef((e,t)=>Jw(e=>e.filtered.count===0)?L.createElement(Px.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Vw=L.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return L.createElement(Px.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Qw(e,e=>L.createElement(`div`,{"aria-hidden":!0},e)))}),Hw=Object.assign(Nw,{List:Rw,Item:Pw,Input:Lw,Group:Fw,Separator:Iw,Dialog:zw,Empty:Bw,Loading:Vw});function Uw(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ww(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Gw(e){let t=L.useRef(e);return Kw(()=>{t.current=e}),t}var Kw=typeof window>`u`?L.useEffect:L.useLayoutEffect;function qw(e){let t=L.useRef();return t.current===void 0&&(t.current=e()),t}function Jw(e){let t=jw(),n=()=>e(t.snapshot());return L.useSyncExternalStore(t.subscribe,n,n)}function Yw(e,t,n,r=[]){let i=L.useRef(),a=kw();return Kw(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Ew,s),i.current=s}),i}var Xw=()=>{let[e,t]=L.useState(),n=qw(()=>new Map);return Kw(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Zw(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Qw({asChild:e,children:t},n){return e&&L.isValidElement(t)?L.cloneElement(Zw(t),{ref:t.ref},n(t.props.children)):n(t)}var $w={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function eT(...e){return e.filter(Boolean).join(` `)}var tT=`z-[300] overflow-y-auto rounded-md border border-hairline bg-panel-3 shadow-menu`,nT=[`top`,`right`,`bottom`,`left`],rT=Math.min,iT=Math.max,aT=Math.round,oT=Math.floor,sT=e=>({x:e,y:e}),cT={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function lT(e,t,n){return iT(e,rT(t,n))}function uT(e,t){return typeof e==`function`?e(t):e}function dT(e){return e.split(`-`)[0]}function fT(e){return e.split(`-`)[1]}function pT(e){return e===`x`?`y`:`x`}function mT(e){return e===`y`?`height`:`width`}function hT(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function gT(e){return pT(hT(e))}function _T(e,t,n){n===void 0&&(n=!1);let r=fT(e),i=gT(e),a=mT(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ET(o)),[o,ET(o)]}function vT(e){let t=ET(e);return[yT(e),t,yT(t)]}function yT(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var bT=[`left`,`right`],xT=[`right`,`left`],ST=[`top`,`bottom`],CT=[`bottom`,`top`];function wT(e,t,n){switch(e){case`top`:case`bottom`:return n?t?xT:bT:t?bT:xT;case`left`:case`right`:return t?ST:CT;default:return[]}}function TT(e,t,n,r){let i=fT(e),a=wT(dT(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(yT)))),a}function ET(e){let t=dT(e);return cT[t]+e.slice(t.length)}function DT(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function OT(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:DT(e)}function kT(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function AT(e,t,n){let{reference:r,floating:i}=e,a=hT(t),o=gT(t),s=mT(o),c=dT(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=fT(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function jT(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=uT(t,e),p=OT(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=kT(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=kT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var MT=50,NT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:jT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=AT(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<MT&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=AT(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},PT=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=uT(e,t)||{};if(l==null)return{};let d=OT(u),f={x:n,y:r},p=gT(i),m=mT(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=rT(d[_],T),D=rT(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=lT(E,k,O),j=!c.arrow&&fT(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),FT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=uT(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=dT(r),_=hT(o),v=dT(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ET(o)]:vT(o)),x=p!==`none`;!d&&x&&b.push(...TT(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=_T(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==hT(t))||T.every(e=>hT(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=hT(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function IT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function LT(e){return nT.some(t=>e[t]>=0)}var RT=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=uT(e,t);switch(i){case`referenceHidden`:{let e=IT(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:LT(e)}}}case`escaped`:{let e=IT(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:LT(e)}}}default:return{}}}}},zT=new Set([`left`,`top`]);async function BT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=dT(n),s=fT(n),c=hT(n)===`y`,l=zT.has(o)?-1:1,u=a&&c?-1:1,d=uT(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var VT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await BT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},HT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=uT(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=hT(i),p=pT(f),m=u[p],h=u[f],g=(e,t)=>lT(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},UT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=uT(e,t),u={x:n,y:r},d=hT(i),f=pT(d),p=u[f],m=u[d],h=uT(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=zT.has(dT(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},WT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=uT(e,t),c=await i.detectOverflow(t,s),l=dT(n),u=fT(n),d=hT(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=rT(p-c[m],g),y=rT(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*iT(c.left,c.right):S=p-2*iT(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function GT(){return typeof window<`u`}function KT(e){return YT(e)?(e.nodeName||``).toLowerCase():`#document`}function qT(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function JT(e){return((YT(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function YT(e){return GT()?e instanceof Node||e instanceof qT(e).Node:!1}function XT(e){return GT()?e instanceof Element||e instanceof qT(e).Element:!1}function ZT(e){return GT()?e instanceof HTMLElement||e instanceof qT(e).HTMLElement:!1}function QT(e){return!GT()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof qT(e).ShadowRoot}function $T(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=uE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function eE(e){return/^(table|td|th)$/.test(KT(e))}function tE(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var nE=/transform|translate|scale|rotate|perspective|filter/,rE=/paint|layout|strict|content/,iE=e=>!!e&&e!==`none`,aE;function oE(e){let t=XT(e)?uE(e):e;return iE(t.transform)||iE(t.translate)||iE(t.scale)||iE(t.rotate)||iE(t.perspective)||!cE()&&(iE(t.backdropFilter)||iE(t.filter))||nE.test(t.willChange||``)||rE.test(t.contain||``)}function sE(e){let t=fE(e);for(;ZT(t)&&!lE(t);){if(oE(t))return t;if(tE(t))return null;t=fE(t)}return null}function cE(){return aE??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),aE}function lE(e){return/^(html|body|#document)$/.test(KT(e))}function uE(e){return qT(e).getComputedStyle(e)}function dE(e){return XT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fE(e){if(KT(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||QT(e)&&e.host||JT(e);return QT(t)?t.host:t}function pE(e){let t=fE(e);return lE(t)?(e.ownerDocument||e).body:ZT(t)&&$T(t)?t:pE(t)}function mE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=pE(e),i=r===e.ownerDocument?.body,a=qT(r);if(i){let e=hE(a);return t.concat(a,a.visualViewport||[],$T(r)?r:[],e&&n?mE(e):[])}else return t.concat(r,mE(r,[],n))}function hE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gE(e){let t=uE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ZT(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=aT(n)!==a||aT(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _E(e){return XT(e)?e:e.contextElement}function vE(e){let t=_E(e);if(!ZT(t))return sT(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=gE(t),o=(a?aT(n.width):n.width)/r,s=(a?aT(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var yE=sT(0);function bE(e){let t=qT(e);return!cE()||!t.visualViewport?yE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xE(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===qT(e)}function SE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_E(e),o=sT(1);t&&(r?XT(r)&&(o=vE(r)):o=vE(e));let s=xE(a,n,r)?bE(a):sT(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=qT(a),t=XT(r)?qT(r):r,n=e,i=hE(n);for(;i&&t!==n;){let e=vE(i),t=i.getBoundingClientRect(),r=uE(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=qT(i),i=hE(n)}}return kT({width:u,height:d,x:c,y:l})}function CE(e,t){let n=dE(e).scrollLeft;return t?t.left+n:SE(JT(e)).left+n}function wE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-CE(e,n),y:n.top+t.scrollTop}}function TE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=JT(r),s=t?tE(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=sT(1),u=sT(0),d=ZT(r);if((d||!a)&&((KT(r)!==`body`||$T(o))&&(c=dE(r)),d)){let e=SE(r);l=vE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?wE(o,c):sT(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function EE(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function DE(e){let t=dE(e),n=e.ownerDocument.body,r=iT(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=iT(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+CE(e),o=-t.scrollTop;return uE(n).direction===`rtl`&&(a+=iT(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var OE=25;function kE(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=qT(e),a=JT(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!cE()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(CE(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=OE&&(s-=o)}return{width:s,height:c,x:l,y:u}}function AE(e,t){let n=SE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=vE(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function jE(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=kE(e,n,t);else if(t===`document`)r=DE(JT(e));else if(XT(t))r=AE(t,n);else{let n=bE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return kT(r)}function ME(e,t){let n=t.get(e);if(n)return n;let r=mE(e,[],!1).filter(e=>XT(e)&&KT(e)!==`body`),i=null,a=uE(e).position===`fixed`,o=a?fE(e):e;for(;XT(o)&&!lE(o);){let e=uE(o),t=oE(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=fE(o)}return t.set(e,r),r}function NE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?tE(t)?[]:ME(t,this._c):[].concat(n),r],o=jE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=jE(t,a[e],i);s=iT(n.top,s),c=rT(n.right,c),l=rT(n.bottom,l),u=iT(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function PE(e){let{width:t,height:n}=gE(e);return{width:t,height:n}}function FE(e,t,n){let r=ZT(t),i=JT(t),a=n===`fixed`,o=SE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=sT(0);if((r||!a)&&((KT(t)!==`body`||$T(i))&&(s=dE(t)),r)){let e=SE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=CE(i));let l=i&&!r&&!a?wE(i,s):sT(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function IE(e){return uE(e).position===`static`}function LE(e,t){if(!ZT(e)||uE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return JT(e)===n&&(n=n.ownerDocument.body),n}function RE(e,t){let n=qT(e);if(tE(e))return n;if(!ZT(e)){let t=fE(e);for(;t&&!lE(t);){if(XT(t)&&!IE(t))return t;t=fE(t)}return n}let r=LE(e,t);for(;r&&eE(r)&&IE(r);)r=LE(r,t);return r&&lE(r)&&IE(r)&&!oE(r)?n:r||sE(e)||n}var zE=async function(e){let t=this.getOffsetParent||RE,n=this.getDimensions,r=await n(e.floating);return{reference:FE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function BE(e){return uE(e).direction===`rtl`}var VE={convertOffsetParentRelativeRectToViewportRelativeRect:TE,getDocumentElement:JT,getClippingRect:NE,getOffsetParent:RE,getElementRects:zE,getClientRects:EE,getDimensions:PE,getScale:vE,isElement:XT,isRTL:BE};function HE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function UE(e,t,n){let r=null,i,a=JT(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=oT(d),h=oT(a.clientWidth-(u+f)),g=oT(a.clientHeight-(d+p)),_=oT(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:iT(0,rT(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!HE(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=qT(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function WE(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=_E(e),u=i||a?[...l?mE(l):[],...t?mE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?UE(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?SE(e):null;c&&g();function g(){let t=SE(e);h&&!HE(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var GE=VT,KE=HT,qE=FT,JE=WT,YE=RT,XE=PT,ZE=UT,QE=(e,t,n)=>{let r=new Map,i=n??{},a={...VE,...i.platform,_c:r};return NT(e,t,{...i,platform:a})},$E=typeof document<`u`?L.useLayoutEffect:function(){};function eD(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!eD(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!eD(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function tD(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nD(e,t){let n=tD(e);return Math.round(t*n)/n}function rD(e){let t=L.useRef(e);return $E(()=>{t.current=e}),t}function iD(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);eD(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=rD(c),D=rD(i),O=rD(l),k=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),QE(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!eD(w.current,t)&&(w.current=t,yb.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);$E(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=L.useRef(!1);$E(()=>(A.current=!0,()=>{A.current=!1}),[]),$E(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=L.useMemo(()=>({reference:b,floating:x}),[b,x]),N=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=nD(M.floating,u.x),r=nD(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...tD(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var aD=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:XE({element:r.current,padding:i}).fn(n):r?XE({element:r,padding:i}).fn(n):{}}}},oD=(e,t)=>{let n=GE(e);return{name:n.name,fn:n.fn,options:[e,t]}},sD=(e,t)=>{let n=KE(e);return{name:n.name,fn:n.fn,options:[e,t]}},cD=(e,t)=>({fn:ZE(e).fn,options:[e,t]}),lD=(e,t)=>{let n=qE(e);return{name:n.name,fn:n.fn,options:[e,t]}},uD=(e,t)=>{let n=JE(e);return{name:n.name,fn:n.fn,options:[e,t]}},dD=(e,t)=>{let n=YE(e);return{name:n.name,fn:n.fn,options:[e,t]}},fD=(e,t)=>{let n=aD(e);return{name:n.name,fn:n.fn,options:[e,t]}},pD=Object.defineProperty,mD=(e,t)=>pD(e,`name`,{value:t,configurable:!0});function hD(e){let[t,n]=L.useState(void 0);return Qb(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}mD(hD,`useSize`);var gD=Object.defineProperty,_D=(e,t)=>gD(e,`name`,{value:t,configurable:!0}),vD=`Popper`,[yD,bD]=Xb(vD),[xD,SD]=yD(vD),CD=_D(e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null),[a,o]=L.useState(void 0);return(0,R.jsx)(xD,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),wD=`PopperAnchor`,TD=L.forwardRef(_D(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=SD(wD,n),o=L.useRef(null),s=a.onAnchorChange,c=Kb(t,L.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=L.useRef(null);L.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&MD(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(Px.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),ED=`PopperContent`,[DD,OD]=yD(ED),kD=L.forwardRef(_D(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=SD(ED,n),[_,v]=L.useState(null),y=Kb(t,v),[b,x]=L.useState(null),S=hD(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(AD),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=iD({strategy:`fixed`,placement:T,whileElementsMounted:_D((...e)=>WE(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[oD({mainAxis:i+w,alignmentAxis:o}),c&&sD({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?cD():void 0,...k}),c&&lD({...k}),uD({...k,apply:_D(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&fD({element:b,padding:s}),jD({arrowWidth:C,arrowHeight:w}),f&&dD({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),F=g.setPlacementState;Qb(()=>(F(M),()=>{F(void 0)}),[M,F]);let[ee,te]=MD(M),ne=Rx(m);Qb(()=>{N&&ne?.()},[N,ne]);let I=P.arrow?.x,re=P.arrow?.y,ie=P.arrow?.centerOffset!==0,[ae,oe]=L.useState();return Qb(()=>{_&&oe(window.getComputedStyle(_).zIndex)},[_]),(0,R.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(DD,{scope:n,placedSide:ee,placedAlign:te,onArrowChange:x,arrowX:I,arrowY:re,shouldHideArrow:ie,children:(0,R.jsx)(Px.div,{"data-side":ee,"data-align":te,...h,ref:y,style:{...h.style,animation:N?h.style?.animation:`none`}})})})},`PopperContent`));function AD(e){return e!==null}_D(AD,`isNotNull`);var jD=_D(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=MD(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function MD(e){let[t,n=`center`]=e.split(`-`);return[t,n]}_D(MD,`getSideAndAlignFromPlacement`);var ND=CD,PD=TD,FD=kD,ID=Object.defineProperty,LD=(e,t)=>ID(e,`name`,{value:t,configurable:!0}),RD=`Popover`,[zD,BD]=Xb(RD,[bD]),VD=bD(),[HD,UD]=zD(RD),WD=LD(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=VD(t),c=L.useRef(null),[l,u]=L.useState(!1),[d,f]=fx({prop:r,defaultProp:i??!1,onChange:a,caller:RD});return(0,R.jsx)(ND,{...s,children:(0,R.jsx)(HD,{scope:t,contentId:rx(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:L.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:L.useCallback(()=>u(!0),[]),onCustomAnchorRemove:L.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),GD=`PopoverTrigger`,KD=L.forwardRef(LD(function(e,t){let{__scopePopover:n,...r}=e,i=UD(GD,n),a=VD(n),o=Kb(t,i.triggerRef),s=(0,R.jsx)(Px.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":rO(i.open),...r,ref:o,onClick:q(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(PD,{asChild:!0,...a,children:s})},`PopoverTrigger`)),qD=`PopoverPortal`,[JD,YD]=zD(qD,{forceMount:void 0}),XD=LD(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=UD(qD,t);return(0,R.jsx)(JD,{scope:t,forceMount:n,children:(0,R.jsx)(xS,{present:n||a.open,children:(0,R.jsx)(_S,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ZD=`PopoverContent`,QD=L.forwardRef(LD(function(e,t){let n=YD(ZD,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=UD(ZD,e.__scopePopover);return(0,R.jsx)(xS,{present:r||a.open,children:a.modal?(0,R.jsx)(eO,{...i,ref:t}):(0,R.jsx)(tO,{...i,ref:t})})},`PopoverContent`)),$D=yx(`PopoverContent.RemoveScroll`),eO=L.forwardRef(LD(function(e,t){let n=UD(ZD,e.__scopePopover),r=L.useRef(null),i=Kb(t,r),a=L.useRef(!1);return L.useEffect(()=>{let e=r.current;if(e)return ZC(e)},[]),(0,R.jsx)(HC,{as:$D,allowPinchZoom:!0,children:(0,R.jsx)(nO,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:q(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:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),tO=L.forwardRef(LD(function(e,t){let n=UD(ZD,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(nO,{...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`)),nO=L.forwardRef(LD(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=UD(ZD,n),p=VD(n);return MS(),(0,R.jsx)(iS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(Kx,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,R.jsx)(FD,{"data-state":rO(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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 rO(e){return e?`open`:`closed`}LD(rO,`getState`);var iO=WD,aO=KD,oO=XD,sO=QD,cO=iO,lO=aO;function uO({className:e,align:t=`start`,sideOffset:n=4,collisionPadding:r=8,...i}){return(0,R.jsx)(oO,{children:(0,R.jsx)(sO,{align:t,sideOffset:n,collisionPadding:r,className:eT(tT,`max-h-(--radix-popover-content-available-height) min-w-32 p-1`,e),...i})})}var dO=(0,L.createContext)(()=>{});function fO({open:e,defaultOpen:t=!1,onOpenChange:n,children:r,...i}){let[a,o]=(0,L.useState)(t),s=t=>{e===void 0&&o(t),n?.(t)};return(0,R.jsx)(cO,{open:e??a,onOpenChange:s,...i,children:(0,R.jsx)(dO.Provider,{value:()=>s(!1),children:r})})}var pO=lO;function mO({className:e,loop:t=!0,onEscapeKeyDown:n,children:r,...i}){return(0,R.jsx)(uO,{className:eT(`flex max-w-(--radix-popover-content-available-width) min-w-56 flex-col p-0`,e),onEscapeKeyDown:e=>{n?.(e),e.stopPropagation()},...i,children:(0,R.jsx)(Hw,{loop:t,className:`flex min-h-0 flex-col`,children:r})})}function hO({className:e,...t}){return(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-hairline-soft px-2.5 py-2 text-text-4`,children:[(0,R.jsx)(Ph,{size:12,className:`shrink-0`}),(0,R.jsx)(Lw,{className:eT(`min-w-0 flex-1 appearance-none border-0 bg-transparent p-0 font-mono text-sm text-text placeholder:text-text-4`,e),...t})]})}function gO({className:e,...t}){return(0,R.jsx)(Rw,{className:eT(`max-h-64 overflow-y-auto overscroll-contain p-1`,e),...t})}function _O({className:e,...t}){return(0,R.jsx)(Bw,{className:eT(`px-2.5 py-1.5 text-text-3`,e),...t})}var vO=`block px-2.5 pt-1 pb-0.5 font-sans text-xs tracking-[0.06em] text-text-4 uppercase`;function yO({heading:e,...t}){return(0,R.jsx)(Fw,{heading:e===void 0?void 0:(0,R.jsx)(`span`,{className:vO,children:e}),...t})}var bO=`flex cursor-pointer items-center justify-between gap-3 rounded-sm px-2.5 py-1.5 text-left text-text-2 transition-colors duration-(--dur-1) ease-app select-none data-[selected=true]:bg-accent-soft data-[selected=true]:text-text aria-[current=true]:text-text data-disabled:cursor-not-allowed data-disabled:opacity-40`;function xO({className:e,children:t,current:n=!1,onSelect:r,...i}){let a=(0,L.useContext)(dO);return(0,R.jsxs)(Pw,{"aria-current":n||void 0,className:eT(bO,e),onSelect:e=>{r?.(e),a()},...i,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),n&&(0,R.jsx)(Vh,{size:11,className:`shrink-0 text-accent-hi`})]})}function SO(...e){return e.filter(Boolean).join(` `)}var CO=`inline-flex items-center justify-center gap-1.5 whitespace-nowrap border font-medium transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-(--dur-1) ease-app enabled:active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-40`,wO={md:`h-(--control-h) rounded-md px-3 text-sm`,xs:`h-5.5 rounded-sm px-2.5 text-xs`},TO={ghost:`border-hairline bg-transparent text-text enabled:hover:border-hairline-strong enabled:hover:bg-panel`,solid:`border-accent bg-accent font-semibold text-accent-ink enabled:hover:border-accent-2 enabled:hover:bg-accent-2`,accent:`border-accent-line bg-transparent enabled:hover:bg-accent-soft`,danger:`border-danger/55 bg-transparent text-danger enabled:hover:border-danger enabled:hover:bg-danger/12`},EO={accent:`text-accent-hi`};function J({variant:e=`ghost`,size:t=`md`,type:n=`button`,className:r,children:i,...a}){let o=EO[e];return(0,R.jsx)(`button`,{type:n,className:SO(CO,wO[t],TO[e],r),...a,children:o?(0,R.jsx)(`span`,{className:SO(`contents`,o),children:i}):i})}var DO={sm:`size-2.5 border-[1.4px]`,md:`size-3 border-[1.6px]`},OO={work:`border-ph-implementation`,accent:`border-accent`};function kO({size:e=`md`,tone:t=`work`,className:n}){return(0,R.jsx)(`span`,{"aria-hidden":`true`,className:SO(`inline-block shrink-0 animate-spin rounded-pill border-t-transparent`,DO[e],OO[t],n)})}var AO=`border-0 bg-transparent`,jO=`h-(--control-h) w-full min-w-0 rounded-md border border-hairline bg-panel-inset px-3 font-mono text-sm text-text transition-[border-color] duration-(--dur-1) ease-app placeholder:text-text-4 focus:border-accent-line focus:outline-none`;function MO({children:e}){return(0,R.jsx)(`div`,{className:`section-title py-1 text-xs font-semibold tracking-[0.09em] text-text-3 uppercase`,children:e})}function NO({children:e}){return(0,R.jsx)(`div`,{className:`dim-line py-0.5 font-mono text-sm text-text-3`,children:e})}function PO({icon:e,title:t,hint:n,action:r,compact:i}){return(0,R.jsxs)(`div`,{className:SO(`flex flex-col items-center justify-center gap-1.5 text-center`,i?`px-5 py-6`:`px-6 py-11`),children:[e&&(0,R.jsx)(`div`,{className:`mb-1 flex size-9 items-center justify-center rounded-md border border-hairline bg-panel-3 text-text-3`,children:e}),(0,R.jsx)(`div`,{className:`text-base font-medium text-text-2`,children:t}),n&&(0,R.jsx)(`div`,{className:`max-w-[42ch] text-sm text-pretty text-text-3`,children:n}),r&&(0,R.jsx)(`div`,{className:`mt-2`,children:r})]})}function FO({message:e,path:t,hint:n,action:r,id:i}){return(0,R.jsxs)(`div`,{className:`rounded-md border border-danger/45 bg-danger/8 px-3 py-2.5`,id:i,role:`alert`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium text-danger`,children:e}),t&&(0,R.jsx)(`div`,{className:`mt-1 truncate text-left font-mono text-sm text-text-3`,dir:`rtl`,title:t,children:(0,R.jsx)(`bdi`,{children:t})}),n&&(0,R.jsx)(`p`,{className:`mt-1.5 text-sm text-text-2`,children:n}),r&&(0,R.jsx)(`div`,{className:`mt-2.5`,children:r})]})}var IO={sm:`max-w-[460px]`,md:`max-w-[620px]`,lg:`max-w-[780px]`,xl:`max-w-[940px]`,palette:`max-w-[560px]`},LO={dim:`bg-bg/70`,light:`bg-[rgba(4,6,10,0.28)]`,none:`pointer-events-none bg-transparent`};function RO({open:e,onClose:t,size:n=`md`,scrim:r=`dim`,label:i,labelledBy:a,dirty:o=!1,discardPrompt:s=`Discard what you have typed?`,initialFocusRef:c,returnFocusRef:l,inline:u=!1,backdropClassName:d,className:f,children:p}){let[m,h]=(0,L.useState)(!1),g=(0,L.useRef)(null);if((0,L.useEffect)(()=>{if(!e)return;let t=l?.current??document.activeElement,n=g.current;return n&&!n.contains(document.activeElement)&&(c?.current??n).focus(),()=>{let e=document.activeElement;if(!(e===null||e===document.body||!e.isConnected||n?.contains(e)))return;let r=t instanceof HTMLElement&&t.isConnected?t:l?.current;r?.isConnected&&(r.focus(),queueMicrotask(()=>{let e=document.activeElement,t=r.isConnected?r:l?.current;t?.isConnected&&(e===null||e===document.body)&&t.focus()}))}},[e]),(0,L.useEffect)(()=>{if(!e)return;let n=e=>{if(e.key!==`Escape`)return;let n=document.activeElement;(n===null||n===document.body||g.current?.contains(n))&&(m?h(!1):o?h(!0):t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,m,o,t]),!e)return null;let _=()=>{o?h(!0):t()},v=(0,R.jsx)(`div`,{className:SO(u?`flex flex-1 items-center justify-center p-6`:SO(`fixed inset-0 z-[200] flex items-start justify-center px-4 pb-4`,n===`palette`?`pt-[12vh]`:`pt-[8vh]`,LO[r]),d),onMouseDown:e=>{e.target===e.currentTarget&&(e.preventDefault(),_())},children:(0,R.jsxs)(`div`,{ref:g,role:`dialog`,"aria-modal":!u||void 0,"aria-label":i,"aria-labelledby":a,tabIndex:-1,className:SO(`w-full rounded-lg border border-hairline-strong bg-panel shadow-overlay`,r===`none`&&`pointer-events-auto`,IO[n],f),children:[typeof p==`function`?p(_):p,m&&(0,R.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-sm border border-warn/45 bg-warn/8 px-3 py-2.5`,role:`alert`,children:[(0,R.jsx)(`span`,{className:`flex-1 text-base text-text`,children:s}),(0,R.jsx)(J,{variant:`ghost`,onClick:()=>h(!1),children:`Keep editing`}),(0,R.jsx)(J,{variant:`danger`,onClick:t,children:`Discard`})]})]})});return u?v:(0,yb.createPortal)(v,document.body)}function zO({label:e,labelAside:t,help:n,error:r,htmlFor:i,layout:a=`flex flex-col gap-1.5`,children:o}){let s=(0,L.useId)(),c=(0,L.isValidElement)(o)?o:null,l=c?.props.id??i??s,u=`${l}-help`,d=`${l}-error`,f=SO(n?u:null,r?d:null)||void 0,p=(0,R.jsx)(`label`,{className:`text-sm font-medium text-text-2`,htmlFor:l,children:e});return(0,R.jsxs)(`div`,{className:a,children:[t?(0,R.jsxs)(`div`,{className:`flex min-h-(--control-h) items-center gap-1.5`,children:[p,t]}):p,c?(0,L.cloneElement)(c,{id:l,"aria-describedby":SO(c.props[`aria-describedby`],f)||void 0}):o,n&&(0,R.jsx)(`div`,{id:u,className:`text-sm text-text-3`,children:n}),r&&(0,R.jsx)(`div`,{id:d,role:`alert`,className:`text-sm text-danger`,children:r})]})}function BO({children:e}){return(0,R.jsx)(`kbd`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-sm border border-hairline bg-panel-3 px-1.5 font-mono text-xs text-text-2`,children:e})}var VO=/^(?:runcastle\/|worktree-|afk\/)/,HO=`inline-flex h-(--control-h) min-w-0 items-center gap-1.5 rounded-md border px-2.5 font-mono text-sm transition-[color,background-color,border-color] duration-(--dur-1) ease-app disabled:cursor-not-allowed disabled:opacity-40`;function UO({prefix:e,value:t,branches:n,detected:r,onPick:i,missing:a=!1,disabled:o=!1,className:s}){let c=(n??[]).filter(e=>!VO.test(e)),l=r&&c.includes(r)?r:null,u=c.filter(e=>e!==l),d=e=>(0,R.jsx)(xO,{value:e,current:e===t,onSelect:()=>i(e),children:e},e);return(0,R.jsxs)(fO,{children:[(0,R.jsxs)(pO,{disabled:o||!n,className:SO(HO,a?`border-warn text-warn`:`border-transparent text-text-2 enabled:hover:border-hairline enabled:hover:bg-panel-3 enabled:hover:text-text`,s),children:[(0,R.jsxs)(`span`,{className:`truncate`,children:[e,` `,t??`…`]}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-xs text-text-3`,children:`▾`})]}),(0,R.jsxs)(mO,{align:`end`,className:`font-mono text-sm`,children:[(0,R.jsx)(hO,{placeholder:`Find a branch…`}),(0,R.jsxs)(gO,{label:`${e} branch`,children:[(0,R.jsx)(_O,{children:c.length===0?`no branches to land on`:`no branch matches`}),l?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(yO,{heading:`Detected main line`,children:d(l)}),u.length>0&&(0,R.jsx)(yO,{heading:`Other local branches`,children:u.map(d)})]}):u.map(d)]})]})]})}var WO={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,idle:`bg-text-3`};function GO({row:e}){return(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,R.jsx)(`span`,{className:SO(`size-2 shrink-0 rounded-pill`,WO[e.tone])}),(0,R.jsx)(`span`,{className:`w-23 shrink-0 font-mono text-sm text-text`,children:e.key}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:e.value})]})}var KO=`flex items-baseline gap-2 py-2 font-mono text-xs tracking-[0.06em] uppercase`;function qO({groups:e,currentLap:t,meta:n,headClassName:r,children:i}){return t<=1?(0,R.jsx)(R.Fragment,{children:i(e.flatMap(e=>e.rows))}):(0,R.jsx)(R.Fragment,{children:e.map(e=>{let t=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{children:[`Lap `,e.lap]}),(0,R.jsx)(`span`,{className:`text-text-4`,children:n(e)})]});return e.current?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`div`,{className:SO(KO,r,`text-text-2`),children:t}),i(e.rows)]},e.lap):(0,R.jsxs)(`details`,{className:`group`,children:[(0,R.jsx)(`summary`,{className:SO(KO,r,`cursor-pointer list-none text-text-3 before:shrink-0 before:text-text-4 before:content-['▸']`,`group-open:before:content-['▾'] [&::-webkit-details-marker]:hidden`),children:t}),i(e.rows)]},e.lap)})})}var JO={planning:`text-ph-ideation`,building:`text-ph-implementation`,review:`text-ph-review`,shipped:`text-ph-shipped`};function YO({phase:e}){return(0,R.jsx)(`span`,{className:SO(`font-mono text-sm font-semibold lowercase`,JO[e]),children:e})}var XO={planning:`bg-ph-ideation`,building:`bg-ph-implementation`,review:`bg-ph-review`,shipped:`bg-ph-shipped`};function ZO({phase:e,className:t}){return(0,R.jsx)(`span`,{className:SO(`size-2 shrink-0 rounded-full`,XO[e],t)})}var QO=`inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-pill border px-2 font-mono text-xs`,$O=`animate-[pulse_1.5s_ease-in-out_infinite]`,ek=`shrink-0 border-ph-review/40 bg-ph-review/8 text-ph-review`,tk={pending:`border-hairline text-text-3`,burning:`border-ph-implementation/45 bg-ph-implementation/8 text-ph-implementation ${$O}`,done:`border-ok/40 text-ok`,failed:`border-danger/45 text-danger`,cancelled:`border-hairline text-text-3 line-through`};function nk({status:e}){return(0,R.jsx)(`span`,{className:SO(QO,tk[e]),children:e})}function rk({kind:e,passKind:t}){if(e===`implementation`)return null;let n=t===`verification`;return(0,R.jsx)(`span`,{className:SO(QO,ek),title:n?`Confirms the fixes that landed since the last review`:`Verifies the integrated feature branch`,children:n?`verification`:e})}function ik({author:e}){return e===`human`?null:(0,R.jsx)(`span`,{className:SO(QO,ek),title:`Written by the review agent`,children:e})}var ak={high:`border-warn/45 text-warn`,medium:`border-hairline text-text-2`,low:`border-hairline text-text-3`};function ok({severity:e}){return(0,R.jsx)(`span`,{className:SO(QO,ak[e]),children:e})}var sk={running:`border-ph-implementation/45 text-ph-implementation ${$O}`,succeeded:`border-ok/40 text-ok`,failed:`border-danger/45 text-danger`,cancelled:`border-hairline text-text-3`};function ck({status:e}){return(0,R.jsx)(`span`,{className:SO(QO,sk[e]),children:e})}var lk={launching:`bg-needs animate-[pulse_1.3s_ease-in-out_infinite]`,live:`bg-ok ring-3 ring-ok/15`,ended:`bg-text-3`};function uk({status:e}){return(0,R.jsx)(`span`,{className:SO(`inline-block size-2 shrink-0 rounded-pill`,lk[e]),title:e})}var dk={md:`h-[54px] w-24 rounded-sm border-hairline`,sm:`h-[26px] w-10 rounded-[4px] border-hairline-strong cursor-zoom-in`};function fk({url:e,onOpen:t,size:n=`md`}){return e?(0,R.jsx)(`button`,{type:`button`,className:SO(`shrink-0 overflow-hidden border bg-black p-0 hover:border-accent-line`,dk[n]),title:`see the whole picture`,onClick:()=>t(e),children:(0,R.jsx)(`img`,{src:e,alt:`the picture attached to this note`,className:`h-full w-full object-cover`})}):null}var pk=Object.defineProperty,mk=(e,t)=>pk(e,`name`,{value:t,configurable:!0});function hk(e){let t=e+`CollectionProvider`,[n,r]=Xb(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=mk(e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=yx(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=Kb(t,a(s,n).collectionRef);return(0,R.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=yx(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=Kb(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.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 mk(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}mk(hk,`createCollection`);var gk=new WeakMap,_k=class e extends Map{static{mk(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],gk.set(this,!0)}set(e,t){return gk.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=bk(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}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);return r===-1?this:this.insert(r,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);return r===-1?this:this.insert(r+1,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=vk(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=vk(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return vk(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=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){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,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}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 vk(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=yk(e,t);return n===-1?void 0:e[n]}mk(vk,`at`);function yk(e,t){let n=e.length,r=bk(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}mk(yk,`toSafeIndex`);function bk(e){return e!==e||e===0?0:Math.trunc(e)}mk(bk,`toSafeInteger`);function xk(e){let t=e+`CollectionProvider`,[n,r]=Xb(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _k,setItemMap:mk(()=>void 0,`setItemMap`)}),o=mk(({state:e,...t})=>e?(0,R.jsx)(c,{...t,state:e}):(0,R.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=mk(e=>{let t=h();return(0,R.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=mk(e=>{let{scope:t,children:n,state:r}=e,a=L.useRef(null),[o,s]=L.useState(null),c=Kb(a,s),[l,u]=r;return L.useEffect(()=>{if(!o)return;let e=Tk(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,R.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=yx(l),d=L.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=Kb(t,a(l,n).collectionRef);return(0,R.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=yx(f),m=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),[s,c]=L.useState(null),l=Kb(t,o,c),{setItemMap:u}=a(f,n),d=L.useRef(i);Sk(d.current,i)||(d.current=i);let m=d.current;return L.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(wk):(t.set(s,{...e,element:s}),t.toSorted(wk)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new _k(e)))}},[s,m,u]),(0,R.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return L.useState(new _k)}mk(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return mk(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}mk(xk,`createCollection`);function Sk(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}mk(Sk,`shallowEqual`);function Ck(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}mk(Ck,`isElementPreceding`);function wk(e,t){return!e[1].element||!t[1].element?0:Ck(e[1].element,t[1].element)?-1:1}mk(wk,`sortByDocumentPosition`);function Tk(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}mk(Tk,`getChildListObserver`);var Ek=Object.defineProperty,Dk=(e,t)=>Ek(e,`name`,{value:t,configurable:!0}),Ok=L.createContext(void 0);function kk(e){let t=L.useContext(Ok);return e||t||`ltr`}Dk(kk,`useDirection`);var Ak=Object.defineProperty,jk=(e,t)=>Ak(e,`name`,{value:t,configurable:!0}),Mk=!1;function Nk(){let[e,t]=L.useState(Mk);return L.useEffect(()=>{Mk||(Mk=!0,t(!0))},[]),e}jk(Nk,`useIsHydrated`);var Pk=L.useSyncExternalStore;function Fk(){return()=>{}}jk(Fk,`subscribe`);function Ik(){return Pk(Fk,()=>!0,()=>!1)}jk(Ik,`useIsHydratedModern`);var Lk=typeof Pk==`function`?Ik:Nk,Rk=Object.defineProperty,zk=(e,t)=>Rk(e,`name`,{value:t,configurable:!0}),Bk=`rovingFocusGroup.onEntryFocus`,Vk={bubbles:!1,cancelable:!0},Hk=`RovingFocusGroup`,[Uk,Wk,Gk]=hk(Hk),[Kk,qk]=Xb(Hk,[Gk]),[Jk,Yk]=Kk(Hk),Xk=L.forwardRef(zk(function(e,t){return(0,R.jsx)(Uk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(Uk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(Zk,{...e,ref:t})})})},`RovingFocusGroup`)),Zk=L.forwardRef(zk(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=Kb(t,f),m=kk(a),[h,g]=fx({prop:o,defaultProp:s??null,onChange:c,caller:Hk}),[_,v]=L.useState(!1),y=Rx(l),b=Wk(n),x=L.useRef(!1),[S,C]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Bk,y),()=>e.removeEventListener(Bk,y)},[y]),(0,R.jsx)(Jk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>v(!0),[]),onFocusableItemAdd:L.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>C(e=>e-1),[]),children:(0,R.jsx)(Px.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:q(e.onMouseDown,()=>{x.current=!0}),onFocus:q(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Bk,Vk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);rA([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:q(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),Qk=`RovingFocusGroupItem`,$k=L.forwardRef(zk(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=rx(),l=a||c,u=Yk(Qk,n),d=u.currentTabStopId===l,f=Wk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Lk();return Qb(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),L.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,R.jsx)(Uk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(Px.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:q(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:q(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:q(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=nA(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().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=u.loop?iA(n,r+1):n.slice(r+1)}setTimeout(()=>rA(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),eA={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function tA(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}zk(tA,`getDirectionAwareKey`);function nA(e,t,n){let r=tA(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return eA[r]}zk(nA,`getFocusIntent`);function rA(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}zk(rA,`focusFirst`);function iA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}zk(iA,`wrapArray`);var aA=Xk,oA=$k,sA=Object.defineProperty,cA=(e,t)=>sA(e,`name`,{value:t,configurable:!0}),lA=[`Enter`,` `],uA=[`ArrowDown`,`PageUp`,`Home`],dA=[`ArrowUp`,`PageDown`,`End`],fA=[...uA,...dA];[...lA],[...lA];var pA=`Menu`,[mA,hA,gA]=hk(pA),[_A,vA]=Xb(pA,[gA,bD,qk]),yA=bD(),bA=qk(),[xA,SA]=_A(pA),[CA,wA]=_A(pA),TA=cA(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=yA(t),[c,l]=L.useState(null),u=L.useRef(!1),d=Rx(a),f=kk(i);return L.useEffect(()=>{let e=cA(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=cA(()=>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})}},[]),L.useEffect(()=>{if(!n)return;let e=cA(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,R.jsx)(ND,{...s,children:(0,R.jsx)(xA,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,R.jsx)(CA,{scope:t,onClose:L.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),EA=L.forwardRef(cA(function(e,t){let{__scopeMenu:n,...r}=e,i=yA(n);return(0,R.jsx)(PD,{...i,...r,ref:t})},`MenuAnchor`)),DA=`MenuPortal`,[OA,kA]=_A(DA,{forceMount:void 0}),AA=cA(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=SA(DA,t);return(0,R.jsx)(OA,{scope:t,forceMount:n,children:(0,R.jsx)(xS,{present:n||a.open,children:(0,R.jsx)(_S,{asChild:!0,container:i,children:r})})})},`MenuPortal`),jA=`MenuContent`,[MA,NA]=_A(jA),PA=L.forwardRef(cA(function(e,t){let n=kA(jA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=SA(jA,e.__scopeMenu),o=wA(jA,e.__scopeMenu);return(0,R.jsx)(mA.Provider,{scope:e.__scopeMenu,children:(0,R.jsx)(xS,{present:r||a.open,children:(0,R.jsx)(mA.Slot,{scope:e.__scopeMenu,children:o.modal?(0,R.jsx)(FA,{...i,ref:t}):(0,R.jsx)(IA,{...i,ref:t})})})})},`MenuContent`)),FA=L.forwardRef(cA(function(e,t){let n=SA(jA,e.__scopeMenu),r=L.useRef(null),i=Kb(t,r);return L.useEffect(()=>{let e=r.current;if(e)return ZC(e)},[]),(0,R.jsx)(RA,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),IA=L.forwardRef(cA(function(e,t){let n=SA(jA,e.__scopeMenu);return(0,R.jsx)(RA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),LA=yx(`MenuContent.ScrollLock`),RA=L.forwardRef(cA(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=SA(jA,n),_=wA(jA,n),v=yA(n),y=bA(n),b=hA(n),[x,S]=L.useState(null),C=L.useRef(null),w=Kb(t,C,g.onContentChange),T=L.useRef(0),E=L.useRef(``),D=L.useRef(0),O=L.useRef(null),k=L.useRef(`right`),A=L.useRef(0),j=m?HC:L.Fragment,M=m?{as:LA,allowPinchZoom:!0}:void 0,N=cA(e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=nj(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;cA((function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);L.useEffect(()=>()=>window.clearTimeout(T.current),[]),MS();let P=L.useCallback(e=>k.current===O.current?.side&&ij(e,O.current?.area),[]);return(0,R.jsx)(MA,{scope:n,searchRef:E,onItemEnter:L.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:L.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:L.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:L.useCallback(e=>{O.current=e},[]),children:(0,R.jsx)(j,{...M,children:(0,R.jsx)(iS,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,R.jsx)(Kx,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,R.jsx)(aA,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:q(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,R.jsx)(FD,{role:`menu`,"aria-orientation":`vertical`,"data-state":ZA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:q(h.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&&N(e.key));let i=C.current;if(e.target!==i||!fA.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);dA.includes(e.key)&&a.reverse(),ej(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:q(e.onPointerMove,aj(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;k.current=t,A.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),zA=L.forwardRef(cA(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Px.div,{...r,ref:t})},`MenuLabel`)),BA=`MenuItem`,VA=`menu.itemSelect`,HA=L.forwardRef(cA(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=L.useRef(null),o=wA(BA,e.__scopeMenu),s=NA(BA,e.__scopeMenu),c=Kb(t,a),l=L.useRef(!1),u=cA(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(VA,{bubbles:!0,cancelable:!0});e.addEventListener(VA,e=>r?.(e),{once:!0}),Fx(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,R.jsx)(UA,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||lA.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),UA=L.forwardRef(cA(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=NA(BA,n),s=bA(n),c=L.useRef(null),l=Kb(t,c),[u,d]=L.useState(!1),[f,p]=L.useState(``);return L.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,R.jsx)(mA.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,R.jsx)(oA,{asChild:!0,...s,focusable:!r,children:(0,R.jsx)(Px.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,aj(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,aj(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[WA,GA]=_A(`MenuRadioGroup`,{value:void 0,onValueChange:cA(()=>{},`onValueChange`)}),[KA,qA]=_A(`MenuItemIndicator`,{checked:!1}),JA=L.forwardRef(cA(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Px.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[YA,XA]=_A(`MenuSub`);function ZA(e){return e?`open`:`closed`}cA(ZA,`getOpenState`);function QA(e){return e===`indeterminate`}cA(QA,`isIndeterminate`);function $A(e){return QA(e)?`indeterminate`:e?`checked`:`unchecked`}cA($A,`getCheckedState`);function ej(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}cA(ej,`focusFirst`);function tj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}cA(tj,`wrapArray`);function nj(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=tj(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}cA(nj,`getNextMatch`);function rj(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}cA(rj,`isPointInPolygon`);function ij(e,t){return t?rj({x:e.clientX,y:e.clientY},t):!1}cA(ij,`isPointerInGraceArea`);function aj(e){return t=>t.pointerType===`mouse`?e(t):void 0}cA(aj,`whenMouse`);var oj=TA,sj=EA,cj=AA,lj=PA,uj=zA,dj=HA,fj=JA,pj=Object.defineProperty,mj=(e,t)=>pj(e,`name`,{value:t,configurable:!0}),hj=`DropdownMenu`,[gj,_j]=Xb(hj,[vA]),vj=vA(),[yj,bj]=gj(hj),xj=mj(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=vj(t),l=L.useRef(null),[u,d]=fx({prop:i,defaultProp:a??!1,onChange:o,caller:hj});return(0,R.jsx)(yj,{scope:t,triggerId:rx(),triggerRef:l,contentId:rx(),open:u,onOpenChange:d,onOpenToggle:L.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,R.jsx)(oj,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Sj=`DropdownMenuTrigger`,Cj=L.forwardRef(mj(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=bj(Sj,n),o=vj(n),s=Kb(t,a.triggerRef);return(0,R.jsx)(sj,{asChild:!0,...o,children:(0,R.jsx)(Px.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:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),wj=mj(e=>{let{__scopeDropdownMenu:t,...n}=e,r=vj(t);return(0,R.jsx)(cj,{...r,...n})},`DropdownMenuPortal`),Tj=`DropdownMenuContent`,Ej=L.forwardRef(mj(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=bj(Tj,n),a=vj(n),o=L.useRef(!1);return(0,R.jsx)(lj,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(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`)),Dj=L.forwardRef(mj(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=vj(n);return(0,R.jsx)(uj,{...i,...r,ref:t})},`DropdownMenuLabel`)),Oj=L.forwardRef(mj(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=vj(n);return(0,R.jsx)(dj,{...i,...r,ref:t})},`DropdownMenuItem`)),kj=L.forwardRef(mj(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=vj(n);return(0,R.jsx)(fj,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Aj=xj,jj=Cj,Mj=wj,Nj=Ej,Pj=Dj,Fj=Oj,Ij=kj;function Lj({modal:e=!1,...t}){return(0,R.jsx)(Aj,{modal:e,...t})}var Rj=jj;function zj({className:e,align:t=`start`,sideOffset:n=4,collisionPadding:r=8,onEscapeKeyDown:i,...a}){return(0,R.jsx)(Mj,{children:(0,R.jsx)(Nj,{align:t,sideOffset:n,collisionPadding:r,onEscapeKeyDown:e=>{i?.(e),e.stopPropagation()},className:eT(tT,`max-h-(--radix-dropdown-menu-content-available-height) min-w-32 p-1 font-mono text-xs`,e),...a})})}var Bj={default:`text-text-2 hover:bg-accent-soft hover:text-text data-highlighted:bg-accent-soft data-highlighted:text-text`,danger:`text-danger hover:bg-danger/12 data-highlighted:bg-danger/12`},Vj=`flex w-full cursor-pointer items-center gap-2 rounded-sm px-2.5 py-1.5 text-left transition-colors duration-(--dur-1) ease-app select-none data-disabled:cursor-not-allowed data-disabled:opacity-40`;function Hj({className:e,tone:t=`default`,...n}){return(0,R.jsx)(Fj,{className:eT(Vj,Bj[t],e),...n})}function Uj({className:e,...t}){return(0,R.jsx)(Pj,{className:eT(`px-2.5 py-1.5 text-xs tracking-[0.08em] text-text-4 uppercase`,e),...t})}function Wj({className:e,...t}){return(0,R.jsx)(Ij,{className:eT(`my-1 h-px bg-hairline-soft`,e),...t})}var Gj=`inline-flex h-6 min-w-0 items-center gap-1.5 rounded-md border border-transparent px-1.5 bg-transparent transition-[border-color,background-color] duration-(--dur-1) ease-app hover:border-hairline hover:bg-panel-3`,Kj=`text-base`;function qj({nav:e}){let t=e.projects??[];return(0,R.jsx)(`div`,{className:`inline-flex min-w-0`,children:(0,R.jsxs)(Lj,{children:[(0,R.jsxs)(Rj,{className:Gj,title:`Switch project`,children:[(0,R.jsx)(`span`,{className:`max-w-56 min-w-0 truncate text-sm text-text-2`,title:e.currentProject?.name,children:e.currentProject?.name??`…`}),(0,R.jsx)(`span`,{className:`inline-flex items-center text-text-4`,children:(0,R.jsx)(Gh,{size:11})})]}),(0,R.jsxs)(zj,{className:`min-w-60 font-sans`,children:[(0,R.jsx)(Uj,{children:`Projects`}),t.map(t=>{let n=t.id===e.currentProjectId;return(0,R.jsxs)(Hj,{className:Kj,"aria-current":n?`true`:void 0,onSelect:()=>e.enterProject(t.id),children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate ${n?`text-text`:``}`,children:t.name}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-xs text-text-4`,children:dh(t.repoPath)})]}),n&&(0,R.jsx)(`span`,{className:`inline-flex items-center text-accent-hi`,children:(0,R.jsx)(Vh,{size:11})})]},t.id)}),(0,R.jsx)(Wj,{}),(0,R.jsx)(Hj,{className:Kj,onSelect:()=>e.goHome(),children:(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`All projects`})}),(0,R.jsx)(Hj,{className:Kj,onSelect:()=>e.showOpen(),children:(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Open a project…`})})]})]})})}var Jj=`group inline-flex cursor-pointer items-center rounded-md border-0 transition-colors duration-(--dur-1) ease-app hover:bg-panel-3`,Yj={project:`Chat`,prepare:`Preparation`};function Xj(e){let t=e.nav.projects??[],n=$m(),r=B.useQueries(e=>t.map(t=>e.feature.list({projectId:t.id},{refetchInterval:n}))),i=uh(t.map((e,t)=>({projectId:e.id,...lh(r[t]?.data??[])})),e.nav.currentProjectId);return(0,R.jsx)(Zj,{...e,runsElsewhere:i})}function Zj({nav:e,view:t,featureTitle:n,runsElsewhere:r,onOpenCmdk:i,onOpenNote:a,noteOpen:o,onOpenSettings:s,onGoToProjectHome:c,onToggleInspector:l,inspectorCollapsed:u,drivingBranch:d=null,onOpenDrive:f}){let p=e.projects??[],m=hb(),h=t===`feature`?n:Yj[t]??null;return(0,R.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-hairline bg-panel px-3 text-base`,children:[(0,R.jsxs)(`nav`,{className:`flex min-w-0 items-center gap-2`,"aria-label":`Breadcrumb`,children:[(0,R.jsxs)(`button`,{className:`${Jj} shrink-0 gap-2 bg-transparent px-2 py-1`,onClick:e.goHome,title:p.length>1?`All projects`:`runcastle`,children:[(0,R.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,children:(0,R.jsx)(sg,{size:17})}),(0,R.jsx)(cg,{})]}),(0,R.jsx)(Qj,{}),(0,R.jsx)(qj,{nav:e}),h&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Qj,{}),(0,R.jsx)(`button`,{className:`${Jj} min-w-0 max-w-[34vw] bg-transparent px-2 py-1`,onClick:c,title:`Back to the project home`,children:(0,R.jsx)(`span`,{className:`truncate text-base font-medium text-text`,children:h})})]})]}),d!==null&&(0,R.jsx)(`button`,{className:`inline-flex h-6 shrink-0 cursor-pointer items-center gap-1.5 rounded-pill border border-accent-line bg-accent-soft px-2 transition-colors duration-(--dur-1) ease-app hover:border-hairline-strong`,onClick:f,title:`A project drive is live — back to it`,children:(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-xs whitespace-nowrap text-drive`,children:[(0,R.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-pill bg-drive`}),`driving `,d]})}),(0,R.jsx)(`span`,{className:`flex-1`}),(0,R.jsxs)(`button`,{className:`group inline-flex h-8 w-[300px] shrink-0 cursor-pointer items-center gap-2 rounded-md border border-hairline bg-panel-inset px-2.5 transition-colors duration-(--dur-1) ease-app hover:border-hairline-strong hover:bg-panel-3`,onClick:i,title:`Search or jump to (${m})`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 text-sm text-text-3 group-hover:text-text-2`,children:[(0,R.jsx)(Ph,{size:13}),(0,R.jsx)(`span`,{className:`truncate`,children:`Search or jump to…`})]}),(0,R.jsx)(BO,{children:m})]}),(0,R.jsx)(`button`,{className:`${Jj} size-8 shrink-0 justify-center ${o?`bg-accent-soft`:`bg-transparent`}`,title:`Jot a note (${gb(`J`)})`,"aria-label":`Jot a note`,"aria-pressed":o,onClick:a,children:(0,R.jsx)(`span`,{className:`flex items-center ${o?`text-accent-hi`:`text-text-3 group-hover:text-text`}`,children:(0,R.jsx)(Zh,{size:14})})}),r>0&&(0,R.jsx)(`button`,{className:`inline-flex h-7 shrink-0 cursor-pointer items-center gap-2 rounded-pill border border-hairline bg-transparent px-2.5 transition-colors duration-(--dur-1) ease-app hover:border-hairline-strong hover:bg-panel-3`,onClick:e.goHome,title:`Runs in flight in other projects — open the portfolio`,children:(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-needs`,children:[(0,R.jsx)(`span`,{className:`spin-ring`}),r,` running elsewhere`]})}),(0,R.jsx)(`button`,{className:`${Jj} size-8 shrink-0 justify-center bg-transparent`,title:`Settings`,"aria-label":`Settings`,onClick:s,children:(0,R.jsx)(`span`,{className:`flex items-center text-text-3 group-hover:text-text`,children:(0,R.jsx)(Fh,{size:14})})}),t===`feature`&&(0,R.jsx)(`button`,{className:`${Jj} size-8 shrink-0 justify-center ${u?`bg-transparent`:`bg-panel-3`}`,title:u?`Show details panel`:`Hide details panel`,"aria-label":u?`Show details panel`:`Hide details panel`,onClick:l,children:(0,R.jsx)(`span`,{className:`flex items-center group-hover:text-text ${u?`text-text-3`:`text-text-2`}`,children:(0,R.jsx)(Ih,{size:14})})})]})}function Qj(){return(0,R.jsx)(`span`,{className:`shrink-0 text-sm text-text-4`,"aria-hidden":`true`,children:`/`})}function $j(e,t){navigator.clipboard.writeText(e).then(()=>t.push(`copied ${e}`,`info`)).catch(()=>t.push(`copy failed`))}function eM({width:e,side:t,label:n,clamp:r,onResize:i}){let[a,o]=(0,L.useState)(!1),s=(0,L.useRef)({x:0,width:e});return(0,L.useEffect)(()=>{if(!a)return;let e=e=>{let n=e.clientX-s.current.x;i(r(s.current.width+(t===`left`?n:-n)))},n=()=>o(!1),c=document.body.style.userSelect;return document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,n),()=>{document.body.style.userSelect=c,document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,n)}},[r,a,i,t]),(0,R.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":n,title:`Drag to resize`,className:`absolute top-0 z-10 h-full w-1.5 cursor-col-resize hover:bg-accent-line ${t===`left`?`-right-[3px]`:`-left-[3px]`} ${a?`bg-accent-line`:``}`,onMouseDown:t=>{t.preventDefault(),s.current={x:t.clientX,width:e},o(!0)}})}function tM({actions:e,label:t=`feature actions`}){let n=(0,L.useRef)(null);return e.length===0?null:(0,R.jsx)(`div`,{className:`shrink-0 pr-1`,children:(0,R.jsxs)(Lj,{children:[(0,R.jsx)(Rj,{ref:n,className:`group cursor-pointer rounded-md border-0 bg-transparent px-1.5 py-1 transition-colors duration-(--dur-1) ease-app hover:bg-panel-3`,"aria-label":t,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:(0,R.jsx)(`span`,{className:`flex text-text-3 group-hover:text-text`,children:(0,R.jsx)(qh,{size:14})})}),(0,R.jsx)(zj,{align:`end`,className:`font-sans`,onCloseAutoFocus:e=>{let t=document.activeElement;t&&t!==document.body&&t!==n.current&&e.preventDefault()},children:e.map(e=>(0,R.jsx)(Hj,{className:`text-sm`,tone:e.danger?`danger`:`default`,onSelect:()=>{n.current?.focus(),e.onSelect(n)},children:e.label},e.key))})]})})}function nM({title:e,slug:t,busy:n,onConfirm:r,onCancel:i,returnFocusRef:a}){let[o,s]=(0,L.useState)(``),c=o.trim()===t;return(0,R.jsx)(RO,{open:!0,onClose:i,returnFocusRef:a,label:`Delete feature ${t}`,size:`sm`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 p-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 text-base leading-relaxed text-text-2`,children:[(0,R.jsxs)(`p`,{className:`m-0`,children:[`Permanently delete `,(0,R.jsx)(`strong`,{className:`font-semibold text-text`,children:e}),`? Its worktree, branches, running agent and all runcastle data go with it; committed docs stay in git history.`]}),(0,R.jsx)(`strong`,{className:`font-semibold text-text`,children:`This cannot be undone.`})]}),(0,R.jsx)(zO,{label:(0,R.jsxs)(R.Fragment,{children:[`Type`,` `,(0,R.jsx)(`code`,{className:`rounded-sm bg-panel-inset px-1.5 py-0.5 font-mono text-text`,children:t}),` `,`to confirm`]}),children:(0,R.jsx)(`input`,{className:`h-(--control-h) rounded-md border border-hairline-strong bg-panel-inset px-3 font-mono text-base text-text outline-none placeholder:text-text-4 focus:border-danger`,value:o,onChange:e=>s(e.target.value),autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:t})}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(J,{variant:`ghost`,onClick:i,disabled:n,children:`Cancel`}),(0,R.jsx)(J,{variant:`danger`,onClick:r,disabled:!c||n,children:n?`Deleting…`:`Delete feature`})]})]})})}var rM=`runcastle.sidebar.showArchived`;function iM(){try{return localStorage.getItem(rM)===`1`}catch{return!1}}var aM=`cursor-pointer`,oM=`group ${aM} mt-2 w-full rounded-md border-0 bg-transparent px-3 py-2 text-left text-sm transition-colors duration-(--dur-1) ease-app hover:bg-panel-3`,sM=`text-text-3 group-hover:text-text-2`,cM=`text-xs font-semibold tracking-[0.09em] uppercase`,lM=`group ${aM} inline-flex h-7 shrink-0 items-center rounded-md border border-hairline bg-transparent px-2.5 text-sm font-medium transition-colors duration-(--dur-1) ease-app hover:border-hairline-strong hover:bg-panel-3`,uM=`flex items-center gap-1.5 text-text-2 group-hover:text-text`;function dM({projectId:e,selectedFeatureId:t,projectSelected:n,width:r,talk:i,onSelect:a,onSelectProject:o,onNewChat:s,onDraft:c,onOpenPreparation:l,onResize:u}){let d=B.useUtils(),f=qy(),[p,m]=(0,L.useState)(iM),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(null),y=B.feature.list.useQuery({projectId:e},{refetchInterval:$m()}),b=B.project.prep.useQuery({projectId:e}),x=By(b.data&&{prepared:b.data.prepared,pendingCount:b.data.pendingKeys.length,staleCount:b.data.findings.filter(Fp).length}),S=g_(y.data??[],{showArchived:p}),C=(y.data??[]).filter(e=>e.status===`archived`).length,w=()=>void d.feature.list.invalidate(),T=B.feature.archive.useMutation({onSuccess:w,onError:e=>f.push(e.message)}),E=B.feature.unarchive.useMutation({onSuccess:w,onError:e=>f.push(e.message)}),D=B.feature.delete.useMutation({onSuccess:(e,n)=>{w(),n.featureId===t&&(a(null),o()),v(null)},onError:e=>f.push(e.message)}),O=()=>{m(e=>{let t=!e;try{localStorage.setItem(rM,t?`1`:`0`)}catch{}return t})},k=t=>{let n=[{key:`copy-link`,label:`Copy link`,onSelect:()=>$j(window.location.origin+bh({kind:`feature`,projectId:e,featureSlug:t.slug}),f)}];return t.status===`archived`?n.push({key:`unarchive`,label:`Unarchive`,onSelect:()=>E.mutate({featureId:t.id})}):t.status!==`draft`&&n.push({key:`archive`,label:`Archive`,onSelect:()=>T.mutate({featureId:t.id})}),t.status!==`shipped`&&n.push({key:`delete`,label:`Delete…`,danger:!0,onSelect:e=>v({feature:t,returnFocusRef:e})}),n};return(0,R.jsxs)(`nav`,{className:`relative flex min-h-0 flex-col border-r border-hairline bg-panel-2`,children:[(0,R.jsx)(fM,{width:r,onResize:u}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-4 pb-3`,children:[(0,R.jsx)(`span`,{className:`${cM} flex-1 text-text-3`,children:`Features`}),(0,R.jsx)(`button`,{className:lM,onClick:c,title:`Draft — write an idea down now, work it out later`,children:(0,R.jsxs)(`span`,{className:uM,children:[(0,R.jsx)(Xh,{size:11}),`Draft`]})}),(0,R.jsx)(`button`,{className:lM,onClick:s,title:`New — a conversation with the project: features and quick changes alike, cut into burn-ready tickets`,children:(0,R.jsxs)(`span`,{className:uM,children:[(0,R.jsx)(Bh,{size:11}),`New`]})})]}),(0,R.jsx)(pM,{projectId:e,active:n,state:i.state,onSelect:o}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pt-2 pb-3`,children:[y.isLoading&&(0,R.jsx)(`div`,{className:`px-2 py-3`,children:(0,R.jsx)(NO,{children:`loading features…`})}),y.data&&y.data.length===0&&(0,R.jsxs)(`div`,{className:`px-3 py-4 text-sm leading-relaxed text-text-3`,children:[`No features yet.`,(0,R.jsx)(`br`,{}),`Create one to start the pipeline.`]}),S.map(e=>{let n=b_(e,h);return(0,R.jsxs)(`div`,{className:`mt-4 first:mt-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2 px-2 pb-2`,children:[(0,R.jsx)(`span`,{className:`${cM} ${mM[e.key]}`,children:e.label}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-4`,children:e.features.length})]}),n.visible.map(e=>(0,R.jsx)(vM,{f:e,active:e.id===t,onSelect:a,actions:k(e)},e.id)),n.expanderLabel&&(0,R.jsx)(`button`,{className:oM,onClick:()=>g(e=>!e),children:(0,R.jsx)(`span`,{className:sM,children:n.expanderLabel})})]},e.key)}),C>0&&(0,R.jsx)(`button`,{className:oM,onClick:O,children:(0,R.jsxs)(`span`,{className:sM,children:[p?`Hide`:`Show`,` archived (`,C,`)`]})})]}),x&&(0,R.jsxs)(`button`,{className:`group ${aM} flex w-full shrink-0 items-center gap-2 border-0 border-t border-hairline bg-transparent px-4 py-3 text-left text-sm transition-colors duration-(--dur-1) ease-app hover:bg-panel-3`,onClick:l,title:x.title,"aria-label":`${x.label} — ${x.title}`,children:[(0,R.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${x.variant===`done`?`inset-ring-1 inset-ring-text-4`:`bg-drive`}`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 group-hover:text-text ${x.variant===`done`?`text-text-4`:`text-text-3`}`,children:x.label}),x.badge&&(0,R.jsx)(`span`,{className:`shrink-0 text-xs whitespace-nowrap text-text-4`,children:x.badge})]}),_&&(0,R.jsx)(nM,{title:_.feature.title,slug:_.feature.slug,busy:D.isPending,onConfirm:()=>D.mutate({featureId:_.feature.id}),onCancel:()=>v(null),returnFocusRef:_.returnFocusRef})]})}function fM({width:e,onResize:t}){return(0,R.jsx)(eM,{width:e,side:`left`,label:`Resize the features rail`,clamp:ob,onResize:t})}function pM({projectId:e,active:t,state:n,onSelect:r}){let i=B.project.list.useQuery().data?.find(t=>t.id===e),a=B.projectNotes.openCount.useQuery({projectId:e}).data??0;return(0,R.jsx)(`div`,{className:`shrink-0 border-b border-hairline-soft px-3 pb-3`,children:(0,R.jsxs)(`button`,{className:`${aM} flex w-full items-center gap-2 rounded-md border-0 px-3 py-3 text-left transition-colors duration-(--dur-1) ease-app ${t?`bg-accent-soft`:`bg-transparent hover:bg-panel-3`}`,onClick:r,title:`Talk to the project — intake, decomposition, and portfolio questions`,"aria-label":a>0?`${i?.name??`This project`} — ${a} open note${a===1?``:`s`}`:void 0,children:[(0,R.jsx)(`span`,{className:`flex shrink-0 items-center ${t?``:`opacity-85`}`,children:(0,R.jsx)(sg,{size:14,variant:`outline`})}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-base font-medium ${t?`text-text`:`text-text-2`}`,children:i?.name??`This project`}),a>0&&(0,R.jsx)(`span`,{className:`shrink-0 rounded-pill border border-hairline bg-panel-3 px-1.5 text-xs text-text-2`,title:`${a} note${a===1?``:`s`} waiting to be triaged`,children:a}),n===`none`?(0,R.jsx)(`span`,{className:`shrink-0 text-xs tracking-[0.07em] text-text-3 uppercase`,children:`Project`}):(0,R.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-xs text-accent-hi`,children:[(0,R.jsx)(`span`,{className:`spin-ring`}),n===`launching`?`opening`:`live`]})]})})}var mM={needsYou:`text-needs`,agentWorking:`text-ph-implementation`,inProgress:`text-text-3`,drafts:`text-text-4`,shipped:`text-ph-shipped`,archived:`text-text-4`},hM={needsMe:`border-needs/40 text-needs`,working:`border-accent-line text-accent-hi`,shipped:`border-ok/40 text-ok`,draft:`border-hairline text-text-4`,age:`border-hairline text-text-3`},gM={attention:`bg-danger`,grill:`bg-needs`,burn:`bg-needs`,ship:`bg-needs`},_M={done:`bg-text-4`,current:`bg-accent`,upcoming:`bg-hairline`};function vM({f:e,active:t,onSelect:n,actions:r}){let i=f_(e),a=p_(e),o=Pv(e),s=e.status===`draft`,c=s||e.status===`shipped`||e.status===`archived`;return(0,R.jsxs)(`div`,{className:`relative mb-1 flex items-center rounded-md transition-colors duration-(--dur-1) ease-app ${t?`bg-accent-soft inset-ring-1 inset-ring-accent-line`:`hover:bg-panel-3`} ${c?`opacity-70 hover:opacity-100`:``}`,children:[(0,R.jsxs)(`button`,{className:`${aM} flex min-w-0 flex-1 items-start gap-2 border-0 bg-transparent px-3 py-3 text-left`,onClick:()=>n(e.id),title:e.title,children:[s?(0,R.jsx)(`span`,{className:`mt-1 w-2 shrink-0 text-xs leading-none text-text-4`,"aria-hidden":`true`,children:`◌`}):(0,R.jsx)(ZO,{phase:e.phase,className:`mt-1.5`}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,R.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-base leading-snug ${t?`font-medium text-text`:c?`text-text-3`:`font-medium text-text-2`}`,children:e.title}),(0,R.jsxs)(`span`,{className:`mt-px inline-flex h-5 shrink-0 items-center gap-1.5 rounded-pill border px-2 text-xs whitespace-nowrap ${hM[i.kind]}`,title:i.title,children:[i.kind===`needsMe`&&i.needs&&(0,R.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${gM[i.needs]}`}),i.kind===`working`&&(0,R.jsx)(`span`,{className:`spin-ring`}),i.kind===`shipped`&&(0,R.jsx)(Vh,{size:11}),i.text]})]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`inline-flex gap-0.5`,children:o.map((e,t)=>(0,R.jsx)(`span`,{className:`h-1 w-2.5 rounded-[2px] ${_M[e.state]}`},t))}),a&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:a})]})]})]}),(0,R.jsx)(tM,{actions:r})]})}function yM(e){let[t,n]=(0,L.useState)([]),r=t.length?t[t.length-1].id:void 0,i=B.events.list.useQuery({featureId:e,afterId:r},{refetchInterval:$m()});return(0,L.useEffect)(()=>{let e=i.data;!e||e.length===0||n(t=>{let n=new Set(t.map(e=>e.id)),r=e.filter(e=>!n.has(e.id));return r.length===0?t:[...t,...r].sort((e,t)=>e.id-t.id)})},[i.data]),t}var bM=140,xM=64;function SM(e){return e.replace(/```[^\n]*\n?/g,``).replace(/^\s{0,3}#{1,6}\s+/gm,``).replace(/^\s{0,3}>\s?/gm,``).replace(/^\s*[-*+]\s+/gm,``).replace(/^\s*\d+\.\s+/gm,``).replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/(\*\*|__)(.+?)\1/g,`$2`).replace(/~~(.+?)~~/g,`$1`).replace(/(^|[\s(])[*_](\S(?:.*?\S)?)[*_]($|[\s.,;:)!?])/g,`$1$2$3`).replace(/`([^`]+)`/g,`$1`).trim()}function CM(e){for(let t of e.split(`
|
|
121
|
+
`)){let e=t.trim();if(e!==``)return e}return``}function wM(e,t){return e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e}function TM(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.name!=`string`||t.name===``?null:{name:t.name,args:typeof t.args==`string`?t.args:``}}function EM(e){return e.endsWith(`.tool`)}function DM(e){let t=e.replace(/[._]+/g,` `).trim();return t===``?``:`${t[0].toUpperCase()}${t.slice(1)}`}function OM(e,t){if(!t.startsWith(e))return null;let n=t.slice(e.length).replace(/^[\s:;,—–-]+/,``).trim().replace(/^\((.*)\)$/s,`$1`).trim(),r=DM(e);return n===``?r:`${r} — ${n}`}function kM(e){return typeof e==`object`&&e?e:null}function AM(e){return typeof e==`string`&&e!==``?e:null}function jM(e){if(e.type!==`feature.created`)return null;let t=kM(e.data),n=AM(t?.branch);if(!t||!n)return null;if(t.draft===!0)return`Feature created as a draft — ${n} is not cut yet`;if(t.branchReady!==!0)return`Feature created — branch ${n} is still being cut`;let r=AM(t.baseBranch);return r?`Feature created on branch ${n}, from ${r}`:`Feature created on branch ${n}`}function MM(e){if(EM(e.type)){let t=TM(e.data);if(!t){let t=CM(e.message);return{summary:wM(t,bM)||DM(e.type),detail:e.message.trim()===t?null:e.message.trim()}}let n=wM(CM(t.args),xM);return{summary:n?`${t.name} — ${n}`:`${t.name}`,detail:t.args.trim()===``?null:t.args.trim()}}let t=SM(e.message),n=jM(e)??OM(e.type,t)??t,r=wM(CM(n),bM),i=n===r?null:n;return{summary:r||DM(e.type),detail:i}}function NM(e){return e===`lap.started`}function PM(e){if(e.type!==`run.finished`||typeof e.data!=`object`||e.data===null)return null;let t=e.data.status;return t===`succeeded`||t===`failed`||t===`cancelled`?t:null}function FM(e){let t=PM(e);if(t)return t===`succeeded`?`ok`:`error`;let n=e.type;return n===`merge.conflict.resolved`?`ok`:n===`merge.conflict.resolving`?`active`:/(error|fail|conflict|cancel|stopped|timeout)/i.test(n)?`error`:/(done|succeed|finished|shipped|merged)/i.test(n)?`ok`:/(start|burn|launch|advance|running|retry|resum)/i.test(n)?`active`:`info`}function IM(e){return typeof e.data!=`object`||e.data===null?!1:e.data.oversized===!0}var LM={error:`bg-danger`,ok:`bg-ok`,active:`bg-accent`,info:`bg-text-4`};function RM(e){return e.replace(/_/g,` `).replace(`.`,` · `)}function zM({events:e}){let t=e.slice(-50).reverse();return t.length===0?(0,R.jsx)(`div`,{className:`text-sm leading-relaxed text-pretty text-text-3`,children:`Everything that happens to this feature shows up here.`}):(0,R.jsx)(`div`,{className:`flex flex-col`,children:t.map(e=>NM(e.type)?(0,R.jsx)(BM,{event:e},e.id):(0,R.jsx)(VM,{event:e},e.id))})}function BM({event:e}){return(0,R.jsxs)(`div`,{className:`my-1.5 flex items-center gap-2 px-1 font-mono text-xs tracking-[0.06em] text-accent-2 uppercase`,role:`separator`,children:[(0,R.jsx)(`span`,{children:MM(e).summary}),(0,R.jsx)(`span`,{className:`h-px flex-1 bg-accent-line`}),(0,R.jsx)(`span`,{className:`text-text-4`,children:s_(e.ts)})]})}function VM({event:e}){let[t,n]=(0,L.useState)(!1),r=MM(e);return(0,R.jsxs)(`div`,{className:`flex gap-2.5 px-0.5 py-2`,children:[(0,R.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full ${LM[FM(e)]}`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r.detail?(0,R.jsxs)(`button`,{type:`button`,className:`m-0 w-full cursor-pointer border-0 bg-transparent p-0 text-left font-sans text-sm leading-snug text-text-2 hover:text-text`,"aria-expanded":t,title:t?`Show less`:`Show the whole event`,onClick:()=>n(e=>!e),children:[r.summary,(0,R.jsx)(`span`,{className:`ml-1.5 text-text-4`,"aria-hidden":`true`,children:t?`−`:`+`})]}):(0,R.jsx)(`div`,{className:`text-sm leading-snug text-text-2`,children:r.summary}),t&&r.detail&&(0,R.jsx)(`pre`,{className:`m-0 mt-1.5 max-h-[260px] overflow-auto rounded-md border border-hairline bg-panel-inset px-2 py-1.5 font-mono text-xs leading-relaxed break-words whitespace-pre-wrap text-text-2`,children:r.detail}),(0,R.jsxs)(`div`,{className:`mt-0.5 flex items-baseline gap-2 text-xs text-text-4`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:RM(e.type)}),(0,R.jsx)(`span`,{className:`ml-auto shrink-0`,children:s_(e.ts)})]})]})]})}function HM(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var UM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GM={};function KM(e,t){return((t||GM).jsx?WM:UM).test(e)}var qM=/[ \t\n\f\r]/g;function JM(e){return typeof e==`object`?e.type===`text`&&YM(e.value):YM(e)}function YM(e){return e.replace(qM,``)===``}var XM=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};XM.prototype.normal={},XM.prototype.property={},XM.prototype.space=void 0;function ZM(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new XM(n,r,t)}function QM(e){return e.toLowerCase()}var $M=class{constructor(e,t){this.attribute=t,this.property=e}};$M.prototype.attribute=``,$M.prototype.booleanish=!1,$M.prototype.boolean=!1,$M.prototype.commaOrSpaceSeparated=!1,$M.prototype.commaSeparated=!1,$M.prototype.defined=!1,$M.prototype.mustUseProperty=!1,$M.prototype.number=!1,$M.prototype.overloadedBoolean=!1,$M.prototype.property=``,$M.prototype.spaceSeparated=!1,$M.prototype.space=void 0;var eN=s({boolean:()=>nN,booleanish:()=>rN,commaOrSpaceSeparated:()=>sN,commaSeparated:()=>oN,number:()=>Y,overloadedBoolean:()=>iN,spaceSeparated:()=>aN}),tN=0,nN=cN(),rN=cN(),iN=cN(),Y=cN(),aN=cN(),oN=cN(),sN=cN();function cN(){return 2**++tN}var lN=Object.keys(eN),uN=class extends $M{constructor(e,t,n,r){let i=-1;if(super(e,t),dN(this,`space`,r),typeof n==`number`)for(;++i<lN.length;){let e=lN[i];dN(this,lN[i],(n&eN[e])===eN[e])}}};uN.prototype.defined=!0;function dN(e,t,n){n&&(e[t]=n)}function fN(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new uN(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[QM(r)]=r,n[QM(a.attribute)]=r}return new XM(t,n,e.space)}var pN=fN({properties:{ariaActiveDescendant:null,ariaAtomic:rN,ariaAutoComplete:null,ariaBusy:rN,ariaChecked:rN,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:aN,ariaCurrent:null,ariaDescribedBy:aN,ariaDetails:null,ariaDisabled:rN,ariaDropEffect:aN,ariaErrorMessage:null,ariaExpanded:rN,ariaFlowTo:aN,ariaGrabbed:rN,ariaHasPopup:null,ariaHidden:rN,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:aN,ariaLevel:Y,ariaLive:null,ariaModal:rN,ariaMultiLine:rN,ariaMultiSelectable:rN,ariaOrientation:null,ariaOwns:aN,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:rN,ariaReadOnly:rN,ariaRelevant:null,ariaRequired:rN,ariaRoleDescription:aN,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:rN,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function mN(e,t){return t in e?e[t]:t}function hN(e,t){return mN(e,t.toLowerCase())}var gN=fN({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:oN,acceptCharset:aN,accessKey:aN,action:null,allow:null,allowFullScreen:nN,allowPaymentRequest:nN,allowUserMedia:nN,alpha:nN,alt:null,as:null,async:nN,autoCapitalize:null,autoComplete:aN,autoFocus:nN,autoPlay:nN,blocking:aN,capture:null,charSet:null,checked:nN,cite:null,className:aN,closedBy:null,colorSpace:null,cols:Y,colSpan:Y,command:null,commandFor:null,content:null,contentEditable:rN,controls:nN,controlsList:aN,coords:Y|oN,crossOrigin:null,data:null,dateTime:null,decoding:null,default:nN,defer:nN,dir:null,dirName:null,disabled:nN,download:iN,draggable:rN,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:nN,formTarget:null,headers:aN,height:Y,hidden:iN,high:Y,href:null,hrefLang:null,htmlFor:aN,httpEquiv:aN,id:null,imageSizes:null,imageSrcSet:null,inert:nN,inputMode:null,integrity:null,is:null,isMap:nN,itemId:null,itemProp:aN,itemRef:aN,itemScope:nN,itemType:aN,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:nN,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:nN,muted:nN,name:null,nonce:null,noModule:nN,noValidate:nN,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:nN,optimum:Y,pattern:null,ping:aN,placeholder:null,playsInline:nN,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:nN,referrerPolicy:null,rel:aN,required:nN,reversed:nN,rows:Y,rowSpan:Y,sandbox:aN,scope:null,scoped:nN,seamless:nN,selected:nN,shadowRootClonable:nN,shadowRootCustomElementRegistry:nN,shadowRootDelegatesFocus:nN,shadowRootMode:null,shadowRootSerializable:nN,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:rN,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:nN,useMap:null,value:rN,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:aN,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:nN,declare:nN,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:nN,noHref:nN,noShade:nN,noWrap:nN,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:rN,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:nN,disablePictureInPicture:nN,disableRemotePlayback:nN,exportParts:oN,part:aN,prefix:null,property:null,results:Y,security:null,unselectable:null},space:`html`,transform:hN}),_N=fN({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:sN,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:aN,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:nN,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:oN,g2:oN,glyphName:oN,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:sN,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Y,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:aN,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sN,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sN,rev:sN,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sN,requiredFeatures:sN,requiredFonts:sN,requiredFormats:sN,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:sN,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sN,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sN,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:mN}),vN=fN({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),yN=fN({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:hN}),bN=fN({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),xN={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`},SN=/[A-Z]/g,CN=/-[a-z]/g,wN=/^data[-\w.:]+$/i;function TN(e,t){let n=QM(t),r=t,i=$M;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&wN.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(CN,DN);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!CN.test(e)){let n=e.replace(SN,EN);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=uN}return new i(r,t)}function EN(e){return`-`+e.toLowerCase()}function DN(e){return e.charAt(1).toUpperCase()}var ON=ZM([pN,gN,vN,yN,bN],`html`),kN=ZM([pN,_N,vN,yN,bN],`svg`);function AN(e){return e.join(` `).trim()}var jN=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;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(`
|
|
122
|
+
`);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})),MN=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(jN());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}})),NN=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),PN=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(MN()),r=NN();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})),FN=LN(`end`),IN=LN(`start`);function LN(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 RN(e){let t=IN(e),n=FN(e);if(t&&n)return{start:t,end:n}}function zN(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?VN(e.position):`start`in e||`end`in e?VN(e):`line`in e||`column`in e?BN(e):``}function BN(e){return HN(e&&e.line)+`:`+HN(e&&e.column)}function VN(e){return BN(e&&e.start)+`-`+BN(e&&e.end)}function HN(e){return e&&typeof e==`number`?e:1}var UN=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=zN(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}};UN.prototype.file=``,UN.prototype.name=``,UN.prototype.reason=``,UN.prototype.message=``,UN.prototype.stack=``,UN.prototype.column=void 0,UN.prototype.line=void 0,UN.prototype.ancestors=void 0,UN.prototype.cause=void 0,UN.prototype.fatal=void 0,UN.prototype.place=void 0,UN.prototype.ruleId=void 0,UN.prototype.source=void 0;var WN=l(PN(),1),GN={}.hasOwnProperty,KN=new Map,qN=/[A-Z]/g,JN=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),YN=new Set([`td`,`th`]);function XN(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=sP(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=oP(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`?kN:ON,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ZN(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ZN(e,t,n){if(t.type===`element`)return QN(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return $N(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return tP(e,t,n);if(t.type===`mdxjsEsm`)return eP(e,t);if(t.type===`root`)return nP(e,t,n);if(t.type===`text`)return rP(e,t)}function QN(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=kN,e.schema=i),e.ancestors.push(t);let a=pP(e,t.tagName,!1),o=cP(e,t),s=uP(e,t);return JN.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!JM(e)})),iP(e,o,a,t),aP(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function $N(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)}mP(e,t.position)}function eP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mP(e,t.position)}function tP(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=kN,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:pP(e,t.name,!0),o=lP(e,t),s=uP(e,t);return iP(e,o,a,t),aP(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function nP(e,t,n){let r={};return aP(r,uP(e,t)),e.create(t,e.Fragment,r,n)}function rP(e,t){return t.value}function iP(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function aP(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function oP(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 sP(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=IN(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 cP(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&GN.call(t.properties,i)){let a=dP(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&YN.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 lP(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 mP(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 mP(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function uP(e,t){let n=[],r=-1,i=e.passKeys?new Map:KN;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=ZN(e,a,o);s!==void 0&&n.push(s)}return n}function dP(e,t,n){let r=TN(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?HM(n):AN(n)),r.property===`style`){let t=typeof n==`object`?n:fP(e,String(n));return e.stylePropertyNameCase===`css`&&(t=hP(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?xN[r.property]||r.property:r.attribute,n]}}function fP(e,t){try{return(0,WN.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new UN("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function pP(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=KM(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=KM(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return GN.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);mP(e)}function mP(e,t){let n=new UN("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function hP(e){let t={},n;for(n in e)GN.call(e,n)&&(t[gP(n)]=e[n]);return t}function gP(e){let t=e.replace(qN,_P);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function _P(e){return`-`+e.toLowerCase()}var vP={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`]},yP={};function bP(e,t){let n=t||yP;return xP(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function xP(e,t,n){if(CP(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 SP(e.children,t,n)}return Array.isArray(e)?SP(e,t,n):``}function SP(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=xP(e[i],t,n);return r.join(``)}function CP(e){return!!(e&&typeof e==`object`)}var wP=document.createElement(`i`);function TP(e){let t=`&`+e+`;`;wP.innerHTML=t;let n=wP.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function EP(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 DP(e,t){return e.length>0?(EP(e,e.length,0,t),e):t}var OP={}.hasOwnProperty;function kP(e){let t={},n=-1;for(;++n<e.length;)AP(t,e[n]);return t}function AP(e,t){let n;for(n in t){let r=(OP.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){OP.call(r,a)||(r[a]=[]);let e=i[a];jP(r[a],Array.isArray(e)?e:e?[e]:[])}}}function jP(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);EP(e,0,0,r)}function MP(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 NP(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var PP=GP(/[A-Za-z]/),FP=GP(/[\dA-Za-z]/),IP=GP(/[#-'*+\--9=?A-Z^-~]/);function LP(e){return e!==null&&(e<32||e===127)}var RP=GP(/\d/),zP=GP(/[\dA-Fa-f]/),BP=GP(/[!-/:-@[-`{-~]/);function X(e){return e!==null&&e<-2}function VP(e){return e!==null&&(e<0||e===32)}function HP(e){return e===-2||e===-1||e===32}var UP=GP(/\p{P}|\p{S}/u),WP=GP(/\s/);function GP(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function KP(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&FP(e.charCodeAt(n+1))&&FP(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 qP(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return HP(r)?(e.enter(n),s(r)):t(r)}function s(r){return HP(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var JP={tokenize:YP};function YP(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),qP(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return X(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var XP={tokenize:QP},ZP={tokenize:$P};function QP(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return EP(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ZP,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(ZP,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return X(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++;EP(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function $P(e,t,n){return qP(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function eF(e){if(e===null||VP(e)||WP(e))return 1;if(UP(e))return 2}function tF(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 nF={name:`attention`,resolveAll:rF,tokenize:iF};function rF(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};aF(d,-c),aF(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=DP(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=DP(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=DP(l,tF(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=DP(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=DP(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,EP(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function iF(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=eF(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=eF(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function aF(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var oF={name:`autolink`,tokenize:sF};function sF(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 PP(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||FP(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||FP(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||LP(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):IP(t)?(e.consume(t),l):n(t)}function u(e){return FP(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||FP(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var cF={partial:!0,tokenize:lF};function lF(e,t,n){return r;function r(t){return HP(t)?qP(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||X(e)?t(e):n(e)}}var uF={continuation:{tokenize:fF},exit:pF,name:`blockQuote`,tokenize:dF};function dF(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 HP(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function fF(e,t,n){let r=this;return i;function i(t){return HP(t)?qP(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(uF,t,n)(r)}}function pF(e){e.exit(`blockQuote`)}var mF={name:`characterEscape`,tokenize:hF};function hF(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 BP(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var gF={name:`characterReference`,tokenize:_F};function _F(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=FP,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=zP,u):(e.enter(`characterReferenceValue`),a=7,o=RP,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===FP&&!TP(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 vF={partial:!0,tokenize:xF},yF={concrete:!0,name:`codeFenced`,tokenize:bF};function bF(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`),HP(t)?qP(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||X(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(vF,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):HP(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),qP(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||X(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||X(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&&HP(t)?qP(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||X(t)?e.check(vF,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||X(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`),HP(t)?qP(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`),HP(t)?qP(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||X(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function xF(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 SF={name:`codeIndented`,tokenize:wF},CF={partial:!0,tokenize:TF};function wF(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),qP(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):X(t)?e.attempt(CF,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||X(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function TF(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):qP(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):X(e)?i(e):n(e)}}var EF={name:`codeText`,previous:OF,resolve:DF,tokenize:kF};function DF(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 OF(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function kF(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)):X(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||X(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 AF=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&&jF(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),jF(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jF(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);jF(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);jF(this.left,t.reverse())}}};function jF(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 MF(e){let t={},n=-1,r,i,a,o,s,c,l,u=new AF(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,NF(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 EP(e,0,1/0,u.slice(0)),!l}function NF(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 PF={resolve:IF,tokenize:LF},FF={partial:!0,tokenize:RF};function IF(e){return MF(e),e}function LF(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):X(t)?e.check(FF,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 RF(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),qP(e,a,`linePrefix`)}function a(i){if(i===null||X(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 zF(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||LP(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||X(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||VP(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||LP(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 BF(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):X(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||X(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!HP(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function VF(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):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),qP(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||X(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 HF(e,t){let n;return r;function r(i){return X(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):HP(i)?qP(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var UF={name:`definition`,tokenize:GF},WF={partial:!0,tokenize:KF};function GF(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return BF.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=NP(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 VP(t)?HF(e,l)(t):l(t)}function l(t){return zF(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(WF,d,d)(t)}function d(t){return HP(t)?qP(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||X(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function KF(e,t,n){return r;function r(t){return VP(t)?HF(e,i)(t):n(t)}function i(t){return VF(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return HP(t)?qP(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||X(e)?t(e):n(e)}}var qF={name:`hardBreakEscape`,tokenize:JF};function JF(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return X(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var YF={name:`headingAtx`,resolve:XF,tokenize:ZF};function XF(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},EP(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function ZF(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||VP(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||X(n)?(e.exit(`atxHeading`),t(n)):HP(n)?qP(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||VP(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var QF=`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(`.`),$F=[`pre`,`script`,`style`,`textarea`],eI={concrete:!0,name:`htmlFlow`,resolveTo:rI,tokenize:iI},tI={partial:!0,tokenize:oI},nI={partial:!0,tokenize:aI};function rI(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 iI(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:ee):PP(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):PP(a)?(e.consume(a),i=4,r.interrupt?t:ee):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ee):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 PP(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||VP(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&$F.includes(l)?(i=1,r.interrupt?t(s):O(s)):QF.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||FP(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 HP(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||PP(t)?(e.consume(t),b):HP(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||FP(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):HP(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):HP(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||X(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||VP(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||HP(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||X(t)?O(t):HP(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),te):t===63&&i===3?(e.consume(t),ee):t===93&&i===5?(e.consume(t),F):X(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(tI,ne,k)(t)):t===null||X(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(nI,A,ne)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||X(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ee):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return $F.includes(n)?(e.consume(t),te):O(t)}return PP(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),ee):O(t)}function ee(t){return t===62?(e.consume(t),te):t===45&&i===2?(e.consume(t),ee):O(t)}function te(t){return t===null||X(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),te)}function ne(n){return e.exit(`htmlFlow`),t(n)}}function aI(e,t,n){let r=this;return i;function i(t){return X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function oI(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(cF,t,n)}}var sI={name:`htmlText`,tokenize:cI};function cI(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):PP(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):PP(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):X(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):X(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):X(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):X(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return PP(t)?(e.consume(t),S):n(t)}function S(t){return t===45||FP(t)?(e.consume(t),S):C(t)}function C(t){return X(t)?(o=C,N(t)):HP(t)?(e.consume(t),C):M(t)}function w(t){return t===45||FP(t)?(e.consume(t),w):t===47||t===62||VP(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||PP(t)?(e.consume(t),E):X(t)?(o=T,N(t)):HP(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||FP(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):X(t)?(o=D,N(t)):HP(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):X(t)?(o=O,N(t)):HP(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):X(t)?(o=k,N(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||VP(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||VP(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return HP(t)?qP(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var lI={name:`labelEnd`,resolveAll:pI,resolveTo:mI,tokenize:hI},uI={tokenize:gI},dI={tokenize:_I},fI={tokenize:vI};function pI(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&&EP(e,0,e.length,n),e}function mI(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=DP(s,e.slice(a+1,a+r+3)),s=DP(s,[[`enter`,u,t]]),s=DP(s,tF(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=DP(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=DP(s,e.slice(o+1)),s=DP(s,[[`exit`,c,t]]),EP(e,a,e.length,s),e}function hI(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(NP(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(uI,u,o?u:d)(t):t===91?e.attempt(dI,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(fI,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function gI(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 VP(t)?HF(e,a)(t):a(t)}function a(t){return t===41?u(t):zF(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return VP(t)?HF(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?VF(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return VP(t)?HF(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 _I(e,t,n){let r=this;return i;function i(t){return BF.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(NP(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function vI(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 yI={name:`labelStartImage`,resolveAll:lI.resolveAll,tokenize:bI};function bI(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var xI={name:`labelStartLink`,resolveAll:lI.resolveAll,tokenize:SI};function SI(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var CI={name:`lineEnding`,tokenize:wI};function wI(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),qP(e,t,`linePrefix`)}}var TI={name:`thematicBreak`,tokenize:EI};function EI(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||X(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),HP(t)?qP(e,s,`whitespace`)(t):s(t))}}var DI={continuation:{tokenize:jI},exit:NI,name:`list`,tokenize:AI},OI={partial:!0,tokenize:PI},kI={partial:!0,tokenize:MI};function AI(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:RP(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(TI,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 RP(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(cF,r.interrupt?n:u,e.attempt(OI,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return HP(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 jI(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(cF,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qP(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!HP(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(kI,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,qP(e,e.attempt(DI,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function MI(e,t,n){let r=this;return qP(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 NI(e){e.exit(this.containerState.type)}function PI(e,t,n){let r=this;return qP(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!HP(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var FI={name:`setextUnderline`,resolveTo:II,tokenize:LI};function II(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function LI(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`),HP(t)?qP(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||X(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var RI={tokenize:zI};function zI(e){let t=this,n=e.attempt(cF,r,e.attempt(this.parser.constructs.flowInitial,i,qP(e,e.attempt(this.parser.constructs.flow,i,e.attempt(PF,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var BI={resolveAll:WI()},VI=UI(`string`),HI=UI(`text`);function UI(e){return{resolveAll:WI(e===`text`?GI:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function WI(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 GI(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var KI=s({attentionMarkers:()=>eL,contentInitial:()=>JI,disable:()=>tL,document:()=>qI,flow:()=>XI,flowInitial:()=>YI,insideSpan:()=>$I,string:()=>ZI,text:()=>QI}),qI={42:DI,43:DI,45:DI,48:DI,49:DI,50:DI,51:DI,52:DI,53:DI,54:DI,55:DI,56:DI,57:DI,62:uF},JI={91:UF},YI={[-2]:SF,[-1]:SF,32:SF},XI={35:YF,42:TI,45:[FI,TI],60:eI,61:FI,95:TI,96:yF,126:yF},ZI={38:gF,92:mF},QI={[-5]:CI,[-4]:CI,[-3]:CI,33:yI,38:gF,42:nF,60:[oF,sI],91:xI,92:[qF,mF],93:lI,95:nF,96:EF},$I={null:[nF,BI]},eL={null:[42,95]},tL={null:[]};function nL(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=DP(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=tF(a,l.events,l),l.events):[]}function f(e,t){return iL(p(e),t)}function p(e){return rL(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){X(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&&EP(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 rL(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 iL(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=`
|
|
123
|
+
`;break;case-3:o=`\r
|
|
124
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function aL(e){let t={constructs:kP([KI,...(e||{}).extensions||[]]),content:n(JP),defined:[],document:n(XP),flow:n(RI),lazy:{},string:n(VI),text:n(HI)};return t;function n(e){return n;function n(n){return nL(t,e,n)}}}function oL(e){for(;!MF(e););return e}var sL=/[\0\t\n\r]/g;function cL(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(sL.lastIndex=u,c=sL.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var lL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uL(e){return e.replace(lL,dL)}function dL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return MP(n.slice(t?2:1),t?16:10)}return TP(n)||e}var fL={}.hasOwnProperty;function pL(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),mL(n)(oL(aL(n).document().write(cL()(e,t,!0))))}function mL(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(me),blockQuote:a(le),characterEscape:T,characterReference:T,codeFenced:a(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ue,o),codeText:a(de,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(pe),hardBreakEscape:a(he),hardBreakTrailing:a(he),htmlFlow:a(ge,o),htmlFlowData:T,htmlText:a(ge,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:I,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(me),strong:a(Se),thematicBreak:a(we)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ce,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:ae,characterReference:oe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:re,resourceDestinationString:ee,resourceTitleString:te,resource:ne,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};gL(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];fL.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||vL).call(a,void 0,e[0])}for(r.position={start:hL(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:hL(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:hL(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||vL).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+zN({start:e.start,end:e.end})+`): it’s not open`);n.position.end=hL(e.end)}function u(){return bP(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=NP(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:hL(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=hL(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=hL(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=uL(t),n.identifier=NP(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ne(){this.data.inReference=void 0}function I(){this.data.referenceType=`collapsed`}function re(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=NP(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ie(e){this.data.characterReferenceType=e.type}function ae(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=MP(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=TP(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=hL(e.end)}function se(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function le(){return{type:`blockquote`,children:[]}}function ue(){return{type:`code`,lang:null,meta:null,value:``}}function de(){return{type:`inlineCode`,value:``}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function pe(){return{type:`emphasis`,children:[]}}function me(){return{type:`heading`,depth:0,children:[]}}function he(){return{type:`break`}}function ge(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function we(){return{type:`thematicBreak`}}}function hL(e){return{line:e.line,column:e.column,offset:e.offset}}function gL(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?gL(e,r):_L(e,r)}}function _L(e,t){let n;for(n in t)if(fL.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function vL(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+zN({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+zN({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+zN({start:t.start,end:t.end})+`) is still open`)}function yL(e){let t=this;t.parser=n;function n(n){return pL(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function bL(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function xL(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
125
|
+
`}]}function SL(e,t){let n=t.value?t.value+`
|
|
126
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function CL(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wL(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TL(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=KP(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function EL(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DL(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function OL(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function kL(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return OL(e,t);let i={src:KP(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function AL(e,t){let n={src:KP(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function jL(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function ML(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return OL(e,t);let i={href:KP(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function NL(e,t){let n={href:KP(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function PL(e,t,n){let r=e.all(t),i=n?FL(n):IL(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
127
|
+
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
128
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function FL(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=IL(n[r])}return t}function IL(e){return e.spread??e.children.length>1}function LL(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function RL(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zL(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function BL(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VL(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=IN(t.children[1]),o=FN(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function HL(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function UL(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var WL=9,GL=32;function KL(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(qL(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(qL(t.slice(i),i>0,!1)),a.join(``)}function qL(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===WL||t===GL;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===WL||t===GL;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function JL(e,t){let n={type:`text`,value:KL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function YL(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var XL={blockquote:bL,break:xL,code:SL,delete:CL,emphasis:wL,footnoteReference:TL,heading:EL,html:DL,imageReference:kL,image:AL,inlineCode:jL,linkReference:ML,link:NL,listItem:PL,list:LL,paragraph:RL,root:zL,strong:BL,table:VL,tableCell:UL,tableRow:HL,text:JL,thematicBreak:YL,toml:ZL,yaml:ZL,definition:ZL,footnoteDefinition:ZL};function ZL(){}var QL=typeof self==`object`?self:globalThis,$L=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new QL[e](t)},eR=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof QL[e]==`function`?$L(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n($L(a,o),i)};return r},tR=e=>eR(new Map,e)(0),nR=``,{toString:rR}={},{keys:iR}=Object,aR=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=rR.call(e).slice(8,-1);switch(n){case`Array`:return[1,nR];case`Object`:return[2,nR];case`Date`:return[3,nR];case`RegExp`:return[4,nR];case`Map`:return[5,nR];case`Set`:return[6,nR];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},oR=([e,t])=>e===0&&(t===`function`||t===`symbol`),sR=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=aR(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of iR(r))(e||!oR(aR(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?nR:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(oR(aR(n))||oR(aR(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!oR(aR(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},cR=(e,{json:t,lossy:n}={})=>{let r=[];return sR(!(t||n),!!t,new Map,r)(e),r},lR=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?tR(cR(e,t)):structuredClone(e):(e,t)=>tR(cR(e,t));function uR(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function dR(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function fR(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||uR,r=e.options.footnoteBackLabel||dR,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=KP(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...lR(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
129
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
130
|
+
`}]}}var pR=(function(e){if(e==null)return vR;if(typeof e==`function`)return _R(e);if(typeof e==`object`)return Array.isArray(e)?mR(e):hR(e);if(typeof e==`string`)return gR(e);throw Error(`Expected function, string, or object as test`)});function mR(e){let t=[],n=-1;for(;++n<e.length;)t[n]=pR(e[n]);return _R(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function hR(e){let t=e;return _R(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function gR(e){return _R(t);function t(t){return t&&t.type===e}}function _R(e){return t;function t(t,n,r){return!!(yR(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function vR(){return!0}function yR(e){return typeof e==`object`&&!!e&&`type`in e}function bR(e){return e}var xR=[];function SR(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=pR(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+bR(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=xR,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=CR(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function CR(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?xR:[e]}function wR(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),SR(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var TR={}.hasOwnProperty,ER={};function DR(e,t){let n=t||ER,r=new Map,i=new Map,a={all:s,applyData:kR,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...XL,...n.handlers},one:o,options:n,patch:OR,wrap:jR};return wR(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(TR.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=lR(n);return r.children=a.all(e),r}return lR(e)}return(a.options.unknownHandler||AR)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=MR(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=MR(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function OR(e,t){e.position&&(t.position=RN(e))}function kR(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,lR(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function AR(e,t){let n=t.data||{},r=`value`in t&&!(TR.call(n,`hProperties`)||TR.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function jR(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
131
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
132
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
133
|
+
`}),n}function MR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function NR(e,t){let n=DR(e,t),r=n.one(e,void 0),i=fR(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
134
|
+
`},i)),a}function PR(e,t){return e&&`run`in e?async function(n,r){let i=NR(n,{file:r,...t});await e.run(i,r)}:function(n,r){return NR(n,{file:r,...e||t})}}function FR(e){if(e)throw e}var IR=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function LR(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function RR(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?zR(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function zR(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var BR={basename:VR,dirname:HR,extname:UR,join:WR,sep:`/`};function VR(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);qR(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function HR(e){if(qR(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function UR(e){qR(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function WR(...e){let t=-1,n;for(;++t<e.length;)qR(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:GR(n)}function GR(e){qR(e);let t=e.codePointAt(0)===47,n=KR(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function KR(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function qR(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var JR={cwd:YR};function YR(){return`/`}function XR(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function ZR(e){if(typeof e==`string`)e=new URL(e);else if(!XR(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return QR(e)}function QR(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var $R=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],ez=class{constructor(e){let t;t=e?XR(e)?{path:e}:typeof e==`string`||iz(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:JR.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<$R.length;){let e=$R[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)$R.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?BR.basename(this.path):void 0}set basename(e){nz(e,`basename`),tz(e,`basename`),this.path=BR.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?BR.dirname(this.path):void 0}set dirname(e){rz(this.basename,`dirname`),this.path=BR.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?BR.extname(this.path):void 0}set extname(e){if(tz(e,`extname`),rz(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=BR.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){XR(e)&&(e=ZR(e)),nz(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?BR.basename(this.path,this.extname):void 0}set stem(e){nz(e,`stem`),tz(e,`stem`),this.path=BR.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new UN(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function tz(e,t){if(e&&e.includes(BR.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+BR.sep+"`")}function nz(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function rz(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function iz(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var az=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),oz=l(IR(),1),sz={}.hasOwnProperty,cz=new class e extends az{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=RR()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,oz.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(dz(`data`,this.frozen),this.namespace[e]=t,this):sz.call(this.namespace,e)&&this.namespace[e]||void 0:e?(dz(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=mz(e),n=this.parser||this.Parser;return lz(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),lz(`process`,this.parser||this.Parser),uz(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=mz(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);gz(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),lz(`processSync`,this.parser||this.Parser),uz(`processSync`,this.compiler||this.Compiler),this.process(e,r),pz(`processSync`,`process`,t),n;function r(e,r){t=!0,FR(e),n=r}}run(e,t,n){fz(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=mz(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),pz(`runSync`,`run`,n),r;function i(e,t){FR(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=mz(t),r=this.compiler||this.Compiler;return uz(`stringify`,r),fz(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(dz(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,oz.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];LR(o)&&LR(r)&&(r=(0,oz.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function lz(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function uz(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function dz(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function fz(e){if(!LR(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function pz(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function mz(e){return hz(e)?e:new ez(e)}function hz(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function gz(e){return typeof e==`string`||_z(e)}function _z(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var vz=[],yz={allowDangerousHtml:!0},bz=/^(https?|ircs?|mailto|xmpp)$/i,xz=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Sz(e){let t=Cz(e),n=wz(e);return Tz(t.runSync(t.parse(n),n),e)}function Cz(e){let t=e.rehypePlugins||vz,n=e.remarkPlugins||vz,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...yz}:yz;return cz().use(yL).use(n).use(PR,r).use(t)}function wz(e){let t=e.children||``,n=new ez;return typeof t==`string`?n.value=t:``+t,n}function Tz(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Ez;for(let e of xz)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return wR(e,l),XN(e,{Fragment:R.Fragment,components:i,ignoreInvalidStyle:!0,jsx:R.jsx,jsxs:R.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in vP)if(Object.hasOwn(vP,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=vP[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Ez(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||bz.test(e.slice(0,t))?e:``}function Dz(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Oz(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function kz(e,t,n){let r=pR((n||{}).ignore||[]),i=Az(t),a=-1;for(;++a<i.length;)SR(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function Az(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([jz(e[0]),Mz(e[1])])}return t}function jz(e){return typeof e==`string`?new RegExp(Oz(e),`g`):e}function Mz(e){return typeof e==`function`?e:function(){return e}}var Nz=`phrasing`,Pz=[`autolink`,`link`,`image`,`label`];function Fz(){return{transforms:[Uz],enter:{literalAutolink:Lz,literalAutolinkEmail:Rz,literalAutolinkHttp:Rz,literalAutolinkWww:Rz},exit:{literalAutolink:Hz,literalAutolinkEmail:Vz,literalAutolinkHttp:zz,literalAutolinkWww:Bz}}}function Iz(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Nz,notInConstruct:Pz},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Nz,notInConstruct:Pz},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Nz,notInConstruct:Pz}]}}function Lz(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Rz(e){this.config.enter.autolinkProtocol.call(this,e)}function zz(e){this.config.exit.autolinkProtocol.call(this,e)}function Bz(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Vz(e){this.config.exit.autolinkEmail.call(this,e)}function Hz(e){this.exit(e)}function Uz(e){kz(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Wz],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Gz]],{ignore:[`link`,`linkReference`]})}function Wz(e,t,n,r,i){let a=``;if(!Jz(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Kz(n)))return!1;let o=qz(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Gz(e,t,n,r){return!Jz(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Kz(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function qz(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Dz(e,`(`),a=Dz(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Jz(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||WP(n)||UP(n))&&(!t||n!==47)}iB.peek=rB;function Yz(){this.buffer()}function Xz(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Zz(){this.buffer()}function Qz(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function $z(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=NP(this.sliceSerialize(e)).toLowerCase(),n.label=t}function eB(e){this.exit(e)}function tB(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=NP(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nB(e){this.exit(e)}function rB(){return`[`}function iB(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function aB(){return{enter:{gfmFootnoteCallString:Yz,gfmFootnoteCall:Xz,gfmFootnoteDefinitionLabelString:Zz,gfmFootnoteDefinition:Qz},exit:{gfmFootnoteCallString:$z,gfmFootnoteCall:eB,gfmFootnoteDefinitionLabelString:tB,gfmFootnoteDefinition:nB}}}function oB(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:iB},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
135
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?cB:sB))),s(),o}}function sB(e,t,n){return t===0?e:cB(e,t,n)}function cB(e,t,n){return(n?``:` `)+e}var lB=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];mB.peek=hB;function uB(){return{canContainEols:[`delete`],enter:{strikethrough:fB},exit:{strikethrough:pB}}}function dB(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:lB}],handlers:{delete:mB}}}function fB(e){this.enter({type:`delete`,children:[]},e)}function pB(e){this.exit(e)}function mB(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function hB(){return`~`}function gB(e){return e.length}function _B(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||gB,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=vB(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=yB(r[d]);else{let e=yB(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
136
|
+
`)}function vB(e){return e==null?``:String(e)}function yB(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function bB(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),xB);return i(),o}function xB(e,t,n){return`>`+(n?``:` `)+e}function SB(e,t){return CB(e,t.inConstruct,!0)&&!CB(e,t.notInConstruct,!1)}function CB(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function wB(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
137
|
+
`&&SB(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
138
|
+
`}function TB(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function EB(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function DB(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function OB(e,t,n,r){let i=DB(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(EB(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,kB);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(TB(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
139
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
140
|
+
`),a&&(u+=s.move(a+`
|
|
141
|
+
`)),u+=s.move(c),l(),u}function kB(e,t,n){return(n?``:` `)+e}function AB(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function jB(e,t,n,r){let i=AB(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
142
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function MB(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function NB(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function PB(e,t,n){let r=eF(e),i=eF(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}FB.peek=IB;function FB(e,t,n,r){let i=MB(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=PB(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=NB(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=PB(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+NB(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function IB(e,t,n){return n.options.emphasis||`*`}function LB(e,t){let n=!1;return wR(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&bP(e)&&(t.options.setext||n))}function RB(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(LB(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
143
|
+
`,after:`
|
|
144
|
+
`});return r(),t(),o+`
|
|
145
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
146
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
147
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=NB(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}zB.peek=BB;function zB(e){return e.value||``}function BB(){return`<`}VB.peek=HB;function VB(e,t,n,r){let i=AB(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 HB(){return`!`}UB.peek=WB;function UB(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function WB(){return`!`}GB.peek=KB;function GB(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function KB(){return"`"}function qB(e,t){let n=bP(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))}JB.peek=YB;function JB(e,t,n,r){let i=AB(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(qB(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function YB(e,t,n){return qB(e,n)?`<`:`[`}XB.peek=ZB;function XB(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function ZB(){return`[`}function QB(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 $B(e){let t=QB(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 eV(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function tV(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 nV(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?eV(n):QB(n),s=e.ordered?o===`.`?`)`:`.`:$B(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),tV(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 rV(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 iV(e,t,n,r){let i=rV(n),a=n.bulletCurrent||QB(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 aV(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var oV=pR([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function sV(e,t,n,r){return(e.children.some(function(e){return oV(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function cV(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}lV.peek=uV;function lV(e,t,n,r){let i=cV(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=PB(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=NB(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=PB(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+NB(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function uV(e,t,n){return n.options.strong||`*`}function dV(e,t,n,r){return n.safe(e.value,r)}function fV(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 pV(e,t,n){let r=(tV(n)+(n.options.ruleSpaces?` `:``)).repeat(fV(n));return n.options.ruleSpaces?r.slice(0,-1):r}var mV={blockquote:bB,break:wB,code:OB,definition:jB,emphasis:FB,hardBreak:wB,heading:RB,html:zB,image:VB,imageReference:UB,inlineCode:GB,link:JB,linkReference:XB,list:nV,listItem:iV,paragraph:aV,root:sV,strong:lV,text:dV,thematicBreak:pV};function hV(){return{enter:{table:gV,tableData:bV,tableHeader:bV,tableRow:vV},exit:{codeText:xV,table:_V,tableData:yV,tableHeader:yV,tableRow:yV}}}function gV(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 _V(e){this.exit(e),this.data.inTable=void 0}function vV(e){this.enter({type:`tableRow`,children:[]},e)}function yV(e){this.exit(e)}function bV(e){this.enter({type:`tableCell`,children:[]},e)}function xV(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,SV));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function SV(e,t){return t===`|`?t:e}function CV(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
148
|
+
`,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(`
|
|
149
|
+
`))}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 _B(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=mV.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function wV(){return{exit:{taskListCheckValueChecked:EV,taskListCheckValueUnchecked:EV,paragraph:DV}}}function TV(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:OV}}}function EV(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function DV(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 OV(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=mV.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 kV(){return[Fz(),aB(),uB(),hV(),wV()]}function AV(e){return{extensions:[Iz(),oB(e),dB(),CV(e),TV()]}}var jV={tokenize:GV,partial:!0},MV={tokenize:KV,partial:!0},NV={tokenize:qV,partial:!0},PV={tokenize:JV,partial:!0},FV={tokenize:YV,partial:!0},IV={name:`wwwAutolink`,tokenize:UV,previous:XV},LV={name:`protocolAutolink`,tokenize:WV,previous:ZV},RV={name:`emailAutolink`,tokenize:HV,previous:QV},zV={};function BV(){return{text:zV}}for(var VV=48;VV<123;)zV[VV]=RV,VV++,VV===58?VV=65:VV===91&&(VV=97);zV[43]=RV,zV[45]=RV,zV[46]=RV,zV[95]=RV,zV[72]=[RV,LV],zV[104]=[RV,LV],zV[87]=[RV,IV],zV[119]=[RV,IV];function HV(e,t,n){let r=this,i,a;return o;function o(t){return!$V(t)||!QV.call(r,r.previous)||eH(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return $V(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(FV,u,l)(t):t===45||t===95||FP(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&&PP(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function UV(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!XV.call(r,r.previous)||eH(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(jV,e.attempt(MV,e.attempt(NV,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function WV(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&ZV.call(r,r.previous)&&!eH(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(PP(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||LP(t)||VP(t)||WP(t)||UP(t)?n(t):e.attempt(MV,e.attempt(NV,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function GV(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 KV(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(PV,c,s)(t):t===null||VP(t)||WP(t)||t!==45&&UP(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 qV(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(PV,t,a)(o):o===null||VP(o)||WP(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function JV(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||VP(o)||WP(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||VP(e)||WP(e)?t(e):r(e)}function a(e){return PP(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):PP(t)?(e.consume(t),o):n(t)}}function YV(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return FP(e)?n(e):t(e)}}function XV(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||VP(e)}function ZV(e){return!PP(e)}function QV(e){return!(e===47||$V(e))}function $V(e){return e===43||e===45||e===46||e===95||FP(e)}function eH(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 tH={tokenize:lH,partial:!0};function nH(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:oH,continuation:{tokenize:sH},exit:cH}},text:{91:{name:`gfmFootnoteCall`,tokenize:aH},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:rH,resolveTo:iH}}}}function rH(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=NP(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 iH(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 aH(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||VP(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(NP(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return VP(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 oH(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||VP(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=NP(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return VP(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),qP(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function sH(e,t,n){return e.check(cF,t,e.attempt(tH,t,n))}function cH(e){e.exit(`gfmFootnoteDefinition`)}function lH(e,t,n){let r=this;return qP(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 uH(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&&EP(o,o.length,0,tF(s,e.slice(r+1,n),t)),EP(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),EP(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=eF(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=eF(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var dH=class{constructor(){this.map=[]}add(e,t,n){fH(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function fH(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function pH(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 mH(){return{flow:{null:{name:`table`,tokenize:hH,resolveAll:gH}}}}function hH(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):X(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):HP(t)?qP(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||VP(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,HP(t)?qP(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 HP(t)?qP(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||X(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 HP(t)?qP(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||X(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||X(n)?(e.exit(`tableRow`),t(n)):HP(n)?qP(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||VP(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 gH(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 dH;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(vH(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=_H(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=_H(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=_H(f,t,o,i,n,d)):(o[0]=o[1],d=_H(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&vH(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=pH(t.events,n))}return e}function _H(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},yH(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=yH(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=yH(t.events,n[2]),a=yH(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({},yH(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function vH(e,t,n,r,i){let a=[],o=yH(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 yH(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var bH={name:`tasklistCheck`,tokenize:SH};function xH(){return{text:{91:bH}}}function SH(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 VP(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 X(r)?t(r):HP(r)?e.check({tokenize:CH},t,n)(r):n(r)}}function CH(e,t,n){return qP(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function wH(e){return kP([BV(),nH(),uH(e),mH(),xH()])}var TH={};function EH(e){let t=this,n=e||TH,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(wH(n)),a.push(kV()),o.push(AV(n))}var DH={root:`font-sans text-sm whitespace-normal text-text-2 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,h1:`mt-3 mb-1.5 text-base leading-tight font-semibold tracking-[-0.01em] text-text`,h2:`mt-3 mb-1.5 text-sm leading-tight font-semibold text-text`,h3:`mt-3 mb-1.5 text-sm leading-tight font-semibold text-text-2`,p:`mb-2`,list:`mb-2 pl-4`,taskList:`mb-2 list-none pl-0.5`,li:`mb-0.5 marker:text-text-4`,checkbox:`mr-1.5 align-[-1px] accent-accent`,strong:`font-semibold text-text`,em:`text-text-2`,a:`border-b border-accent-line text-accent-hi no-underline`,code:`rounded-[3px] border border-hairline-soft bg-panel-inset px-1 py-px font-mono text-xs text-accent-hi`,pre:`mb-2 overflow-x-auto rounded-sm border border-hairline-soft bg-panel-inset px-2.5 py-2 [&>code]:border-0 [&>code]:bg-transparent [&>code]:p-0 [&>code]:text-text-2`,blockquote:`mb-2 border-l-2 border-accent-line pl-2.5 text-text-3`,table:`mb-2 w-full border-collapse text-xs`,th:`border border-hairline bg-panel px-1.5 py-1 text-left font-semibold text-text-2`,td:`border border-hairline px-1.5 py-1 text-left`,hr:`my-2.5 border-0 border-t border-hairline`},OH=`contains-task-list`,kH={h1:({node:e,...t})=>(0,R.jsx)(`h1`,{className:DH.h1,...t}),h2:({node:e,...t})=>(0,R.jsx)(`h2`,{className:DH.h2,...t}),h3:({node:e,...t})=>(0,R.jsx)(`h3`,{className:DH.h3,...t}),p:({node:e,...t})=>(0,R.jsx)(`p`,{className:DH.p,...t}),ul:({node:e,className:t,...n})=>(0,R.jsx)(`ul`,{className:t?.includes(OH)?DH.taskList:DH.list,...n}),ol:({node:e,className:t,...n})=>(0,R.jsx)(`ol`,{className:t?.includes(OH)?DH.taskList:DH.list,...n}),li:({node:e,...t})=>(0,R.jsx)(`li`,{className:DH.li,...t}),input:({node:e,...t})=>(0,R.jsx)(`input`,{className:DH.checkbox,...t}),strong:({node:e,...t})=>(0,R.jsx)(`strong`,{className:DH.strong,...t}),em:({node:e,...t})=>(0,R.jsx)(`em`,{className:DH.em,...t}),a:({node:e,...t})=>(0,R.jsx)(`a`,{className:DH.a,...t}),code:({node:e,className:t,...n})=>(0,R.jsx)(`code`,{className:DH.code,...n}),pre:({node:e,...t})=>(0,R.jsx)(`pre`,{className:DH.pre,...t}),blockquote:({node:e,...t})=>(0,R.jsx)(`blockquote`,{className:DH.blockquote,...t}),table:({node:e,...t})=>(0,R.jsx)(`table`,{className:DH.table,...t}),th:({node:e,...t})=>(0,R.jsx)(`th`,{className:DH.th,...t}),td:({node:e,...t})=>(0,R.jsx)(`td`,{className:DH.td,...t}),hr:({node:e,...t})=>(0,R.jsx)(`hr`,{className:DH.hr,...t})};function AH({source:e,className:t}){return(0,R.jsx)(`div`,{className:t?`${DH.root} ${t}`:DH.root,children:(0,R.jsx)(Sz,{remarkPlugins:[EH],components:kH,children:e})})}function jH({featureId:e,relPath:t,title:n,onClose:r,returnFocusRef:i}){let a=B.docs.read.useQuery({featureId:e,relPath:t});return(0,R.jsxs)(RO,{open:!0,onClose:r,label:n,size:`lg`,returnFocusRef:i,backdropClassName:`animate-backdrop-in backdrop-blur-[2px]`,className:`flex max-h-[82vh] animate-overlay-in flex-col overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-hairline px-3.5 py-2.5`,children:[(0,R.jsx)(`span`,{className:`font-mono text-sm text-text-2`,children:t}),(0,R.jsx)(`button`,{className:`${AO} cursor-pointer text-sm text-text-3 hover:text-text`,onClick:r,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,R.jsxs)(`div`,{className:`overflow-auto px-4.5 py-3.5`,children:[a.isLoading&&(0,R.jsxs)(NO,{children:[`loading `,n,`…`]}),a.error&&(0,R.jsxs)(NO,{children:[`could not read `,t,`: `,a.error.message]}),a.data&&(0,R.jsx)(AH,{source:r_(a.data.content)})]})]})}function MH(e){return e.split(/[\\/]/).pop()??e}function NH({featureId:e,docs:t}){let[n,r]=(0,L.useState)(null),i=(0,L.useRef)(null);return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`div`,{className:`text-xs font-semibold tracking-[0.09em] text-text-3 uppercase`,children:`Knowledge`}),t.length===0?(0,R.jsx)(`div`,{className:`text-sm leading-relaxed text-pretty text-text-3`,children:`Docs the sessions write — decisions, the spec, the map — collect here.`}):(0,R.jsx)(`ul`,{className:`m-0 list-none p-0`,children:t.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{className:`flex w-full cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent px-2 py-2 text-left font-sans text-sm hover:bg-panel-3`,onClick:t=>{i.current=t.currentTarget,r({relPath:e.relPath,title:e.title})},children:[(0,R.jsx)(`span`,{className:`flex shrink-0 items-center text-text-4`,children:(0,R.jsx)(Xh,{size:13})}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-text`,children:e.title}),(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-text-3`,children:MH(e.relPath)})]})},e.relPath))}),n&&(0,R.jsx)(jH,{featureId:e,relPath:n.relPath,title:n.title,returnFocusRef:i,onClose:()=>r(null)})]})}var PH=`flex min-h-0 flex-col overflow-hidden border-l border-hairline bg-panel-2`;function FH({featureId:e}){let[t,n]=(0,L.useState)(`details`),r=B.feature.get.useQuery({id:e},{refetchInterval:$m()}),i=yM(e);return r.isLoading?(0,R.jsx)(`aside`,{className:PH,children:(0,R.jsx)(NO,{children:`loading…`})}):r.data?(0,R.jsxs)(`aside`,{className:PH,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 px-4 pt-3`,role:`tablist`,children:[(0,R.jsx)(IH,{label:`Details`,tab:`details`,active:t,onSelect:n}),(0,R.jsx)(IH,{label:`Activity`,tab:`activity`,active:t,onSelect:n})]}),(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 animate-[fadeUp_var(--dur-2)_var(--ease-out-app)] flex-col gap-6 overflow-y-auto px-4 py-5`,children:t===`details`?(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(NH,{featureId:e,docs:r.data.docs})}):(0,R.jsx)(zM,{events:i})},t)]}):(0,R.jsx)(`aside`,{className:PH,children:(0,R.jsx)(NO,{children:r.error?.message??`could not load inspector`})})}function IH({label:e,tab:t,active:n,onSelect:r}){let i=t===n;return(0,R.jsx)(`button`,{role:`tab`,"aria-selected":i,className:`cursor-pointer border-0 border-b-2 bg-transparent px-3 py-1.5 font-sans text-sm font-medium ${i?`border-b-accent text-text`:`border-b-transparent text-text-3 hover:text-text-2`}`,onClick:()=>r(t),children:e})}function LH(e){return e.permission===`denied`?{state:`blocked`,label:`notify blocked`,title:`Your browser has blocked notifications for runcastle. Allow them in site settings (the icon beside the address bar), then click again.`}:e.enabled?{state:`on`,label:`notify on`,title:`Desktop notifications on — click to turn them off`}:{state:`off`,label:`notify off`,title:ov}}function RH(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.status!=`string`||typeof t.summary!=`string`||t.status!==`succeeded`&&t.status!==`failed`&&t.status!==`cancelled`?null:{status:t.status,summary:t.summary}}function zH(e){let t=e.split(`
|
|
150
|
+
`)[0].trim();return t.length>140?`${t.slice(0,139)}…`:t}function BH(e,t){if(e.type!==`run.finished`)return null;let n=RH(e.data);if(!n)return null;let r=t??`your feature`;return n.status===`succeeded`?{title:`Burn complete — review is ready`,body:r}:n.status===`failed`?{title:`Burn failed`,body:`${r}: ${zH(n.summary)}`}:null}var VH=`runcastle:notifications`,HH=typeof Notification<`u`;function UH(){try{return localStorage.getItem(VH)===`on`}catch{return!1}}function WH(e){try{localStorage.setItem(VH,e?`on`:`off`)}catch{}}function GH({title:e,body:t}){try{let n=new Notification(e,{body:t});n.onclick=()=>{window.focus(),n.close()}}catch{}}function KH(e,t){let[n,r]=(0,L.useState)(()=>HH&&UH()),[i,a]=(0,L.useState)(()=>HH?Notification.permission:`default`),[o,s]=(0,L.useState)(void 0),c=(0,L.useRef)(!1),l=(0,L.useRef)(new Map);l.current=new Map(t.map(e=>[e.id,e.title]));let u=B.events.listByProject.useQuery({projectId:e,afterId:o},{refetchInterval:$m(),enabled:HH&&n});return(0,L.useEffect)(()=>{let e=u.data;if(!e||e.length===0)return;let t=e[e.length-1].id,n=document.hidden||!document.hasFocus();if(c.current&&Notification.permission===`granted`&&n)for(let t of e){let e=BH(t,t.featureId?l.current.get(t.featureId):void 0);e&&GH(e)}c.current=!0,s(t)},[u.data]),{supported:HH,enabled:n,permission:i,toggle:(0,L.useCallback)(()=>{if(HH){if(Notification.permission===`denied`){a(`denied`);return}if(n){r(!1),WH(!1);return}c.current=!1,s(void 0),r(!0),WH(!0),Notification.permission==="default"&&Notification.requestPermission().then(e=>{a(e),e!==`granted`&&(r(!1),WH(!1))})}},[n])}}var qH=`docker`;function JH(){return typeof window>`u`?`this machine`:window.location.origin}var YH=`inline-flex shrink-0 items-center gap-1.5`,XH=`${YH} cursor-pointer rounded-sm border-0 bg-transparent p-0 text-xs`,ZH={on:`text-ok`,off:`text-text-3 group-hover:text-text`,blocked:`text-warn`};function QH(e){return(0,R.jsx)(eU,{...$H(e)})}function $H({projectId:e,view:t,activeFeatureId:n,driving:r,onDriveChange:i}){let a=qy(),o=B.useUtils(),s=Xm(),c=B.feature.list.useQuery({projectId:e},{refetchInterval:$m()}),l=!c.isError&&c.data!==void 0,u=t===`feature`?c.data?.find(e=>e.id===n):void 0,d=KH(e,c.data??[]),f=LH(d),p=B.feature.testDrive.useMutation({onSuccess:()=>{i(null),r&&o.feature.get.invalidate({id:r.featureId}),o.feature.list.invalidate()},onError:e=>a.push(e.message)}),m=u?.branch??null;return{branch:m,onCopyBranch:()=>{m&&navigator.clipboard.writeText(m).then(()=>a.push(`copied ${m}`,`info`),()=>a.push(`copy failed`))},driving:r,onStopDrive:()=>{r&&p.mutate({featureId:r.featureId,action:`stop`})},stopPending:p.isPending,notify:d.supported?{...f,onToggle:d.toggle}:null,live:s,healthy:l,origin:JH()}}function eU({branch:e,onCopyBranch:t,driving:n,onStopDrive:r,stopPending:i,notify:a,live:o,healthy:s,origin:c}){return(0,R.jsxs)(`footer`,{className:`flex items-center gap-4 border-t border-hairline bg-panel px-3 text-xs text-text-3`,children:[e&&(0,R.jsxs)(`button`,{className:`group ${XH} font-mono`,onClick:t,title:`Copy branch name`,children:[(0,R.jsx)(Lh,{size:11}),(0,R.jsx)(`span`,{className:`group-hover:text-text`,children:e})]}),(0,R.jsxs)(`span`,{className:YH,title:`Agent sessions run sandboxed via ${qH}`,children:[(0,R.jsx)(rg,{size:11}),qH]}),n&&(0,R.jsxs)(`span`,{className:`${YH} gap-2 text-drive`,children:[(0,R.jsx)(`span`,{className:`size-1.5 animate-[pulse_1.4s_ease-in-out_infinite] rounded-full bg-drive`}),`driving `,(0,R.jsx)(`span`,{className:`font-mono`,children:n.branch}),(0,R.jsx)(`button`,{className:`h-4 cursor-pointer rounded-[4px] border border-drive/40 bg-transparent px-1.5 text-xs disabled:cursor-default`,disabled:i,onClick:r,children:(0,R.jsx)(`span`,{className:`text-drive`,children:`stop`})})]}),(0,R.jsx)(`span`,{className:`flex-1`}),a&&(0,R.jsx)(`button`,{className:`group ${XH}`,onClick:a.onToggle,title:a.title,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 ${ZH[a.state]}`,children:[a.state===`on`?(0,R.jsx)(Rh,{size:12}):(0,R.jsx)(zh,{size:12}),a.label]})}),(0,R.jsxs)(`span`,{className:`${YH} ${o===`live`?``:`text-warn`}`,title:o===`live`?`Live updates are streaming from the server`:`Live updates paused — reconnecting, and polling meanwhile`,children:[(0,R.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${o===`live`?`bg-ok`:`animate-[pulse_1.4s_ease-in-out_infinite] bg-warn`}`}),o===`live`?`live`:`reconnecting…`]}),(0,R.jsxs)(`span`,{className:YH,title:`runcastle API at ${c}/api`,children:[(0,R.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${s?`bg-ok`:`animate-[pulse_1s_ease-in-out_infinite] bg-danger`}`}),`server `,s?`ok`:`down`]})]})}function tU(e,t){let n=B.useUtils(),r=qy(),i=e=>r.push(e.message),a=()=>{n.feature.get.invalidate({id:e}),n.feature.list.invalidate(),n.events.invalidate()},o=B.feature.endSession.useMutation({onError:i}),s=B.feature.launchSession.useMutation({onSuccess:a,onError:i});return{pending:o.isPending||s.isPending,resolve:async(n,r)=>{if(r){try{await o.mutateAsync({sessionId:r})}catch{return}a()}s.mutate({featureId:e,kind:`chat`,kickoffLine:Dg(n.base,t,n.files),purpose:`resolve-conflict`,purposeData:{mergeFrom:n.base,mergeInto:t}})}}}function nU(e){let[t,n]=(0,L.useState)(null),r=(0,L.useRef)(null),i=e?.id,a=e?.status;return(0,L.useEffect)(()=>{if(!i)return;if(a===`running`){r.current=i;return}if(a!==`succeeded`||r.current!==i)return;r.current=null,n(i);let e=setTimeout(()=>n(null),900);return()=>clearTimeout(e)},[i,a]),t===i?t:null}function rU(e,t,{live:n=!0}={}){let r=$m(),i=B.docs.read.useQuery({featureId:e,relPath:t??``},{enabled:!!t,...n?{refetchInterval:r}:{}});return{content:t?i.data?.content:void 0,loading:!!t&&i.isLoading,failed:!!t&&!!i.error}}function iU(e,t){return e.find(e=>e.relPath.split(/[\\/]/).pop()===t)?.relPath}function aU({title:e,branch:t,summary:n,busy:r,warningsPending:i,onConfirm:a,onCancel:o}){return(0,R.jsx)(RO,{open:!0,onClose:o,label:`Burn the tickets on ${t}`,size:`sm`,className:`flex max-h-[82vh] flex-col overflow-hidden`,children:(0,R.jsx)(oU,{title:e,branch:t,summary:n,busy:r,warningsPending:i,onConfirm:a,onCancel:o})})}function oU({title:e,branch:t,summary:n,busy:r,warningsPending:i,onConfirm:a,onCancel:o}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-hairline px-4 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-semibold text-text`,children:`Burn tickets`}),(0,R.jsx)(`button`,{className:`cursor-pointer border-0 bg-transparent p-1 text-base text-text-3 hover:text-text`,onClick:o,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 overflow-y-auto p-4`,children:[(0,R.jsxs)(`p`,{className:`m-0 text-base leading-relaxed text-text-2`,children:[`Burn `,(0,R.jsx)(`strong`,{className:`font-semibold text-text`,children:e}),` on`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:t}),`? Each ticket runs as its own sandboxed agent.`]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(MO,{children:`What burns`}),n.rows.map(e=>(0,R.jsx)(GO,{row:e},e.key))]}),n.warnings.length>0&&(0,R.jsx)(`ul`,{className:`m-0 list-disc rounded-sm border border-warn/40 bg-warn/7 py-2.5 pr-3 pl-6 text-sm leading-relaxed text-warn`,children:n.warnings.map(e=>(0,R.jsx)(`li`,{children:e},e))}),i&&(0,R.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-text-3`,children:`Still checking for warnings…`}),(0,R.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-text-3`,children:n.next}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,R.jsx)(J,{variant:`ghost`,onClick:o,disabled:r,children:`Cancel`}),(0,R.jsx)(J,{variant:`solid`,onClick:a,disabled:r,children:r?`Burning…`:`Burn`})]})]})]})}function sU({title:e,branch:t,base:n,summary:r,busy:i,resolving:a,onConfirm:o,onResolve:s,onCancel:c}){return(0,R.jsx)(RO,{open:!0,onClose:c,label:`Merge and ship ${t}`,size:`sm`,className:`flex max-h-[82vh] flex-col overflow-hidden`,children:(0,R.jsx)(cU,{title:e,branch:t,base:n,summary:r,busy:i,resolving:a,onConfirm:o,onResolve:s,onCancel:c})})}function cU({title:e,branch:t,base:n,summary:r,busy:i,resolving:a,onConfirm:o,onResolve:s,onCancel:c}){let l=!!r.conflictRow&&!!s;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-hairline px-4 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-sm font-semibold text-text`,children:`Merge & ship`}),(0,R.jsx)(`button`,{className:`cursor-pointer border-0 bg-transparent p-1 text-base text-text-3 hover:text-text`,onClick:c,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 overflow-y-auto p-4`,children:[(0,R.jsxs)(`p`,{className:`m-0 text-base leading-relaxed text-text-2`,children:[`Merge `,(0,R.jsx)(`strong`,{className:`font-semibold text-text`,children:e}),` from`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:t}),n?(0,R.jsxs)(R.Fragment,{children:[` `,`into `,(0,R.jsx)(`code`,{className:`font-mono`,children:n})]}):null,`? This ships the feature.`]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(MO,{children:`What lands`}),r.conflictRow&&(0,R.jsx)(`p`,{className:`mt-2 mb-0 rounded-sm border border-danger/45 bg-danger/8 px-3 py-2 text-sm leading-relaxed text-danger`,role:`alert`,children:r.conflictRow}),r.rows.map(e=>(0,R.jsx)(GO,{row:e},e.key))]}),r.warnings.length>0&&(0,R.jsx)(`ul`,{className:`m-0 list-disc rounded-sm border border-warn/40 bg-warn/7 py-2.5 pr-3 pl-6 text-sm leading-relaxed text-warn`,children:r.warnings.map(e=>(0,R.jsx)(`li`,{children:e},e))}),(0,R.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-text-3`,children:r.next}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l&&(0,R.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-text-3`,children:`Nothing here is disabled — if you resolved it by hand, retry lands it.`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,R.jsx)(J,{variant:`ghost`,onClick:c,disabled:i,children:`Cancel`}),l?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(J,{onClick:o,disabled:i,children:i?`Merging…`:`Retry merge anyway`}),(0,R.jsx)(J,{variant:`solid`,onClick:s,disabled:a,children:`Resolve the merge conflict`})]}):(0,R.jsx)(J,{variant:`solid`,onClick:o,disabled:i,children:i?`Merging…`:`Merge & ship`})]})]})]})]})}function lU({url:e,onClose:t}){return(0,R.jsx)(RO,{open:!!e,onClose:t,size:`xl`,label:`the note’s picture`,children:(0,R.jsxs)(`div`,{className:`relative flex flex-col p-2`,children:[(0,R.jsx)(`img`,{src:e??``,alt:`the picture attached to this note`,className:`max-h-[80vh] w-full rounded-md bg-black object-contain`}),(0,R.jsx)(J,{className:`absolute top-4 right-4 w-9 px-0`,"aria-label":`close`,onClick:t,children:`✕`})]})})}var uU=`#F85149`;function dU(e,t,n=1){e.lineWidth=6*n,e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=uU;for(let r of t){let[t,...i]=r.points;if(!t)continue;let a=r.points.at(-1)??t;if(e.beginPath(),r.tool===`rect`){let n={x:Math.min(t.x,a.x),y:Math.min(t.y,a.y),width:Math.abs(a.x-t.x),height:Math.abs(a.y-t.y)};e.rect(n.x,n.y,n.width,n.height)}else{e.moveTo(t.x,t.y),i.length===0&&e.lineTo(t.x,t.y);for(let t of i)e.lineTo(t.x,t.y);if(r.tool===`arrow`&&i.length>0){let r=Math.atan2(a.y-t.y,a.x-t.x),i=12*n;e.lineTo(a.x-i*Math.cos(r-Math.PI/6),a.y-i*Math.sin(r-Math.PI/6)),e.moveTo(a.x,a.y),e.lineTo(a.x-i*Math.cos(r+Math.PI/6),a.y-i*Math.sin(r+Math.PI/6))}}e.stroke()}}function fU(e,t){return e.videoTimestamp==null?`png-only`:t&&e.reviewTicketId===t.ticketId?`live-seek`:`orphan-label`}function pU(e,t,n=1){let r=e.filter(e=>e.reviewTicketId===t&&e.videoTimestamp!=null).sort((e,t)=>e.videoTimestamp-t.videoTimestamp),i=[];for(let e of r){let t=e.videoTimestamp,r=i.at(-1);r&&t-r.at<=n?r.noteIds.push(e.id):i.push({at:t,noteIds:[e.id]})}return i}function mU(e){if(Number.isFinite(e.duration)&&e.duration>0)return e.duration;let{seekable:t}=e;return t.length>0?t.end(t.length-1):0}function hU(e,t){return t.annotating||!Number.isFinite(e)||t.playable<=0?null:Math.min(Math.max(e,0),t.playable)}function gU(e,t,n){return e.width<=0||e.height<=0?{x:0,y:0}:{x:(n.x-e.left)/e.width*t.width,y:(n.y-e.top)/e.height*t.height}}async function _U(e,t,n,r=1){e.width=t.videoWidth,e.height=t.videoHeight;let i=e.getContext(`2d`);if(!i)throw Error(`this browser offered no 2d canvas to capture the frame with`);return i.drawImage(t,0,0,e.width,e.height),dU(i,n,r),await new Promise((t,n)=>{e.toBlob(e=>{e?t(e):n(Error(`the browser produced no PNG from the annotated frame`))},`image/png`)})}async function vU(e){let t=await e.createNote();try{return await e.uploadScreenshot(t.id),{note:t}}catch(e){return{note:t,uploadError:e instanceof Error?e.message:String(e)}}}function yU(e){return e.kind===`note`?e.note.id:e.finding.id}function bU(e){return e.kind===`note`?e.note.lap:e.finding.lap}function xU(e){return`work-${e}`}function SU({finding:e}){let{head:t,rest:n}=iy(e.detail),r=e.location.trim();return(0,R.jsxs)(`details`,{className:`min-w-0`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer list-none text-sm text-text-3 underline decoration-dotted`,children:t}),(0,R.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1 text-sm leading-relaxed text-text-2`,children:[n&&(0,R.jsx)(`p`,{className:`m-0 text-pretty`,children:n}),r&&(0,R.jsx)(`div`,{className:`font-mono text-xs text-text-3`,children:r}),(0,R.jsx)(`div`,{className:`font-mono text-xs text-text-3`,children:e.citation}),e.reproStep&&(0,R.jsx)(`div`,{className:`font-mono text-xs text-text-3`,children:e.reproStep})]})]})}var CU={carried:`text-text-3`,attested:`text-warn`,verified:`text-ok`},wU=`inline-flex h-5 shrink-0 items-center rounded-pill border border-hairline px-2 font-mono text-xs text-text-3`;function TU({item:e,onStage:t,readonly:n,controls:r,editor:i,highlighted:a=!1,showLap:o=!1,onSeek:s,onOpenImage:c,onViewLane:l}){let u=e.kind===`note`?e.note:void 0,d=e.kind===`defect`?e.finding:void 0,f=u?.status===`promoted`?`→ ${e.kind===`note`&&e.ticket?`#${e.ticket.seq} ${e.ticket.title}`:`quick-fixed into a ticket`}`:u?.status===`carried`?`carried into lap ${u.carriedLap}`:null,p=u?.text??d?.title??``,m=u?.videoTimestamp,h=fU({id:yU(e),videoTimestamp:u?.videoTimestamp??null,reviewTicketId:u?.reviewTicketId??null},t),g=d?Zv(d):null,_=d?Qv(d):null,v=e.kind===`defect`?e.fixTicket:void 0;return(0,R.jsxs)(`div`,{id:xU(yU(e)),className:`flex gap-3 border-t border-hairline-soft py-3 transition-colors duration-(--dur-2) ease-app first:border-t-0 ${a?`bg-accent-soft`:``}`,children:[(0,R.jsx)(fk,{url:u?.screenshotUrl,onOpen:c}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m!==void 0&&(h===`live-seek`?(0,R.jsx)(`button`,{type:`button`,className:`border-0 bg-transparent p-0 font-mono text-xs text-text-3 hover:text-accent`,title:`jump the walkthrough to this moment`,onClick:()=>s?.(m),children:Vd(m)}):(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[Vd(m),` · earlier walkthrough`]})),d&&(0,R.jsx)(ok,{severity:d.severity}),u&&(0,R.jsx)(ik,{author:u.author}),o&&(0,R.jsxs)(`span`,{className:wU,children:[`Lap `,bU(e)]}),(0,R.jsx)(`span`,{className:`flex-1`}),!n&&r]}),i??(0,R.jsx)(`p`,{className:`m-0 text-sm text-pretty whitespace-pre-wrap ${u?.status===`done`?`text-text-3 line-through`:`text-text`}`,children:p}),g&&(0,R.jsx)(`div`,{className:`font-mono text-xs text-warn`,children:g}),f&&(0,R.jsx)(`div`,{className:`font-mono text-xs text-text-3`,children:f}),_&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`div`,{className:`font-mono text-xs ${CU[_.evidence]}`,children:_.text}),_.note&&(0,R.jsx)(`p`,{className:`m-0 text-sm text-pretty text-text-2`,children:_.note})]}),v&&(n||!l?(0,R.jsxs)(`div`,{className:`font-mono text-xs text-ph-implementation`,children:[`fixed in the burn by #`,v.seq]}):(0,R.jsxs)(`button`,{type:`button`,className:`self-start border-0 bg-transparent p-0 font-mono text-xs text-ph-implementation underline decoration-dotted`,onClick:()=>l(v.id),children:[`being fixed in the running burn · lane #`,v.seq]})),d&&(0,R.jsx)(SU,{finding:d})]})]})}var EU={note:`Delete this note and its picture?`,defect:`Dismiss this defect?`};function DU(e){return e.readonly?null:(0,R.jsx)(RO,{open:!0,onClose:e.onClose,size:`xl`,label:`Iterate — what goes where`,children:(0,R.jsx)(OU,{...e})})}function OU({lap:e,notes:t,defects:n,standing:r,openedAt:i,busy:a,sessionLive:o,onCommit:s,onClose:c}){let[l,u]=(0,L.useState)(new Set),[d,f]=(0,L.useState)(new Set),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),_=[...n.map(e=>({kind:`defect`,finding:e})),...t.map(e=>({kind:`note`,note:e}))].filter(e=>!d.has(yU(e))).map(e=>({lap:bU(e),item:e})),v=e=>u(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),y=e=>l.has(yU(e.item)),b=_.filter(y),x=_.filter(e=>e.item.kind===`note`&&!y(e)),S=e+1,C=Zg({quickFix:b.length,carried:x.length,nextLap:S,live:!!o}),w=Xg({quickFix:b.length,carried:x.length,nextLap:S,standing:r}),T=()=>{if(!p)return;let e=yU(p);f(t=>new Set(t).add(e)),u(t=>{let n=new Set(t);return n.delete(e),n}),m(null)},E=e=>s({quickFixIds:b.flatMap(e=>e.item.kind===`note`?[yU(e.item)]:[]),quickFixFindingIds:b.flatMap(e=>e.item.kind===`defect`?[yU(e.item)]:[]),dismissIds:t.filter(e=>d.has(e.id)).map(e=>e.id),dismissFindingIds:n.filter(e=>d.has(e.id)).map(e=>e.id),carry:e});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 p-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 text-lg text-text`,children:`Iterate — what goes where`}),(0,R.jsxs)(`p`,{className:`m-0 text-sm text-pretty text-text-2`,children:[`Tick the rows that are quick fixes — each becomes a ticket on this lap. Everything you leave goes into lap `,S,`’s conversation together.`]})]}),_.length===0?(0,R.jsx)(PO,{compact:!0,title:`Nothing open to triage`,hint:`Lap ${S} starts empty-handed.`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(J,{className:`px-2`,disabled:a,onClick:()=>u(new Set(_.map(e=>yU(e.item)))),children:`Mark all as quick fixes`}),(0,R.jsx)(J,{className:`px-2`,disabled:a,onClick:()=>u(new Set),children:`Clear`})]}),(0,R.jsx)(`div`,{className:`flex max-h-[46vh] flex-col overflow-y-auto`,children:(0,R.jsx)(qO,{groups:Kg(_,e),currentLap:e,meta:e=>`${e.rows.length} open`,children:e=>e.map(e=>(0,R.jsx)(TU,{item:e.item,onStage:null,readonly:!1,highlighted:kU(e.item,i),onOpenImage:g,controls:(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 font-mono text-xs text-text-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`size-3.5 accent-accent`,checked:y(e),disabled:a,onChange:()=>v(yU(e.item))}),`Quick fix`]}),(0,R.jsx)(J,{className:`px-2`,disabled:a,onClick:()=>m(e.item),children:`Dismiss`})]})},yU(e.item)))})})]}),w&&(0,R.jsx)(`div`,{className:`font-mono text-xs text-text-2`,children:w}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,R.jsx)(J,{variant:`ghost`,disabled:a,onClick:c,children:`Cancel`}),C.map(e=>(0,R.jsx)(J,{variant:`solid`,disabled:a,onClick:()=>E(e.carry),children:e.label},e.label))]})]}),(0,R.jsx)(lU,{url:h,onClose:()=>g(null)}),(0,R.jsx)(RO,{open:!!p,onClose:()=>m(null),size:`sm`,label:p?EU[p.kind]:`Dismiss`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(`p`,{className:`m-0 text-base text-text`,children:p?EU[p.kind]:``}),(0,R.jsx)(`p`,{className:`m-0 text-sm text-text-3`,children:`It leaves the list now and goes for good when you commit this step.`})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(J,{onClick:()=>m(null),children:`Keep it`}),(0,R.jsx)(J,{variant:`danger`,onClick:T,children:`Dismiss`})]})]})})]})}function kU(e,t){return(e.kind===`note`?e.note.createdAt:e.finding.createdAt)>t}function AU({full:e}){let{feature:t}=e;return(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-[640px] flex-col gap-6`,children:[(0,R.jsxs)(`div`,{className:`mt-8 flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold tracking-[0.09em] text-text-4`,children:[(0,R.jsx)(`span`,{className:`text-sm leading-none`,"aria-hidden":`true`,children:`◌`}),`PARKED`]}),(0,R.jsx)(`div`,{className:`text-lg font-semibold text-text`,children:t.title}),t.oneLiner&&(0,R.jsx)(`div`,{className:`text-base leading-relaxed text-text-2`,children:t.oneLiner})]}),t.brief?(0,R.jsx)(`div`,{children:(0,R.jsx)(AH,{source:t.brief})}):(0,R.jsx)(`div`,{children:(0,R.jsx)(NO,{children:`No notes.`})})]})}function jU({featureId:e,sessionId:t,onEnded:n}){let r=B.useUtils(),i=qy(),a=B.feature.endSession.useMutation({onSuccess:()=>{e&&(r.feature.get.invalidate({id:e}),r.feature.list.invalidate()),n?.(),i.push(`session ended`,`info`)},onError:e=>i.push(e.message)});return(0,R.jsx)(J,{type:`button`,className:`h-7 px-2 text-xs`,disabled:a.isPending,title:`end this session — recoverable, you can relaunch it`,onClick:()=>a.mutate({sessionId:t}),children:a.isPending?`Ending…`:`End session`})}var MU=class extends L.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[runcastle] boundary caught`,e,t)}render(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error):(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center bg-bg`,children:(0,R.jsxs)(`span`,{className:`font-mono text-sm text-text-3`,children:[this.props.label??`component`,` failed: `,this.state.error.message]})}):this.props.children}},NU=2,PU=1,FU=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(NU,Math.floor(u/e.css.cell.width)),rows:Math.max(PU,Math.floor(l/e.css.cell.height))}}},IU=Object.defineProperty,LU=Object.getOwnPropertyDescriptor,RU=(e,t)=>{for(var n in t)IU(e,n,{get:t[n],enumerable:!0})},zU=(e,t,n,r)=>{for(var i=r>1?void 0:r?LU(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&IU(t,n,i),i},Z=(e,t)=>(n,r)=>t(n,r,e),BU=`Terminal input`,VU={get:()=>BU,set:e=>BU=e},HU=`Too much output to announce, navigate to rows manually to read`,UU={get:()=>HU,set:e=>HU=e};function WU(e){return e.replace(/\r?\n/g,`\r`)}function GU(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function KU(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function qU(e,t,n,r){e.stopPropagation(),e.clipboardData&&JU(e.clipboardData.getData(`text/plain`),t,n,r)}function JU(e,t,n,r){e=WU(e),e=GU(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function YU(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function XU(e,t,n,r,i){YU(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ZU(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function QU(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var $U=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},eW=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},tW=``,nW=` `,rW=class e{constructor(){this.fg=0,this.bg=0,this.extended=new iW}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},iW=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},aW=class e extends rW{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new iW,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ZU(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},oW=`di$target`,sW=`di$dependencies`,cW=new Map;function lW(e){return e[sW]||[]}function uW(e){if(cW.has(e))return cW.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);dW(t,e,r)};return t._id=e,cW.set(e,t),t}function dW(e,t,n){t[oW]===t?t[sW].push({id:e,index:n}):(t[sW]=[{id:e,index:n}],t[oW]=t)}var fW=uW(`BufferService`),pW=uW(`CoreMouseService`),mW=uW(`CoreService`),hW=uW(`CharsetService`),gW=uW(`InstantiationService`),_W=uW(`LogService`),vW=uW(`OptionsService`),yW=uW(`OscLinkService`),bW=uW(`UnicodeService`),xW=uW(`DecorationService`),SW=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new aW,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):CW(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};SW=zU([Z(0,fW),Z(1,vW),Z(2,yW)],SW);function CW(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
151
|
+
|
|
152
|
+
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var wW=uW(`CharSizeService`),TW=uW(`CoreBrowserService`),EW=uW(`MouseService`),DW=uW(`RenderService`),OW=uW(`SelectionService`),kW=uW(`CharacterJoinerService`),AW=uW(`ThemeService`),jW=uW(`LinkProviderService`),MW=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?RW.isErrorNoTelemetry(e)?new RW(e.message+`
|
|
153
|
+
|
|
154
|
+
`+e.stack):Error(e.message+`
|
|
155
|
+
|
|
156
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function NW(e){FW(e)||MW.onUnexpectedError(e)}var PW=`Canceled`;function FW(e){return e instanceof IW||e instanceof Error&&e.name===PW&&e.message===PW}var IW=class extends Error{constructor(){super(PW),this.name=this.message}};function LW(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var RW=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},zW=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function BW(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var VW=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=BW(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};VW.assertInvariants=!1;function HW(e,t=0){return e[e.length-(1+t)]}var UW;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(UW||={});function WW(e,t){return(n,r)=>t(e(n),e(r))}var GW=(e,t)=>e-t,KW=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||UW.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};KW.empty=new KW(e=>{});function qW(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var JW=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function YW(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var XW;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(XW||={});var ZW=null,QW=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
157
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new JW;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
158
|
+
`),e)}n.sort(WW(e=>e.idx,GW));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
159
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=qW([...i.get(e.slice(0,t).join(`
|
|
160
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
164
|
+
${s.join(`
|
|
165
|
+
`)}
|
|
166
|
+
============================================================
|
|
167
|
+
|
|
168
|
+
`}return n.length>e&&(a+=`
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
... and ${n.length-e} more leaking disposables
|
|
172
|
+
|
|
173
|
+
`),{leaks:n,details:a}}};QW.idx=0;function $W(e){return ZW?.trackDisposable(e),e}function eG(e){ZW?.markAsDisposed(e)}function tG(e,t){ZW?.setParent(e,t)}function nG(e){return ZW?.markAsSingleton(e),e}function rG(e){if(XW.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function iG(...e){return aG(()=>rG(e))}function aG(e){let t=$W({dispose:YW(()=>{eG(t),e()})});return t}var oG=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,$W(this)}dispose(){this._isDisposed||(eG(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{rG(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return tG(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),tG(e,null))}};oG.DISABLE_DISPOSED_WARNING=!1;var sG=oG,cG=class{constructor(){this._store=new sG,$W(this),tG(this._store,this)}dispose(){eG(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};cG.None=Object.freeze({dispose(){}});var lG=class{constructor(){this._isDisposed=!1,$W(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&tG(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,eG(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&tG(e,null),e}},uG=typeof window==`object`?window:globalThis,dG=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};dG.Undefined=new dG(void 0);var fG=dG,pG=class{constructor(){this._first=fG.Undefined,this._last=fG.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===fG.Undefined}clear(){let e=this._first;for(;e!==fG.Undefined;){let t=e.next;e.prev=fG.Undefined,e.next=fG.Undefined,e=t}this._first=fG.Undefined,this._last=fG.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new fG(e);if(this._first===fG.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==fG.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==fG.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==fG.Undefined&&e.next!==fG.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===fG.Undefined&&e.next===fG.Undefined?(this._first=fG.Undefined,this._last=fG.Undefined):e.next===fG.Undefined?(this._last=this._last.prev,this._last.next=fG.Undefined):e.prev===fG.Undefined&&(this._first=this._first.next,this._first.prev=fG.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==fG.Undefined;)yield e.element,e=e.next}},mG=globalThis.performance&&typeof globalThis.performance.now==`function`,hG=class e{static create(t){return new e(t)}constructor(e){this._now=mG&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},gG;(e=>{e.None=()=>cG.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(iG(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new Q({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new Q({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Q({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new Q;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Q(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof sG?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(gG||={});var _G=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new hG,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};_G.all=new Set,_G._idPool=0;var vG=_G,yG=-1,bG=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new CG(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};bG._idPool=1;var xG=bG,SG=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
174
|
+
`).slice(2).join(`
|
|
175
|
+
`))}},CG=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},wG=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},TG=0,EG=class{constructor(e){this.value=e,this.id=TG++}},DG=2,OG,Q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=yG>0||this._options?.leakWarningThreshold?new xG(e?.onListenerError??NW,this._options?.leakWarningThreshold??yG):void 0,this._perfMon=this._options?._profName?new vG(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new wG(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||NW)(n),cG.None}if(this._disposed)return cG.None;t&&(e=e.bind(t));let r=new EG(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=SG.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof EG?(this._deliveryQueue??=new kG,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=aG(()=>{OG?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof sG?n.add(a):Array.isArray(n)&&n.push(a),OG){let e=Error().stack.split(`
|
|
176
|
+
`).slice(2,3).join(`
|
|
177
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);OG.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*DG<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||NW;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof EG)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},kG=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},AG=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};AG.INSTANCE=new AG;var jG=AG;function MG(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}jG.INSTANCE.onDidChangeZoomLevel;function NG(e){return jG.INSTANCE.getZoomFactor(e)}jG.INSTANCE.onDidChangeFullscreen;var PG=typeof navigator==`object`?navigator.userAgent:``,FG=PG.indexOf(`Firefox`)>=0,IG=PG.indexOf(`AppleWebKit`)>=0,LG=PG.indexOf(`Chrome`)>=0,RG=!LG&&PG.indexOf(`Safari`)>=0;PG.indexOf(`Electron/`),PG.indexOf(`Android`);var zG=!1;if(typeof uG.matchMedia==`function`){let e=uG.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=uG.matchMedia(`(display-mode: fullscreen)`);zG=e.matches,MG(uG,e,({matches:e})=>{zG&&t.matches||(zG=e)})}function BG(){return zG}var VG=`en`,HG=!1,UG=!1,WG=!1,GG=!1,KG=!1,qG=VG,JG,YG=globalThis,XG;typeof YG.vscode<`u`&&typeof YG.vscode.process<`u`?XG=YG.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(XG=process);var ZG=typeof XG?.versions?.electron==`string`&&XG?.type===`renderer`;if(typeof XG==`object`){HG=XG.platform===`win32`,UG=XG.platform===`darwin`,WG=XG.platform===`linux`,WG&&XG.env.SNAP&&XG.env.SNAP_REVISION,XG.env.CI||XG.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qG=VG;let e=XG.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,qG=t.resolvedLanguage||VG,t.languagePack?.translationsConfigFile}catch{}GG=!0}else typeof navigator==`object`&&!ZG?(JG=navigator.userAgent,HG=JG.indexOf(`Windows`)>=0,UG=JG.indexOf(`Macintosh`)>=0,(JG.indexOf(`Macintosh`)>=0||JG.indexOf(`iPad`)>=0||JG.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,WG=JG.indexOf(`Linux`)>=0,JG?.indexOf(`Mobi`),KG=!0,qG=globalThis._VSCODE_NLS_LANGUAGE||VG,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var QG=HG,$G=UG,eK=WG,tK=GG;KG&&typeof YG.importScripts==`function`&&YG.origin;var nK=JG,rK=qG,iK;(e=>{function t(){return rK}e.value=t;function n(){return rK.length===2?rK===`en`:rK.length>=3&&rK[0]===`e`&&rK[1]===`n`&&rK[2]===`-`}e.isDefaultVariant=n;function r(){return rK===`en`}e.isDefault=r})(iK||={});var aK=typeof YG.postMessage==`function`&&!YG.importScripts;(()=>{if(aK){let e=[];YG.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),YG.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var oK=!!(nK&&nK.indexOf(`Chrome`)>=0);nK&&nK.indexOf(`Firefox`),!oK&&nK&&nK.indexOf(`Safari`),nK&&nK.indexOf(`Edg/`),nK&&nK.indexOf(`Android`);var sK=typeof navigator==`object`?navigator:{};tK||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||sK&&sK.clipboard&&sK.clipboard.writeText,tK||sK&&sK.clipboard&&sK.clipboard.readText,tK||BG()||sK.keyboard,`ontouchstart`in uG||sK.maxTouchPoints,uG.PointerEvent&&(`ontouchstart`in uG||navigator.maxTouchPoints);var cK=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},lK=new cK,uK=new cK,dK=new cK,fK=Array(230),pK;(e=>{function t(e){return lK.keyCodeToStr(e)}e.toString=t;function n(e){return lK.strToKeyCode(e)}e.fromString=n;function r(e){return uK.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return dK.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return uK.strToKeyCode(e)||dK.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return lK.keyCodeToStr(e)}e.toElectronAccelerator=o})(pK||={});var mK=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new hK([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},hK=class{constructor(e){if(e.length===0)throw LW(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function gK(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return pK.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(FG)switch(t){case 59:return 85;case 60:if(eK)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if($G)return 57;break}else if(IG&&($G&&t===93||!$G&&t===92))return 57;return fK[t]||0}var _K=$G?256:2048,vK=512,yK=1024,bK=$G?2048:256,xK=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=gK(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=_K),this.altKey&&(t|=vK),this.shiftKey&&(t|=yK),this.metaKey&&(t|=bK),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new mK(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},SK=new WeakMap;function CK(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var wK=class{static getSameOriginWindowChain(e){let t=SK.get(e);if(!t){t=[],SK.set(e,t);let n=e,r;do r=CK(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},TK=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=wK.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},EK=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(LG){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?FG&&!$G?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)RG&&QG?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?FG&&!$G?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},DK=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),OK;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof kK?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:gG.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:DK})})(OK||={});var kK=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?DK:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},AK=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new zW(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new zW(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},jK=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new zW(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=aG(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var MK;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(MK||={});var NK=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await gG.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};NK.EMPTY=NK.fromArray([]);function PK(e){return 55296<=e&&e<=56319}function FK(e){return 56320<=e&&e<=57343}function IK(e,t){return(e-55296<<10)+(t-56320)+65536}function LK(e){return RK(e,0)}function RK(e,t){switch(typeof e){case`object`:return e===null?zK(349,t):Array.isArray(e)?HK(e,t):UK(e,t);case`string`:return VK(e,t);case`boolean`:return BK(e,t);case`number`:return zK(e,t);case`undefined`:return zK(937,t);default:return zK(617,t)}}function zK(e,t){return(t<<5)-t+e|0}function BK(e,t){return zK(e?433:863,t)}function VK(e,t){t=zK(149417,t);for(let n=0,r=e.length;n<r;n++)t=zK(e.charCodeAt(n),t);return t}function HK(e,t){return t=zK(104579,t),e.reduce((e,t)=>RK(t,e),t)}function UK(e,t){return t=zK(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=VK(n,t),RK(e[n],t)),t)}function WK(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function GK(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function KK(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function qK(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):KK((e>>>0).toString(16),t/4)}var JK=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(PK(a))if(o+1<t){let t=e.charCodeAt(o+1);FK(t)?(o++,s=IK(a,t)):s=65533}else{i=a;break}else FK(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),qK(this._h0)+qK(this._h1)+qK(this._h2)+qK(this._h3)+qK(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,GK(this._buff,this._buffLen),this._buffLen>56&&(this._step(),GK(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,WK(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=WK(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=WK(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};JK._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:YK,getWindow:XK,getDocument:ZK,getWindows:QK,getWindowsCount:$K,getWindowId:eq,getWindowById:tq,hasWindow:nq,onDidRegisterWindow:rq,onWillUnregisterWindow:iq,onDidUnregisterWindow:aq}=function(){let e=new Map,t={window:uG,disposables:new sG};e.set(uG.vscodeWindowId,t);let n=new Q,r=new Q,i=new Q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return cG.None;let a=new sG,o={window:t,disposables:a.add(new sG)};return e.set(t.vscodeWindowId,o),a.add(aG(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(sq(t,gq.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:uG},getDocument(e){return XK(e).document}}}(),oq=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function sq(e,t,n,r){return new oq(e,t,n,r)}function cq(e,t){return function(n){return t(new TK(e,n))}}function lq(e){return function(t){return e(new xK(t))}}var uq=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=cq(XK(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=lq(n)),sq(e,t,i,r)},dq,fq=class extends jK{constructor(e){super(),this.defaultTarget=e&&XK(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},pq=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){NW(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(pq.sort),a.shift().execute();r.set(i,!1)};dq=(t,r,a=0)=>{let o=eq(t),s=new pq(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var mq=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};mq.None=new mq(0,0);function hq(e){let t=e.getBoundingClientRect(),n=XK(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=LK(n),a=r.get(i);if(a)a.users+=1;else{let o=new Q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(aG(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var gq={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:IG?`webkitAnimationStart`:`animationstart`,ANIMATION_END:IG?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:IG?`webkitAnimationIteration`:`animationiteration`},_q=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function vq(e,t,n,...r){let i=_q.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function yq(e,t,...n){return vq(`http://www.w3.org/1999/xhtml`,e,t,...n)}yq.SVG=function(e,t,...n){return vq(`http://www.w3.org/2000/svg`,e,t,...n)};var bq=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=xq(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=xq(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=xq(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=xq(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=xq(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=xq(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=xq(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=xq(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=xq(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=xq(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=xq(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=xq(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=xq(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=xq(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function xq(e){return typeof e==`number`?`${e}px`:e}function Sq(e){return new bq(e)}var Cq=class{constructor(){this._hooks=new sG,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(aG(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=XK(e)}this._hooks.add(sq(a,gq.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(sq(a,gq.POINTER_UP,e=>this.stopMonitoring(!0)))}};function wq(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var Tq;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Tq||={});var Eq=class e extends cG{constructor(){super(),this.dispatched=!1,this.targets=new pG,this.ignoreTargets=new pG,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(gG.runAndSubscribe(rq,({window:e,disposables:t})=>{t.add(sq(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(sq(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(sq(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:uG,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=nG(new e),aG(e.INSTANCE.targets.push(t))):cG.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=nG(new e),aG(e.INSTANCE.ignoreTargets.push(t))):cG.None}static isTouchDevice(){return`ontouchstart`in uG||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(Tq.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-HW(s.rollingPageX))<30&&Math.abs(s.initialPageY-HW(s.rollingPageY))<30){let e=this.newGestureEvent(Tq.Tap,s.initialTarget);e.pageX=HW(s.rollingPageX),e.pageY=HW(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-HW(s.rollingPageX))<30&&Math.abs(s.initialPageY-HW(s.rollingPageY))<30){let e=this.newGestureEvent(Tq.Contextmenu,s.initialTarget);e.pageX=HW(s.rollingPageX),e.pageY=HW(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=HW(s.rollingPageX),n=HW(s.rollingPageY),i=HW(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(Tq.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===Tq.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Tq.Change||t.type===Tq.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=dq(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(Tq.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(Tq.Change,i.initialTarget);a.translationX=r.pageX-HW(i.rollingPageX),a.translationY=r.pageY-HW(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};Eq.SCROLL_FRICTION=-.005,Eq.HOLD_DELAY=700,Eq.CLEAR_TAP_COUNT_TIME=400,zU([wq],Eq,`isTouchDevice`,1);var Dq=Eq,Oq=class extends cG{onclick(e,t){this._register(sq(e,gq.CLICK,n=>t(new TK(XK(e),n))))}onmousedown(e,t){this._register(sq(e,gq.MOUSE_DOWN,n=>t(new TK(XK(e),n))))}onmouseover(e,t){this._register(sq(e,gq.MOUSE_OVER,n=>t(new TK(XK(e),n))))}onmouseleave(e,t){this._register(sq(e,gq.MOUSE_LEAVE,n=>t(new TK(XK(e),n))))}onkeydown(e,t){this._register(sq(e,gq.KEY_DOWN,e=>t(new xK(e))))}onkeyup(e,t){this._register(sq(e,gq.KEY_UP,e=>t(new xK(e))))}oninput(e,t){this._register(sq(e,gq.INPUT,t))}onblur(e,t){this._register(sq(e,gq.BLUR,t))}onfocus(e,t){this._register(sq(e,gq.FOCUS,t))}onchange(e,t){this._register(sq(e,gq.CHANGE,t))}ignoreGesture(e){return Dq.ignoreTarget(e)}},kq=11,Aq=class extends Oq{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=kq+`px`,this.domNode.style.height=kq+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new Cq),this._register(uq(this.bgDomNode,gq.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(uq(this.domNode,gq.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new fq),this._pointerdownScheduleRepeatTimer=this._register(new AK)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,XK(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},jq=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Mq=class extends cG{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new jq(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Iq(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Iq.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Nq=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Pq(e,t){let n=t-e;return function(t){return e+n*Rq(t)}}function Fq(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Iq=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),Fq(Pq(e,r),Pq(i,t),.33)}return Pq(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new Nq(this.scrollLeft(t),this.scrollTop(t),!1):new Nq(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Lq(e){return e**3}function Rq(e){return 1-Lq(1-e)}var zq=class extends cG{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new AK)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},Bq=140,Vq=class extends Oq{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new zq(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Cq),this._shouldRender=!0,this.domNode=Sq(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(sq(this.domNode.domNode,gq.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Aq(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Sq(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(sq(this.slider.domNode,gq.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=hq(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(QG&&a>Bq){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Hq=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Uq=class extends Vq{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Hq(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Wq=class extends Vq{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Hq(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Gq=500,Kq=50,qq=!0,Jq=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Yq=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(LG){let t=NG(XK(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Jq(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Yq.INSTANCE=new Yq;var Xq=Yq,Zq=class extends Oq{constructor(e,t,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=$q(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Wq(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Uq(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Sq(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Sq(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Sq(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new AK),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=rG(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,$G&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new EK(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=rG(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(sq(this._listenOnDomNode,gq.MOUSE_WHEEL,e=>{this._onMouseWheel(new EK(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Xq.INSTANCE;qq&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!$G&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Kq*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Kq*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(qq&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Gq)}},Qq=class extends Zq{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function $q(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,$G&&(t.className+=` mac`),t}var eJ=class extends cG{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Mq({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>dq(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Qq(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(gG.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(aG(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(aG(()=>this._styleElement.remove())),this._register(gG.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
178
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};eJ=zU([Z(2,fW),Z(3,TW),Z(4,pW),Z(5,AW),Z(6,vW),Z(7,DW)],eJ);var tJ=class extends cG{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(aG(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};tJ=zU([Z(1,fW),Z(2,TW),Z(3,xW),Z(4,DW)],tJ);var nJ=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},rJ={full:0,left:0,center:0,right:0},iJ={full:0,left:0,center:0,right:0},aJ={full:0,left:0,center:0,right:0},oJ=class extends cG{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new nJ,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(aG(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);iJ.full=this._canvas.width,iJ.left=e,iJ.center=t,iJ.right=e,this._refreshDrawHeightConstants(),aJ.full=1,aJ.left=1,aJ.center=1+iJ.left,aJ.right=1+iJ.left+iJ.center}_refreshDrawHeightConstants(){rJ.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);rJ.left=t,rJ.center=t,rJ.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rJ.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rJ.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rJ.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rJ.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(aJ[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-rJ[e.position||`full`]/2),iJ[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+rJ[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};oJ=zU([Z(2,fW),Z(3,xW),Z(4,DW),Z(5,vW),Z(6,AW),Z(7,TW)],oJ);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
179
|
+
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var sJ;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(sJ||={});var cJ;(e=>e.ST=`${$.ESC}\\`)(cJ||={});var lJ=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};lJ=zU([Z(2,fW),Z(3,vW),Z(4,mW),Z(5,DW)],lJ);var uJ=0,dJ=0,fJ=0,pJ=0,mJ={css:`#00000000`,rgba:0},hJ;(e=>{function t(e,t,n,r){return r===void 0?`#${bJ(e)}${bJ(t)}${bJ(n)}`:`#${bJ(e)}${bJ(t)}${bJ(n)}${bJ(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(hJ||={});var gJ;(e=>{function t(e,t){if(pJ=(t.rgba&255)/255,pJ===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return uJ=a+Math.round((n-a)*pJ),dJ=o+Math.round((r-o)*pJ),fJ=s+Math.round((i-s)*pJ),{css:hJ.toCss(uJ,dJ,fJ),rgba:hJ.toRgba(uJ,dJ,fJ)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=yJ.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return hJ.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[uJ,dJ,fJ]=yJ.toChannels(t),{css:hJ.toCss(uJ,dJ,fJ),rgba:t}}e.opaque=i;function a(e,t){return pJ=Math.round(t*255),[uJ,dJ,fJ]=yJ.toChannels(e.rgba),{css:hJ.toCss(uJ,dJ,fJ,pJ),rgba:hJ.toRgba(uJ,dJ,fJ,pJ)}}e.opacity=a;function o(e,t){return pJ=e.rgba&255,a(e,pJ*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(gJ||={});var _J;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return uJ=parseInt(e.slice(1,2).repeat(2),16),dJ=parseInt(e.slice(2,3).repeat(2),16),fJ=parseInt(e.slice(3,4).repeat(2),16),hJ.toColor(uJ,dJ,fJ);case 5:return uJ=parseInt(e.slice(1,2).repeat(2),16),dJ=parseInt(e.slice(2,3).repeat(2),16),fJ=parseInt(e.slice(3,4).repeat(2),16),pJ=parseInt(e.slice(4,5).repeat(2),16),hJ.toColor(uJ,dJ,fJ,pJ);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return uJ=parseInt(r[1]),dJ=parseInt(r[2]),fJ=parseInt(r[3]),pJ=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),hJ.toColor(uJ,dJ,fJ,pJ);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[uJ,dJ,fJ,pJ]=t.getImageData(0,0,1,1).data,pJ!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:hJ.toRgba(uJ,dJ,fJ,pJ),css:e}}e.toColor=r})(_J||={});var vJ;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(vJ||={});var yJ;(e=>{function t(e,t){if(pJ=(t&255)/255,pJ===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return uJ=a+Math.round((n-a)*pJ),dJ=o+Math.round((r-o)*pJ),fJ=s+Math.round((i-s)*pJ),hJ.toRgba(uJ,dJ,fJ)}e.blend=t;function n(e,t,n){let a=vJ.relativeLuminance(e>>8),o=vJ.relativeLuminance(t>>8);if(xJ(a,o)<n){if(o<a){let o=r(e,t,n),s=xJ(a,vJ.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>xJ(a,vJ.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=xJ(a,vJ.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>xJ(a,vJ.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=xJ(vJ.relativeLuminance2(o,s,c),vJ.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=xJ(vJ.relativeLuminance2(o,s,c),vJ.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=xJ(vJ.relativeLuminance2(o,s,c),vJ.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=xJ(vJ.relativeLuminance2(o,s,c),vJ.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(yJ||={});function bJ(e){let t=e.toString(16);return t.length<2?`0`+t:t}function xJ(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var SJ=class extends rW{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},CJ=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new aW}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||nW.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)CJ._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||nW.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};CJ=zU([Z(0,fW)],CJ);function wJ(e){return 57508<=e&&e<=57558}function TJ(e){return 9472<=e&&e<=9631}function EJ(e){return wJ(e)||TJ(e)}function DJ(){return{css:{canvas:OJ(),cell:OJ()},device:{canvas:OJ(),cell:OJ(),char:{width:0,height:0,left:0,top:0}}}}function OJ(){return{width:0,height:0}}var kJ=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new aW,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new SJ(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,ee=O&&k>=l&&k<=u,te=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{te=!0});let ne=N.getChars()||nW;if(ne===` `&&(N.isUnderline()||N.isOverline())&&(ne=`\xA0`),T=m*s-c.get(ne,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&ee===S&&T===C&&!F&&!A&&!te&&j){N.isInvisible()?_+=nW:_+=ne,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=ee,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?nW:N.getChars()||nW,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${rW.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),ee&&(h.style.textDecoration=`underline`);let I=N.getFgColor(),re=N.getFgColorMode(),ie=N.getBgColor(),ae=N.getBgColorMode(),oe=!!N.isInverse();if(oe){let e=I;I=ie,ie=e;let t=re;re=ae,ae=t}let se,ce,le=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&le||(e.backgroundColorRGB&&(ae=50331648,ie=e.backgroundColorRGB.rgba>>8&16777215,se=e.backgroundColorRGB),e.foregroundColorRGB&&(re=50331648,I=e.foregroundColorRGB.rgba>>8&16777215,ce=e.foregroundColorRGB),le=e.options.layer===`top`)}),!le&&P&&(se=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ie=se.rgba>>8&16777215,ae=50331648,le=!0,p.selectionForeground&&(re=50331648,I=p.selectionForeground.rgba>>8&16777215,ce=p.selectionForeground)),le&&D.push(`xterm-decoration-top`);let ue;switch(ae){case 16777216:case 33554432:ue=p.ansi[ie],D.push(`xterm-bg-${ie}`);break;case 50331648:ue=hJ.toColor(ie>>16,ie>>8&255,ie&255),this._addStyle(h,`background-color:#${AJ((ie>>>0).toString(16),`0`,6)}`);break;default:oe?(ue=p.foreground,D.push(`xterm-bg-257`)):ue=p.background}switch(se||N.isDim()&&(se=gJ.multiplyOpacity(ue,.5)),re){case 16777216:case 33554432:N.isBold()&&I<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(I+=8),this._applyMinimumContrast(h,ue,p.ansi[I],N,se,void 0)||D.push(`xterm-fg-${I}`);break;case 50331648:let e=hJ.toColor(I>>16&255,I>>8&255,I&255);this._applyMinimumContrast(h,ue,e,N,se,ce)||this._addStyle(h,`color:#${AJ(I.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ue,p.foreground,N,se,ce)||oe&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!te&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||EJ(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=gJ.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};kJ=zU([Z(1,kW),Z(2,vW),Z(3,TW),Z(4,mW),Z(5,xW),Z(6,AW)],kJ);function AJ(e,t,n){for(;e.length<n;)e=t+e;return e}var jJ=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},MJ=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function NJ(){return new MJ}var PJ=`xterm-dom-renderer-owner-`,FJ=`xterm-rows`,IJ=`xterm-fg-`,LJ=`xterm-bg-`,RJ=`xterm-focus`,zJ=`xterm-selection`,BJ=1,VJ=class extends cG{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=BJ++,this._rowElements=[],this._selectionRenderModel=NJ(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(FJ),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(zJ),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=DJ(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(kJ,document),this._element.classList.add(PJ+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(aG(()=>{this._element.classList.remove(PJ+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new jJ(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${FJ} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${FJ} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${FJ} .xterm-dim { color: ${gJ.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${FJ}.${RJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${FJ}.${RJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${FJ}.${RJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${FJ} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${FJ} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${FJ} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${FJ} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${FJ} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${zJ} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${zJ} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${zJ} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${IJ}${n} { color: ${r.css}; }${this._terminalSelector} .${IJ}${n}.xterm-dim { color: ${gJ.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${LJ}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${IJ}257 { color: ${gJ.opaque(e.background).css}; }${this._terminalSelector} .${IJ}257.xterm-dim { color: ${gJ.multiplyOpacity(gJ.opaque(e.background),.5).css}; }${this._terminalSelector} .${LJ}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(RJ),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(RJ),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${PJ}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};VJ=zU([Z(7,gW),Z(8,wW),Z(9,vW),Z(10,fW),Z(11,mW),Z(12,TW),Z(13,AW)],VJ);var HJ=class extends cG{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new GJ(this._optionsService))}catch{this._measureStrategy=this._register(new WJ(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};HJ=zU([Z(2,vW)],HJ);var UJ=class extends cG{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},WJ=class extends UJ{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},GJ=class extends UJ{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},KJ=class extends cG{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new qJ(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(gG.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(sq(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(sq(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},qJ=class extends cG{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new lG),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(aG(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=sq(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},JJ=class extends cG{constructor(){super(),this.linkProviders=[],this._register(aG(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function YJ(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function XJ(e,t,n,r,i,a,o,s,c){if(!a)return;let l=YJ(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var ZJ=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return XJ(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=YJ(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ZJ=zU([Z(0,DW),Z(1,wW)],ZJ);var QJ=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},$J={};RU($J,{getSafariVersion:()=>oY,isChromeOS:()=>fY,isFirefox:()=>rY,isIpad:()=>cY,isIphone:()=>lY,isLegacyEdge:()=>iY,isLinux:()=>dY,isMac:()=>sY,isNode:()=>eY,isSafari:()=>aY,isWindows:()=>uY});var eY=typeof process<`u`&&`title`in process,tY=eY?`node`:navigator.userAgent,nY=eY?`node`:navigator.platform,rY=tY.includes(`Firefox`),iY=tY.includes(`Edge`),aY=/^((?!chrome|android).)*safari/i.test(tY);function oY(){if(!aY)return 0;let e=tY.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var sY=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(nY),cY=nY===`iPad`,lY=nY===`iPhone`,uY=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(nY),dY=nY.indexOf(`Linux`)>=0,fY=/\bCrOS\b/.test(tY),pY=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},mY=class extends pY{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},hY=class extends pY{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},gY=!eY&&`requestIdleCallback`in window?hY:mY,_Y=class{constructor(){this._queue=new gY}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},vY=class extends cG{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new lG),this._pausedResizeTask=new _Y,this._observerDisposable=this._register(new lG),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new QJ((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new yY(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(aG(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=aG(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};vY=zU([Z(2,vW),Z(3,wW),Z(4,mW),Z(5,xW),Z(6,fW),Z(7,TW),Z(8,AW)],vY);var yY=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function bY(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return CY(i,a,e,t,n,r)+wY(a,t,n,r)+TY(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,MY(Math.abs(i-e),jY(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return MY(SY(a>t?e:i,n)+(s-1)*n.cols+1+xY(a>t?i:e,n),jY(o,r))}function xY(e,t){return e-1}function SY(e,t){return t.cols-e}function CY(e,t,n,r,i,a){return wY(t,r,i,a).length===0?``:MY(AY(e,t,e,t-DY(t,i),!1,i).length,jY(`D`,a))}function wY(e,t,n,r){let i=e-DY(e,n),a=t-DY(t,n);return MY(Math.abs(i-a)-EY(e,t,n),jY(kY(e,t),r))}function TY(e,t,n,r,i,a){let o;o=wY(t,r,i,a).length>0?r-DY(r,i):t;let s=r,c=OY(e,t,n,r,i,a);return MY(AY(e,o,n,s,c===`C`,i).length,jY(c,a))}function EY(e,t,n){let r=0,i=e-DY(e,n),a=t-DY(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=kY(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function DY(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function OY(e,t,n,r,i,a){let o;return o=wY(n,r,i,a).length>0?r-DY(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function kY(e,t){return e>t?`A`:`B`}function AY(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function jY(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function MY(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var NY=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function PY(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var FY=50,IY=15,LY=50,RY=500,zY=RegExp(`\xA0`,`g`),BY=class extends cG{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new aW,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new NY(this._bufferService),this._activeSelectionMode=0,this._register(aG(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(zY,` `)).join(uY?`\r
|
|
180
|
+
`:`
|
|
181
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),dY&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=PY(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=YJ(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-FY),FY),t/=FY,t/Math.abs(t)+Math.round(t*(IY-1)))}shouldForceSelection(e){return sY?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),LY)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(sY&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<RY&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=bY(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=PY(n,this._bufferService.cols)}};BY=zU([Z(3,fW),Z(4,mW),Z(5,EW),Z(6,vW),Z(7,DW),Z(8,TW)],BY);var VY=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},HY=class{constructor(){this._color=new VY,this._css=new VY}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},UY=Object.freeze((()=>{let e=[_J.toColor(`#2e3436`),_J.toColor(`#cc0000`),_J.toColor(`#4e9a06`),_J.toColor(`#c4a000`),_J.toColor(`#3465a4`),_J.toColor(`#75507b`),_J.toColor(`#06989a`),_J.toColor(`#d3d7cf`),_J.toColor(`#555753`),_J.toColor(`#ef2929`),_J.toColor(`#8ae234`),_J.toColor(`#fce94f`),_J.toColor(`#729fcf`),_J.toColor(`#ad7fa8`),_J.toColor(`#34e2e2`),_J.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:hJ.toCss(r,i,a),rgba:hJ.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:hJ.toCss(n,n,n),rgba:hJ.toRgba(n,n,n)})}return e})()),WY=_J.toColor(`#ffffff`),GY=_J.toColor(`#000000`),KY=_J.toColor(`#ffffff`),qY=GY,JY={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},YY=WY,XY=class extends cG{constructor(e){super(),this._optionsService=e,this._contrastCache=new HY,this._halfContrastCache=new HY,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:WY,background:GY,cursor:KY,cursorAccent:qY,selectionForeground:void 0,selectionBackgroundTransparent:JY,selectionBackgroundOpaque:gJ.blend(GY,JY),selectionInactiveBackgroundTransparent:JY,selectionInactiveBackgroundOpaque:gJ.blend(GY,JY),scrollbarSliderBackground:gJ.opacity(WY,.2),scrollbarSliderHoverBackground:gJ.opacity(WY,.4),scrollbarSliderActiveBackground:gJ.opacity(WY,.5),overviewRulerBorder:WY,ansi:UY.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ZY(e.foreground,WY),t.background=ZY(e.background,GY),t.cursor=gJ.blend(t.background,ZY(e.cursor,KY)),t.cursorAccent=gJ.blend(t.background,ZY(e.cursorAccent,qY)),t.selectionBackgroundTransparent=ZY(e.selectionBackground,JY),t.selectionBackgroundOpaque=gJ.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ZY(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=gJ.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ZY(e.selectionForeground,mJ):void 0,t.selectionForeground===mJ&&(t.selectionForeground=void 0),gJ.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=gJ.opacity(t.selectionBackgroundTransparent,.3)),gJ.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=gJ.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ZY(e.scrollbarSliderBackground,gJ.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ZY(e.scrollbarSliderHoverBackground,gJ.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ZY(e.scrollbarSliderActiveBackground,gJ.opacity(t.foreground,.5)),t.overviewRulerBorder=ZY(e.overviewRulerBorder,YY),t.ansi=UY.slice(),t.ansi[0]=ZY(e.black,UY[0]),t.ansi[1]=ZY(e.red,UY[1]),t.ansi[2]=ZY(e.green,UY[2]),t.ansi[3]=ZY(e.yellow,UY[3]),t.ansi[4]=ZY(e.blue,UY[4]),t.ansi[5]=ZY(e.magenta,UY[5]),t.ansi[6]=ZY(e.cyan,UY[6]),t.ansi[7]=ZY(e.white,UY[7]),t.ansi[8]=ZY(e.brightBlack,UY[8]),t.ansi[9]=ZY(e.brightRed,UY[9]),t.ansi[10]=ZY(e.brightGreen,UY[10]),t.ansi[11]=ZY(e.brightYellow,UY[11]),t.ansi[12]=ZY(e.brightBlue,UY[12]),t.ansi[13]=ZY(e.brightMagenta,UY[13]),t.ansi[14]=ZY(e.brightCyan,UY[14]),t.ansi[15]=ZY(e.brightWhite,UY[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=ZY(e.extendedAnsi[r],UY[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};XY=zU([Z(0,vW)],XY);function ZY(e,t){if(e!==void 0)try{return _J.toColor(e)}catch{}return t}var QY=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},$Y=class{constructor(){this._services=new QY,this._services.set(gW,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=lW(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},eX={trace:0,debug:1,info:2,warn:3,error:4,off:5},tX=`xterm.js: `,nX=class extends cG{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),rX=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=eX[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:tX)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};nX=zU([Z(0,vW)],nX);var rX,iX=class extends cG{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},aX=3,oX=Object.freeze(new rW),sX=0,cX=2,lX=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*aX);let r=t||aW.fromCharData([0,tW,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*aX+0],n=t&2097151;return[this._data[e*aX+1],t&2097152?this._combined[e]:n?ZU(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*aX+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*aX+0]=e|2097152|t[2]<<22):this._data[e*aX+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*aX+0]>>22}hasWidth(e){return this._data[e*aX+0]&12582912}getFg(e){return this._data[e*aX+1]}getBg(e){return this._data[e*aX+2]}hasContent(e){return this._data[e*aX+0]&4194303}getCodePoint(e){let t=this._data[e*aX+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*aX+0]&2097152}getString(e){let t=this._data[e*aX+0];return t&2097152?this._combined[e]:t&2097151?ZU(t&2097151):``}isProtected(e){return this._data[e*aX+2]&536870912}loadCell(e,t){return sX=e*aX,t.content=this._data[sX+0],t.fg=this._data[sX+1],t.bg=this._data[sX+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*aX+0]=t.content,this._data[e*aX+1]=t.fg,this._data[e*aX+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*aX+0]=t|n<<22,this._data[e*aX+1]=r.fg,this._data[e*aX+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*aX+0];r&2097152?this._combined[e]+=ZU(t):r&2097151?(this._combined[e]=ZU(r&2097151)+ZU(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*aX+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new aW;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new aW;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*cX<this._data.buffer.byteLength;let n=e*aX;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*cX<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*cX<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*aX+0]&4194303)return e+(this._data[e*aX+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*aX+0]&4194303||this._data[e*aX+2]&50331648)return e+(this._data[e*aX+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<aX;e++)this._data[(n+i)*aX+e]=a[(t+i)*aX+e];a[(t+i)*aX+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<aX;e++)this._data[(n+i)*aX+e]=a[(t+i)*aX+e];a[(t+i)*aX+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*aX+0],n=e&2097151,a=e&2097152?this._combined[t]:n?ZU(n):nW;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function uX(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=mX(u,d,t),p=1,m=0;for(;p<u.length;){let e=mX(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function dX(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function fX(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function pX(e,t,n){let r=[],i=e.map((n,r)=>mX(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=mX(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function mX(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var hX=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),rG(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};hX._nextId=1;var gX=hX,_X={},vX=_X.B;_X[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:``,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},_X.A={"#":`£`},_X.B=void 0,_X[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},_X.C=_X[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},_X.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},_X.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},_X.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},_X.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},_X.E=_X[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},_X.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},_X.H=_X[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},_X[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var yX=4294967295,bX=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=oX.clone(),this.savedCharset=vX,this.markers=[],this._nullCell=aW.fromCharData([0,tW,1,0]),this._whitespaceCell=aW.fromCharData([0,nW,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new gY,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new iX(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new iW),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new iW),this._whitespaceCell}getBlankLine(e,t){return new lX(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>yX?yX:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=oX);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new iX(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(oX),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new lX(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new lX(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=uX(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(oX),n);if(r.length>0){let n=dX(this.lines,r);fX(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(oX),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new lX(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(oX),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=pX(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(oX,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=mX(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new gX(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},xX=class extends cG{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new bX(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new bX(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},SX=2,CX=1,wX=class extends cG{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,SX),this.rows=Math.max(e.rawOptions.rows||0,CX),this.buffers=this._register(new xX(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};wX=zU([Z(0,vW)],wX);var TX={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:sY,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},EX=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],DX=class extends cG{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...TX};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(aG(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in TX))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in TX))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=TX[e],!OX(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=TX[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=EX.includes(t)?t:TX[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function OX(e){return e===`block`||e===`underline`||e===`bar`}function kX(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&kX(e[r],t-1);return n}var AX=Object.freeze({insertMode:!1}),jX=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),MX=class extends cG{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=kX(AX),this.decPrivateModes=kX(jX)}reset(){this.modes=kX(AX),this.decPrivateModes=kX(jX)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};MX=zU([Z(0,fW),Z(1,_W),Z(2,vW)],MX);var NX={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function PX(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var FX=String.fromCharCode,IX={DEFAULT:e=>{let t=[PX(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${FX(t[0])}${FX(t[1])}${FX(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${PX(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${PX(e,!0)};${e.x};${e.y}${t}`}},LX=class extends cG{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(NX))this.addProtocol(e,NX[e]);for(let e of Object.keys(IX))this.addEncoding(e,IX[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};LX=zU([Z(0,fW),Z(1,mW),Z(2,vW)],LX);var RX=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],zX=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],BX;function VX(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var HX=class{constructor(){if(this.version=`6`,!BX){BX=new Uint8Array(65536),BX.fill(1),BX[0]=0,BX.fill(0,1,32),BX.fill(0,127,160),BX.fill(2,4352,4448),BX[9001]=2,BX[9002]=2,BX.fill(2,11904,42192),BX[12351]=1,BX.fill(2,44032,55204),BX.fill(2,63744,64256),BX.fill(2,65040,65050),BX.fill(2,65072,65136),BX.fill(2,65280,65377),BX.fill(2,65504,65511);for(let e=0;e<RX.length;++e)BX.fill(0,RX[e][0],RX[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?BX[e]:VX(e,zX)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=UX.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return UX.createPropertyValue(0,n,r)}},UX=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new HX;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},WX=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function GX(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var KX=2147483647,qX=256,JX=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>qX)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>KX?KX:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>KX?KX:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,KX):e}},YX=[],XX=class{constructor(){this._state=0,this._active=YX,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=YX}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=YX,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||YX,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,QU(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=YX,this._id=-1,this._state=0}}},ZX=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=QU(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},QX=[],$X=class{constructor(){this._handlers=Object.create(null),this._active=QX,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=QX}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=QX,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||QX,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,QU(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=QX,this._ident=0}},eZ=new JX;eZ.addParam(0);var tZ=class{constructor(e){this._handler=e,this._data=``,this._params=eZ,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():eZ,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=QU(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=eZ,this._data=``,this._hitLimit=!1,e));return this._params=eZ,this._data=``,this._hitLimit=!1,t}},nZ=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},rZ=160,iZ=function(){let e=new nZ(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(rZ,0,2,0),e.add(rZ,8,5,8),e.add(rZ,6,0,6),e.add(rZ,11,0,11),e.add(rZ,13,13,13),e}(),aZ=class extends cG{constructor(e=iZ){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new JX,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(aG(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new XX),this._dcsParser=this._register(new $X),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:rZ)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<rZ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<rZ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<rZ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<rZ){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<rZ){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<rZ){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},oZ=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,sZ=/^[\da-f]+$/;function cZ(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=oZ.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),sZ.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function lZ(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function uZ(e,t=16){let[n,r,i]=e;return`rgb:${lZ(n,t)}/${lZ(r,t)}/${lZ(i,t)}`}var dZ={"(":0,")":1,"*":2,"+":3,"-":1,".":2},fZ=131072,pZ=10;function mZ(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var hZ=5e3,gZ=0,_Z=class extends cG{constructor(e,t,n,r,i,a,o,s,c=new aZ){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new $U,this._utf8Decoder=new eW,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=oX.clone(),this._eraseAttrDataInternal=oX.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new vZ(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(sJ.IND,()=>this.index()),this._parser.setExecuteHandler(sJ.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(sJ.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ZX(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new ZX(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new ZX(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new ZX(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new ZX(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new ZX(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new ZX(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new ZX(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new ZX(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new ZX(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new ZX(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new ZX(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in _X)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new tZ((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),hZ))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${hZ} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>fZ&&(a=this._parseStack.position+fZ)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<fZ&&(this._parseBuffer=new Uint32Array(Math.min(e.length,fZ))),o||this._dirtyRowTracker.clearRange(),e.length>fZ)for(let t=a;t<e.length;t+=fZ){let a=t+fZ<e.length?t+fZ:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=UX.extractWidth(t);let n=UX.extractShouldJoin(t),m=n?UX.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(ZU(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof lX&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!mZ(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new tZ(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ZX(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(oX));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=UX.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,vX),this._charsetService.setgCharset(1,vX),this._charsetService.setgCharset(2,vX),this._charsetService.setgCharset(3,vX);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=rW.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=oX.fg,e.bg=oX.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=oX.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=oX.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=oX.fg&16777215,r.bg&=-67108864,r.bg|=oX.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=oX.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!mZ(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>pZ&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>pZ&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(yZ(n))if(r===`?`)t.push({type:0,index:n});else{let e=cZ(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=cZ(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);yZ(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,vX),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(dZ[e[0]],_X[e[1]]||vX),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=oX.clone(),this._eraseAttrDataInternal=oX.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new aW;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},vZ=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(gZ=e,e=t,t=gZ),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};vZ=zU([Z(0,fW)],vZ);function yZ(e){return 0<=e&&e<256}var bZ=5e7,xZ=12,SZ=50,CZ=class extends cG{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>bZ)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=xZ?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=xZ)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>SZ&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},wZ=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};wZ=zU([Z(0,fW)],wZ);var TZ=!1,EZ=class extends cG{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new lG),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new $Y,this.optionsService=this._register(new DX(e)),this._instantiationService.setService(vW,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(wX)),this._instantiationService.setService(fW,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(nX)),this._instantiationService.setService(_W,this._logService),this.coreService=this._register(this._instantiationService.createInstance(MX)),this._instantiationService.setService(mW,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(LX)),this._instantiationService.setService(pW,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(UX)),this._instantiationService.setService(bW,this.unicodeService),this._charsetService=this._instantiationService.createInstance(WX),this._instantiationService.setService(hW,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(wZ),this._instantiationService.setService(yW,this._oscLinkService),this._inputHandler=this._register(new _Z(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(gG.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(gG.forward(this._bufferService.onResize,this._onResize)),this._register(gG.forward(this.coreService.onData,this._onData)),this._register(gG.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new CZ((e,t)=>this._inputHandler.parse(e,t))),this._register(gG.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!TZ&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),TZ=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,SX),t=Math.max(t,CX),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(GX.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(GX(this._bufferService),!1))),this._windowsWrappingHeuristics.value=aG(()=>{for(let t of e)t.dispose()})}}},DZ={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function OZ(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`D`:t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`C`:t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`A`:t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`B`:t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:a?i.key=$.ESC+`[3;`+(a+1)+`~`:i.key=$.ESC+`[3~`;break;case 36:a?i.key=$.ESC+`[1;`+(a+1)+`H`:t?i.key=$.ESC+`OH`:i.key=$.ESC+`[H`;break;case 35:a?i.key=$.ESC+`[1;`+(a+1)+`F`:t?i.key=$.ESC+`OF`:i.key=$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=$.ESC+`[5;`+(a+1)+`~`:i.key=$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=$.ESC+`[6;`+(a+1)+`~`:i.key=$.ESC+`[6~`;break;case 112:a?i.key=$.ESC+`[1;`+(a+1)+`P`:i.key=$.ESC+`OP`;break;case 113:a?i.key=$.ESC+`[1;`+(a+1)+`Q`:i.key=$.ESC+`OQ`;break;case 114:a?i.key=$.ESC+`[1;`+(a+1)+`R`:i.key=$.ESC+`OR`;break;case 115:a?i.key=$.ESC+`[1;`+(a+1)+`S`:i.key=$.ESC+`OS`;break;case 116:a?i.key=$.ESC+`[15;`+(a+1)+`~`:i.key=$.ESC+`[15~`;break;case 117:a?i.key=$.ESC+`[17;`+(a+1)+`~`:i.key=$.ESC+`[17~`;break;case 118:a?i.key=$.ESC+`[18;`+(a+1)+`~`:i.key=$.ESC+`[18~`;break;case 119:a?i.key=$.ESC+`[19;`+(a+1)+`~`:i.key=$.ESC+`[19~`;break;case 120:a?i.key=$.ESC+`[20;`+(a+1)+`~`:i.key=$.ESC+`[20~`;break;case 121:a?i.key=$.ESC+`[21;`+(a+1)+`~`:i.key=$.ESC+`[21~`;break;case 122:a?i.key=$.ESC+`[23;`+(a+1)+`~`:i.key=$.ESC+`[23~`;break;case 123:a?i.key=$.ESC+`[24;`+(a+1)+`~`:i.key=$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=DZ[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL));break}return i}var kZ=0,AZ=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new gY,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new gY,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(kZ=this._search(t),kZ===-1)||this._getKey(this._array[kZ])!==t)return!1;do if(this._array[kZ]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(kZ),!0;while(++kZ<this._array.length&&this._getKey(this._array[kZ])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(kZ=this._search(e),!(kZ<0||kZ>=this._array.length)&&this._getKey(this._array[kZ])===e))do yield this._array[kZ];while(++kZ<this._array.length&&this._getKey(this._array[kZ])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(kZ=this._search(e),!(kZ<0||kZ>=this._array.length)&&this._getKey(this._array[kZ])===e))do t(this._array[kZ]);while(++kZ<this._array.length&&this._getKey(this._array[kZ])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},jZ=0,MZ=0,NZ=class extends cG{constructor(){super(),this._decorations=new AZ(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(aG(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new PZ(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{jZ=t.options.x??0,MZ=jZ+(t.options.width??1),e>=jZ&&e<MZ&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},PZ=class extends sG{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=_J.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=_J.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},FZ=1e3,IZ=class{constructor(e,t=FZ){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},LZ=20,RZ=class extends cG{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new IZ(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
182
|
+
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(sq(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(aG(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<LZ+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
183
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===LZ+1&&(this._liveRegion.textContent+=UU.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};RZ=zU([Z(1,gW),Z(2,TW),Z(3,DW)],RZ);var zZ=class extends cG{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(aG(()=>{rG(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(sq(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(sq(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(sq(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(sq(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&BZ(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,rG(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};zZ=zU([Z(1,EW),Z(2,DW),Z(3,fW),Z(4,jW)],zZ);function BZ(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var VZ=class extends EZ{constructor(e={}){super(e),this._linkifier=this._register(new lG),this.browser=$J,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new lG),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(NZ),this._instantiationService.setService(xW,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(JJ),this._instantiationService.setService(jW,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(SW)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(gG.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(gG.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(gG.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(gG.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(aG(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=gJ.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${uZ(r)}${cJ.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=hJ.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=hJ.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(RZ,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(sq(this.element,`copy`,e=>{this.hasSelection()&&KU(e,this._selectionService)}));let e=e=>qU(e,this.textarea,this.coreService,this.optionsService);this._register(sq(this.textarea,`paste`,e)),this._register(sq(this.element,`paste`,e)),rY?this._register(sq(this.element,`mousedown`,e=>{e.button===2&&XU(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(sq(this.element,`contextmenu`,e=>{XU(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),dY&&this._register(sq(this.element,`auxclick`,e=>{e.button===1&&YU(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(sq(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(sq(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(sq(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(sq(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(sq(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(sq(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(sq(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(sq(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,VU.get()),fY||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(KJ,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(TW,this._coreBrowserService),this._register(sq(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(sq(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(HJ,this._document,this._helperContainer),this._instantiationService.setService(wW,this._charSizeService),this._themeService=this._instantiationService.createInstance(XY),this._instantiationService.setService(AW,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(CJ),this._instantiationService.setService(kW,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(vY,this.rows,this.screenElement)),this._instantiationService.setService(DW,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(lJ,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ZJ),this._instantiationService.setService(EW,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(zZ,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(eJ,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(BY,this.element,this.screenElement,r)),this._instantiationService.setService(OW,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(gG.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(tJ,this.screenElement)),this._register(sq(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(RZ,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(oJ,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(oJ,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(VJ,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(sq(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(sq(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){JU(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=OZ(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(HZ(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(oX));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function HZ(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var UZ=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},WZ=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new aW)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},GZ=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new WZ(t)}getNullCell(){return new aW}},KZ=class extends cG{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new GZ(this._core.buffers.normal,`normal`),this._alternate=new GZ(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},qZ=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},JZ=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},YZ=[`cols`,`rows`],XZ=0,ZZ=class extends cG{constructor(e){super(),this._core=this._register(new VZ(e)),this._addonManager=this._register(new UZ),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(YZ.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new qZ(this._core),this._parser}get unicode(){return this._checkProposedApi(),new JZ(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new KZ(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
184
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return VU.get()},set promptLabel(e){VU.set(e)},get tooMuchOutput(){return UU.get()},set tooMuchOutput(e){UU.set(e)}}}_verifyIntegers(...e){for(XZ of e)if(XZ===1/0||isNaN(XZ)||XZ%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(XZ of e)if(XZ&&(XZ===1/0||isNaN(XZ)||XZ%1!=0||XZ<0))throw Error(`This API only accepts positive integers`)}},QZ=250,$Z=5e3,eQ=8e3,tQ=3e3;function nQ(e){return`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}`}function rQ(){return nQ(window.location)}var iQ=class{opts;ws=null;backoff=QZ;reconnectTimer=null;connectTimer=null;stallTimer=null;disposed=!1;ended=!1;receivedData=!1;url;constructor(e){this.opts=e;let t=e.wsBase??rQ();this.url=`${t.replace(/\/$/,``)}/ws/terminal/${encodeURIComponent(e.sessionId)}`}connect(){if(this.disposed||this.ended)return;this.clearTimer(),this.opts.onStatus(this.backoff===QZ?`connecting`:`reconnecting`);let e=new WebSocket(this.url);e.binaryType=`arraybuffer`,this.ws=e,this.connectTimer=setTimeout(()=>{e.readyState===WebSocket.CONNECTING&&this.forceClose(e)},eQ),e.onopen=()=>{this.clearConnectTimer(),this.receivedData&&(this.receivedData=!1,this.opts.onReset?.())},e.onmessage=e=>{typeof e.data==`string`?this.handleControl(e.data):(this.receivedData=!0,this.opts.onData(new Uint8Array(e.data)))},e.onclose=()=>{this.ws=null,this.clearConnectTimer(),this.clearStallTimer(),!(this.disposed||this.ended)&&(this.opts.onStatus(`reconnecting`),this.scheduleReconnect())},e.onerror=()=>{this.forceClose(e)}}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(new TextEncoder().encode(e)),this.watchForStall())}resize(e,t){this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(JSON.stringify({t:`resize`,cols:e,rows:t})),this.watchForStall())}dispose(){if(this.disposed=!0,this.clearTimer(),this.clearConnectTimer(),this.clearStallTimer(),this.ws){this.ws.onopen=null,this.ws.onclose=null,this.ws.onerror=null,this.ws.onmessage=null;try{this.ws.close()}catch{}this.ws=null}}handleControl(e){let t;try{t=JSON.parse(e)}catch{return}t.t===`status`&&(t.status===`live`?(this.backoff=QZ,this.opts.onStatus(`live`)):t.status===`ended`&&(this.ended=!0,this.opts.onStatus(`ended`)))}watchForStall(){this.stallTimer===null&&(this.stallTimer=setTimeout(()=>{this.stallTimer=null;let e=this.ws;!e||e.readyState!==WebSocket.OPEN||e.bufferedAmount>0&&this.forceClose(e)},tQ))}forceClose(e){try{e.close()}catch{}if(this.ws===e&&e.readyState===WebSocket.CLOSED){if(e.onclose=null,this.ws=null,this.disposed||this.ended)return;this.opts.onStatus(`reconnecting`),this.scheduleReconnect()}}scheduleReconnect(){this.clearTimer();let e=this.backoff;this.backoff=Math.min(this.backoff*2,$Z),this.reconnectTimer=setTimeout(()=>this.connect(),e)}clearTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}clearConnectTimer(){this.connectTimer!==null&&(clearTimeout(this.connectTimer),this.connectTimer=null)}clearStallTimer(){this.stallTimer!==null&&(clearTimeout(this.stallTimer),this.stallTimer=null)}};function aQ(e){return e.key===`v`||e.key===`V`||e.code===`KeyV`}function oQ(e){let t=e.type===`keydown`;if(!t&&e.type!==`keypress`)return{intercept:!1};if(e.key===`Enter`&&(e.shiftKey||e.ctrlKey))return{intercept:!0,bytes:t?`\x1B\r`:``};if(Xy(e))return{intercept:!0,bytes:``};if(aQ(e)&&!e.shiftKey&&!e.metaKey){if(e.ctrlKey&&!e.altKey)return{intercept:!0,bytes:``};if(e.altKey&&!e.ctrlKey)return{intercept:!0,bytes:t?`\x1Bv`:``}}return{intercept:!1}}var sQ={background:`#07080b`,foreground:`#C9D1D9`,cursor:`#7c6cf6`,cursorAccent:`#07080b`,selectionBackground:`rgba(124,108,246,0.25)`};function cQ({sessionId:e,wsBase:t,onEnded:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(`connecting`),o=(0,L.useRef)(n);o.current=n,(0,L.useEffect)(()=>{let n=r.current;if(!n)return;let i=new ZZ({theme:sQ,fontFamily:`"JetBrains Mono Variable", "Cascadia Code", Consolas, monospace`,fontSize:12.5,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3}),s=new FU;i.loadAddon(s),i.open(n);let c=()=>{try{s.fit()}catch{}};c();let l=requestAnimationFrame(c),u;u=new iQ({sessionId:e,wsBase:t,onData:e=>i.write(e),onReset:()=>i.reset(),onStatus:e=>{a(e),e===`live`&&u.resize(i.cols,i.rows),e===`ended`&&o.current?.()}});let d=i.onData(e=>u.send(e)),f=i.onResize(({cols:e,rows:t})=>u.resize(e,t));i.attachCustomKeyEventHandler(e=>{let t=oQ(e);return t.intercept?(t.bytes&&u.send(t.bytes),!1):!0}),u.connect();let p=new ResizeObserver(()=>c());return p.observe(n),()=>{cancelAnimationFrame(l),p.disconnect(),d.dispose(),f.dispose(),u.dispose(),i.dispose()}},[e,t]);let s=i===`connecting`?{text:`connecting…`,tone:`dim`}:i===`reconnecting`?{text:`disconnected — reconnecting… keystrokes are dropped until the stream is back`,tone:`down`}:i===`ended`?{text:`session stream ended — relaunch or end the session above`,tone:`dim`}:null;return(0,R.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,background:`#07080b`,overflow:`hidden`,boxSizing:`border-box`,padding:`8px 2px 6px 10px`},children:[(0,R.jsx)(`div`,{ref:r,style:{width:`100%`,height:`100%`},"data-session-id":e}),s&&(0,R.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,fontFamily:`"Cascadia Code", "JetBrains Mono", Consolas, monospace`,fontSize:11,padding:`4px 10px`,pointerEvents:`none`,color:s.tone===`down`?`#F4594E`:`#8B949E`,background:s.tone===`down`?`rgba(244,89,78,0.10)`:`rgba(14,17,22,0.85)`,borderBottom:`1px solid ${s.tone===`down`?`rgba(244,89,78,0.4)`:`#1A2028`}`},children:s.text})]})}function lQ(e,t){if(!e)return null;let n=vy(e,t);if(n.kind===`notDone`)return null;if(n.kind===`mapComplete`)return`Map complete — every waypoint is done. Converge from the bar above.`;let r=n.waypoint.status===`dropped`?`Dropped`:`Resolved`;return n.kind===`awaitingResearch`?`${r} ✓ — waiting on ${n.claimed} research run${n.claimed===1?``:`s`}`:`${r} ✓${n.waypoint.summary?` — ${n.waypoint.summary}`:``}`}function uQ({session:e,full:t,right:n}){let r=e.ccSessionId??e.id,i=lQ(t,e),a=e.status!==`ended`;return(0,R.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 border-b border-hairline px-3 font-mono text-sm`,title:r,children:[(0,R.jsxs)(`span`,{className:`font-semibold text-text`,children:[Ey(e),` session`]}),a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-text-3`,children:`·`}),(0,R.jsx)(uk,{status:e.status}),(0,R.jsx)(`span`,{className:`text-text-2`,children:e.status===`launching`?`starting…`:`live`}),e.createdAt&&(0,R.jsxs)(`span`,{className:`text-text-3`,children:[`· `,l_(e.createdAt,Date.now())]})]}):(0,R.jsxs)(`span`,{className:`text-text-3`,children:[`· ended`,e.endedAt===void 0?``:` ${c_(e.endedAt)}`]}),i&&(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-text-2`,title:i,children:i}),!i&&(0,R.jsx)(`span`,{className:`flex-1`}),n]})}function dQ({featureId:e,sessions:t,full:n,className:r,right:i}){let a=_Q(t);return a?zg(a)?(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-hairline bg-panel-2${r?` ${r}`:``}`,children:[(0,R.jsx)(uQ,{session:a,full:n,right:(0,R.jsxs)(R.Fragment,{children:[i,(0,R.jsx)(jU,{featureId:e,sessionId:a.id})]})}),(0,R.jsx)(fQ,{featureId:e,session:a}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1`,id:`session-terminal`,children:(0,R.jsx)(MU,{label:`terminal`,children:(0,R.jsx)(cQ,{sessionId:a.id})})})]}):(0,R.jsx)(uQ,{session:a,full:n}):null}function fQ({featureId:e,session:t}){let n=yM(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(mQ,{session:t,events:n}),(0,R.jsx)(gQ,{session:t,notReady:Rg(n,t.id)})]})}var pQ=5e3;function mQ({session:e,events:t}){return Lg(e,t,hQ(pQ))?(0,R.jsx)(`div`,{className:`border-b border-hairline px-3 py-1.5 text-xs text-text-3`,children:`agent hasn’t checked in yet`}):null}function hQ(e){let[t,n]=(0,L.useState)(()=>Date.now());return(0,L.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function gQ({session:e,notReady:t}){return t?(0,R.jsxs)(`div`,{className:`border-b border-warn/35 bg-warn/8 px-3 py-2 text-sm text-warn`,children:[`This terminal has not reported ready — `,rv(e),` has not started on its briefing. Answer anything waiting in it (a trust or login prompt).`]}):null}function _Q(e){let t=[...e].reverse();return t.find(zg)??t[0]}function vQ({docs:e,value:t,onPick:n}){return(0,R.jsxs)(Lj,{children:[(0,R.jsxs)(Rj,{className:`ml-auto h-8 rounded-md px-2 font-mono text-xs text-text-3 hover:bg-panel-3 hover:text-text`,children:[t?.split(/[\\/]/).pop()??`docs`,` ▾`]}),(0,R.jsx)(zj,{align:`end`,className:`min-w-40`,children:e.map(e=>(0,R.jsx)(Hj,{"aria-current":e.relPath===t?`true`:void 0,onSelect:()=>n(e.relPath),children:e.title||e.relPath.split(/[\\/]/).pop()},e.relPath))})]})}function yQ({featureId:e,kind:t,docs:n,collapsed:r=!1,onToggle:i,mapped:a=!1,mode:o=`live`,children:s}){let c=n.find(e=>e.relPath.endsWith(`${t}.md`))?.relPath,[l,u]=(0,L.useState)(c),[d,f]=(0,L.useState)(!1),p=(0,L.useRef)(void 0),m=o===`static`;(0,L.useEffect)(()=>u(c),[t,c]);let h=rU(e,l,{live:!m}),g=h.content??``;(0,L.useEffect)(()=>{if(h.content!==void 0){if(p.current!==void 0&&p.current!==g&&t===`spec`){f(!0);let e=window.setTimeout(()=>f(!1),3e3);return p.current=g,()=>window.clearTimeout(e)}p.current=g}},[g,h.content,t]);let _=Eg(g);if(r&&i)return(0,R.jsx)(`button`,{type:`button`,className:`flex w-10 flex-none items-center justify-center rounded-lg border border-hairline bg-panel-2 font-mono text-xs text-text-3 [writing-mode:vertical-rl]`,title:`Expand the ${t} pane`,onClick:i,children:t===`decisions`?_:`spec`});let v=m||l===c;return(0,R.jsxs)(`aside`,{className:`flex min-h-0 flex-col rounded-lg border border-hairline bg-panel-2 ${m?`min-w-0 flex-1`:`w-(--artifact-w) flex-none`}`,children:[(0,R.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 border-b border-hairline px-3`,children:[(0,R.jsx)(MO,{children:v?t===`spec`?`Spec`:m?`Decisions`:`Decisions so far`:l?.split(/[\\/]/).pop()}),m&&(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[t,`.md`,t===`decisions`?` · ${_}`:``]}),!m&&v&&t===`decisions`&&(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[`· `,_]}),!m&&v&&t===`spec`&&d&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-ok`,children:`updating`}),!m&&(0,R.jsx)(vQ,{docs:n,value:l,onPick:u}),!m&&i&&(0,R.jsx)(`button`,{type:`button`,className:`size-8 rounded-md text-text-3 hover:bg-panel-3 hover:text-text`,title:`Collapse the ${t} pane`,onClick:i,children:`‹`})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:[h.loading&&(0,R.jsx)(`span`,{className:`font-mono text-sm text-text-3`,children:`loading…`}),h.failed&&(0,R.jsxs)(`span`,{className:`font-mono text-sm text-danger`,children:[`could not read `,l]}),g?(0,R.jsx)(AH,{source:g}):v?(0,R.jsx)(bQ,{kind:t,mapped:a,frozen:m}):null,s]})]})}function bQ({kind:e,mapped:t,frozen:n}){return n?(0,R.jsx)(PO,{compact:!0,title:e===`decisions`?`No decisions were recorded`:`No spec`,hint:`This feature was created as a quick change and skipped ideation.`}):(0,R.jsx)(PO,{compact:!0,title:e===`decisions`?`No decisions yet`:`No spec yet`,hint:e===`decisions`?`They land here one by one as the session settles them.`:t?`The converge session writes it here from the map and the decisions.`:`The session is drafting the spec — it appears here as it's written.`})}function xQ({featureId:e,group:t,item:n,blocker:r,readonly:i=!1}){let a=n.waypoint,[o,s]=(0,L.useState)(n.openByDefault),[c,l]=(0,L.useState)(!1),u=B.useUtils(),d=qy(),f=a.type===`research`,p=!f&&!!a.lastSessionId,m=a.claimedBy?.startsWith(`run_`)??!1,h=i||o,g=B.feature.workWaypoint.useMutation({onSuccess:()=>{l(!1),u.feature.get.invalidate({id:e}),u.feature.list.invalidate()},onError:(e,t)=>{!f&&!t.endLive&&r&&e.data?.code===`PRECONDITION_FAILED`?l(!0):(l(!1),d.push(e.message))}}),_=()=>{i||s(e=>!e)};return(0,R.jsxs)(`div`,{className:`rounded-md border p-2 ${t===`ready`?`border-accent-line`:t===`working`?`border-ok/40`:`border-hairline`} ${t===`done`?`opacity-70`:``}`,role:i?void 0:`button`,tabIndex:i?void 0:0,"aria-expanded":i?void 0:h,title:i?void 0:h?`collapse this waypoint`:`expand this waypoint`,onClick:_,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_())},children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-semibold ${t===`ready`?`text-accent-hi`:t===`working`?`text-ok`:`text-text-3`}`,children:[(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-current ${t===`working`?`animate-pulse`:``}`,"aria-hidden":`true`}),n.stateWord]}),(0,R.jsx)(`span`,{className:`ml-auto font-mono text-[11px] text-text-4`,children:a.type})]}),(0,R.jsx)(`div`,{className:`mt-1 text-sm ${t===`done`?`font-normal text-text-2`:`font-medium text-text`}`,children:a.title}),h&&(0,R.jsxs)(`div`,{className:`mt-2 text-sm text-text-3`,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(AH,{source:a.question}),t===`working`&&m&&(0,R.jsx)(`div`,{className:`mt-2 font-mono text-xs text-text-3`,children:`researching…`}),t===`done`&&a.summary&&(0,R.jsx)(AH,{source:a.summary,className:`mt-2 text-text-3`}),n.originTitle&&(0,R.jsxs)(`div`,{className:`mt-2 font-mono text-xs text-text-4`,children:[`surfaced by `,n.originTitle]})]}),!i&&t===`ready`&&(0,R.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,disabled:g.isPending,title:f?`start an unattended research run on this waypoint`:p?`resume the previous session on this waypoint`:`claim this waypoint and open a session`,onClick:()=>g.mutate({featureId:e,waypointId:a.id}),children:p?`Resume`:`Work`}),f&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-4`,children:`runs unattended`})]}),!i&&c&&r&&(0,R.jsxs)(`div`,{className:`mt-2 rounded-md border border-danger/30 bg-danger/5 p-2`,role:`alert`,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`div`,{className:`text-xs text-text-2`,children:r.waypointTitle?(0,R.jsxs)(R.Fragment,{children:[`A session is live on `,(0,R.jsx)(`b`,{className:`font-semibold text-text`,children:r.waypointTitle}),` and its waypoint is still open. End it and work this instead?`]}):(0,R.jsxs)(R.Fragment,{children:[`A `,r.kind,` session is live on this feature. End it and work this instead?`]})}),(0,R.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-danger`,disabled:g.isPending,onClick:()=>g.mutate({featureId:e,waypointId:a.id,endLive:!0}),children:`End & work this`}),(0,R.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,onClick:()=>l(!1),children:`Cancel`})]})]})]})}var SQ=[`Destination`,`Notes`,`Not yet specified`,`Out of scope`];function CQ({full:e,relPath:t,collapsed:n,onToggle:r,readonly:i=!1}){let a=e.feature.id,[o,s]=(0,L.useState)(),c=B.docs.read.useQuery({featureId:a,relPath:t??`map.md`},{enabled:!!t}),l=c.data?Y_(c.data.content):{},u=ev(e.waypoints,e.frontierIds,i),d=$_(e.waypoints,e.frontierIds),f=!!t||e.waypoints.length>0,p=d.total===0?0:d.done/d.total*100;return(0,R.jsxs)(`aside`,{className:`flex min-h-0 flex-none flex-col rounded-lg border border-hairline bg-panel-2 ${n?`w-10`:`w-(--maprail-w)`}`,children:[n?(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-0 flex-1 flex-col items-center gap-3 py-3 font-mono text-xs text-text-3 hover:bg-panel-3 hover:text-text`,title:`Expand the map rail`,onClick:r,children:[(0,R.jsxs)(`span`,{children:[d.done,`/`,d.total]}),(0,R.jsx)(`span`,{className:`[writing-mode:vertical-rl]`,children:`map`}),(0,R.jsx)(`span`,{"aria-hidden":`true`,children:`›`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 border-b border-hairline px-3`,children:[(0,R.jsx)(MO,{children:`Map`}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[`· `,d.done,`/`,d.total,` done`]}),(0,R.jsx)(`button`,{type:`button`,className:`flex size-3.5 items-center justify-center rounded-full text-[11px] text-text-3 hover:text-text`,title:iv,"aria-label":`What is a waypoint?`,children:`ⓘ`}),(0,R.jsx)(vQ,{docs:e.docs,value:t,onPick:s}),(0,R.jsx)(`button`,{type:`button`,className:`size-8 rounded-md text-text-3 hover:bg-panel-3 hover:text-text`,"aria-expanded":`true`,title:`Collapse the map rail`,onClick:r,children:`‹`})]}),(0,R.jsx)(`div`,{className:`h-0.75 bg-panel-3`,"aria-label":`${d.done} of ${d.total} waypoints done`,children:(0,R.jsx)(`div`,{className:`h-full bg-accent`,style:{width:`${p}%`}})}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[c.isLoading&&(0,R.jsx)(NO,{children:`loading map…`}),f?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(TQ,{featureId:a,groups:u,blocker:yy(e.sessions,e.waypoints),readonly:i}),t&&(0,R.jsx)(wQ,{sections:l})]}):(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-hairline bg-panel-3 p-3 text-text-3`,children:[(0,R.jsx)(Xh,{size:14}),(0,R.jsx)(`span`,{className:`font-semibold text-text-2`,children:`Not charted yet`}),(0,R.jsx)(`span`,{className:`text-sm`,children:`the session writes the map as you explore the idea`})]})]})]}),o&&o!==t&&(0,R.jsx)(jH,{featureId:a,relPath:o,title:e.docs.find(e=>e.relPath===o)?.title||o.split(/[\\/]/).pop()||`Document`,onClose:()=>s(void 0)})]})}function wQ({sections:e}){let t=SQ.filter(t=>(e[t]?.trim()??``)!==``);return(0,R.jsxs)(`details`,{className:`mt-4 border-t border-hairline-soft pt-3`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer font-mono text-xs uppercase tracking-wide text-text-3 hover:text-text-2`,children:`Map document`}),t.length===0?(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(NO,{children:`Nothing written yet — the session fills this in as it explores the idea.`})}):t.map(t=>(0,R.jsxs)(`section`,{className:`mt-3`,children:[(0,R.jsx)(`div`,{className:`mb-1.5 font-mono text-[11px] uppercase tracking-wide text-text-3`,children:t}),(0,R.jsx)(AH,{source:e[t].trim()})]},t))]})}function TQ({featureId:e,groups:t,blocker:n,readonly:r}){return t.length===0?(0,R.jsx)(`div`,{className:`rounded-md border border-dashed border-hairline p-3`,children:(0,R.jsx)(NO,{children:`No waypoints yet — they appear here as the map takes shape.`})}):(0,R.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(t=>{let i=(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:t.waypoints.map(i=>(0,R.jsx)(xQ,{featureId:e,group:t.key,item:i,blocker:n,readonly:r},i.waypoint.id))}),a=(0,R.jsxs)(`span`,{className:`font-mono text-[11px] font-semibold uppercase tracking-wide text-text-3`,children:[t.label,` · `,t.waypoints.length]});return t.key===`done`&&!r?(0,R.jsxs)(`details`,{className:`border-t border-hairline-soft pt-3`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer list-none`,children:a}),i]},t.key):(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`div`,{children:a}),i]},t.key)})})}function EQ({full:e,effective:t,chatDocked:n=!1,mapRailCollapsed:r,onToggleMapRail:i,artifactPaneCollapsed:a,onToggleArtifactPane:o}){let s=e.docs.some(e=>e.relPath.endsWith(`spec.md`))?`spec`:`decisions`,c=xy(e.sessions,n);return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-1 gap-4`,children:[e.feature.mapped&&t===`planning`?(0,R.jsx)(CQ,{full:e,relPath:J_(e),collapsed:r,onToggle:i}):(0,R.jsx)(yQ,{featureId:e.feature.id,kind:s,docs:e.docs,collapsed:a,onToggle:o,mapped:e.feature.mapped}),(0,R.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:c.length>0?(0,R.jsx)(dQ,{featureId:e.feature.id,sessions:c,full:e}):(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 rounded-lg border border-hairline bg-panel-2`,children:c.length<e.sessions.length?(0,R.jsx)(PO,{icon:(0,R.jsx)(Jh,{size:16}),title:`The chat is docked`,hint:`The conversation is in the panel on the right — collapse it to bring the terminal back here.`}):(0,R.jsx)(PO,{icon:(0,R.jsx)(Jh,{size:16}),title:`No session yet`,hint:`Start a session from the bar above — you and the agent shape the idea here before any code is written.`})})})]})}var DQ=Object.defineProperty,OQ=(e,t)=>DQ(e,`name`,{value:t,configurable:!0});function kQ(e,[t,n]){return Math.min(n,Math.max(t,e))}OQ(kQ,`clamp`);var AQ=Object.defineProperty,jQ=(e,t)=>AQ(e,`name`,{value:t,configurable:!0});function MQ(e){let t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}jQ(MQ,`usePrevious`);var NQ=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),PQ=Object.defineProperty,FQ=(e,t)=>PQ(e,`name`,{value:t,configurable:!0}),IQ=[` `,`Enter`,`ArrowUp`,`ArrowDown`],LQ=[` `,`Enter`],RQ=`Select`,[zQ,BQ,VQ]=hk(RQ),[HQ,UQ]=Xb(RQ,[VQ,bD]),WQ=bD(),[GQ,KQ]=HQ(RQ),[qQ,JQ]=HQ(RQ);function YQ(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:p,form:m,internal_do_not_use_render:h}=e,g=WQ(t),[_,v]=L.useState(null),[y,b]=L.useState(null),[x,S]=L.useState(!1),C=kk(l),[w,T]=fx({prop:r,defaultProp:i??!1,onChange:a,caller:RQ}),[E,D]=fx({prop:o,defaultProp:s,onChange:c,caller:RQ}),O=L.useRef(null),k=L.useRef(E);L.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=FQ(()=>D(k.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let A=!_||!!m||!!_.closest(`form`),[j,M]=L.useState(new Set),N=rx(),P=Array.from(j).map(e=>e.props.value).join(`;`),F=L.useCallback(e=>{M(t=>new Set(t).add(e))},[]),ee=L.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),te={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:N,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:P,isFormControl:A};return(0,R.jsx)(ND,{...g,children:(0,R.jsx)(GQ,{scope:t,...te,children:(0,R.jsx)(zQ.Provider,{scope:t,children:(0,R.jsx)(qQ,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:ee,children:P$(h)?h(te):n})})})})}FQ(YQ,`SelectProvider`);var XQ=FQ(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,R.jsx)(YQ,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[n,e?(0,R.jsx)(N$,{__scopeSelect:t}):null]})})},`Select`),ZQ=`SelectTrigger`,QQ=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=WQ(n),o=KQ(ZQ,n),s=o.disabled||r,c=Kb(t,o.onTriggerChange),l=BQ(n),u=L.useRef(`touch`),[d,f,p]=I$(e=>{let t=l().filter(e=>!e.disabled),n=L$(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=FQ(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,R.jsx)(PD,{asChild:!0,...a,children:(0,R.jsx)(Px.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":F$(o.value)?``:void 0,...i,ref:c,onClick:q(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:q(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:q(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&IQ.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),$Q=`SelectValue`,e$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=KQ($Q,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Kb(t,c.onValueNodeChange);Qb(()=>{l(u)},[l,u]);let f=F$(c.value);return(0,R.jsx)(Px.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,R.jsx)(L.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),t$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,R.jsx)(Px.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[n$,r$]=HQ(`SelectPortal`,{forceMount:void 0}),i$=FQ(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,R.jsx)(n$,{scope:e.__scopeSelect,forceMount:n,children:(0,R.jsx)(_S,{asChild:!0,...r})})},`SelectPortal`),a$=`SelectContent`,o$=L.forwardRef(FQ(function(e,t){let n=r$(a$,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=KQ(a$,e.__scopeSelect),[o,s]=L.useState();return Qb(()=>{s(new DocumentFragment)},[]),(0,R.jsx)(xS,{present:r||a.open,children:({present:e})=>e?(0,R.jsx)(f$,{...i,ref:t}):(0,R.jsx)(s$,{...i,fragment:o})})},`SelectContent`)),s$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?yb.createPortal((0,R.jsx)(l$,{scope:n,children:(0,R.jsx)(zQ.Slot,{scope:n,children:(0,R.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),c$=10,[l$,u$]=HQ(a$),d$=yx(`SelectContent.RemoveScroll`),f$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=KQ(a$,n),[y,b]=L.useState(null),[x,S]=L.useState(null),C=Kb(t,b),[w,T]=L.useState(null),[E,D]=L.useState(null),O=BQ(n),[k,A]=L.useState(!1),j=L.useRef(!1);L.useEffect(()=>{if(y)return ZC(y)},[y]),MS();let M=L.useCallback(e=>{let[t,...n]=O().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&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=L.useCallback(()=>M([w,y]),[M,w,y]);L.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;L.useEffect(()=>{if(y){let e={x:0,y:0},t=FQ(t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},`handlePointerMove`),n=FQ(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null},`handlePointerUp`);return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),L.useEffect(()=>{let e=FQ(()=>P(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[ee,te]=I$(e=>{let t=O().filter(e=>!e.disabled),n=L$(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ne=L.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),I=L.useCallback(()=>y?.focus(),[y]),re=L.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ie=r===`popper`?m$:p$,ae=ie===m$?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,R.jsx)(l$,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ne,selectedItem:w,onItemLeave:I,itemTextRefCallback:re,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:ee,children:(0,R.jsx)(HC,{as:d$,allowPinchZoom:!0,children:(0,R.jsx)(iS,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:q(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,R.jsx)(Kx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,R.jsx)(ie,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ae,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:q(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().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`)),p$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=KQ(a$,n),o=u$(a$,n),[s,c]=L.useState(null),[l,u]=L.useState(null),d=Kb(t,u),f=BQ(n),p=L.useRef(!1),m=L.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=L.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`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-c$,d=kQ(a,[c$,Math.max(c$,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-c$,d=kQ(a,[c$,Math.max(c$,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-c$*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-c$,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${c$}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Qb(()=>y(),[y]);let[b,x]=L.useState();return Qb(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,R.jsx)(h$,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:L.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,R.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,R.jsx)(Px.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),m$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=c$,...a}=e,o=WQ(n);return(0,R.jsx)(FD,{...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`)),[h$,g$]=HQ(a$,{}),_$=`SelectViewport`,v$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=u$(_$,n),o=g$(_$,n),s=Kb(t,a.onViewportChange),c=L.useRef(0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.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,R.jsx)(zQ.Slot,{scope:n,children:(0,R.jsx)(Px.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:q(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-c$*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`)),[y$,b$]=HQ(`SelectGroup`),x$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,...r}=e,i=rx();return(0,R.jsx)(y$,{scope:n,id:i,children:(0,R.jsx)(Px.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})},`SelectGroup`)),S$=`SelectLabel`,C$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,...r}=e,i=b$(S$,n);return(0,R.jsx)(Px.div,{id:i.id,...r,ref:t})},`SelectLabel`)),w$=`SelectItem`,[T$,E$]=HQ(w$),D$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=KQ(w$,n),c=u$(w$,n),l=s.value===r,[u,d]=L.useState(a??``),[f,p]=L.useState(!1),m=Kb(t,Rx(e=>c.itemRefCallback?.(e,r,i))),h=rx(),g=L.useRef(`touch`),_=FQ(()=>{i||(s.onValueChange(r),s.onOpenChange(!1))},`handleSelect`);return(0,R.jsx)(T$,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:L.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,R.jsx)(zQ.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,R.jsx)(Px.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:q(o.onFocus,()=>p(!0)),onBlur:q(o.onBlur,()=>p(!1)),onClick:q(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:q(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:q(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:q(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:q(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:q(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(LQ.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),O$=`SelectItemText`,k$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=KQ(O$,n),s=u$(O$,n),c=E$(O$,n),l=JQ(O$,n),[u,d]=L.useState(null),f=Rx(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=Kb(t,d,c.onItemTextChange,f),m=u?.textContent,h=L.useMemo(()=>(0,R.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Qb(()=>(g(h),()=>_(h)),[g,_,h]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Px.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!F$(o.value)?yb.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),A$=`SelectItemIndicator`,j$=L.forwardRef(FQ(function(e,t){let{__scopeSelect:n,...r}=e;return E$(A$,n).isSelected?(0,R.jsx)(Px.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),M$=`SelectBubbleInput`,N$=L.forwardRef(FQ(function({__scopeSelect:e,...t},n){let r=KQ(M$,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=L.useRef(null),m=Kb(n,p),h=i??``,g=MQ(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return L.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,R.jsxs)(Px.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...NQ,...t.style},ref:m,defaultValue:h,children:[F$(i)&&!_?(0,R.jsx)(`option`,{value:``}):null,Array.from(d)]},f)},`SelectBubbleInput`));function P$(e){return typeof e==`function`}FQ(P$,`isFunction`);function F$(e){return e===``||e===void 0}FQ(F$,`shouldShowPlaceholder`);function I$(e){let t=Rx(e),n=L.useRef(``),r=L.useRef(0),i=L.useCallback(e=>{let i=n.current+e;t(i),FQ((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=L.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}FQ(I$,`useTypeaheadSearch`);function L$(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=R$(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}FQ(L$,`findNextItem`);function R$(e,t){return e.map((n,r)=>e[(t+r)%e.length])}FQ(R$,`wrapArray`);var z$=`\0empty`,B$=e=>e===``?z$:e,V$=e=>e===z$?``:e;function H$({value:e,defaultValue:t,onValueChange:n,...r}){return(0,R.jsx)(XQ,{value:e===void 0?void 0:B$(e),defaultValue:t===void 0?void 0:B$(t),onValueChange:n&&(e=>n(V$(e))),...r})}var U$=`inline-flex min-w-0 cursor-pointer items-center justify-between gap-1.5 text-left`;function W$({className:e,children:t,...n}){return(0,R.jsxs)(QQ,{className:eT(U$,e),...n,children:[t,(0,R.jsx)(t$,{className:`shrink-0 text-text-4`,children:(0,R.jsx)(Gh,{size:11})})]})}function G$({className:e,...t}){return(0,R.jsx)(e$,{className:eT(`min-w-0 truncate`,e),...t})}function K$({className:e,position:t=`popper`,sideOffset:n=4,collisionPadding:r=8,onEscapeKeyDown:i,children:a,...o}){return(0,R.jsx)(i$,{children:(0,R.jsx)(o$,{position:t,sideOffset:n,collisionPadding:r,onEscapeKeyDown:e=>{i?.(e),e.stopPropagation()},className:eT(tT,`max-h-(--radix-select-content-available-height) min-w-32 font-mono`,e),...o,children:(0,R.jsx)(v$,{className:`w-full min-w-(--radix-select-trigger-width) p-1`,children:a})})})}var q$=x$;function J$({className:e,...t}){return(0,R.jsx)(C$,{className:eT(`px-2.5 py-1.5 text-xs tracking-[0.08em] text-text-4 uppercase`,e),...t})}var Y$=`flex w-full cursor-pointer items-center justify-between gap-3 rounded-sm px-2.5 py-1.5 text-left text-text-2 transition-colors duration-(--dur-1) ease-app select-none hover:bg-accent-soft hover:text-text data-highlighted:bg-accent-soft data-highlighted:text-text data-[state=checked]:text-text data-disabled:cursor-not-allowed data-disabled:opacity-40`;function X$({className:e,children:t,value:n,...r}){return(0,R.jsxs)(D$,{value:B$(n),className:eT(Y$,e),...r,children:[(0,R.jsx)(k$,{children:t}),(0,R.jsx)(j$,{className:`inline-flex shrink-0 items-center text-accent-hi`,children:(0,R.jsx)(Vh,{size:11})})]})}function Z$(e){return/\bimplementer[- ]only\b/i.test(e?.note??``)}function Q$({value:e,roster:t,onChange:n,disabled:r=!1,label:i,ticketKind:a}){let o=t.find(t=>t.id===e),s=a===`review`&&Z$(o),c=i??(o?`${o.id} · ${Lp[o.runtime]}`:e||`default model`),l=i??`Ticket model`;return(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,R.jsxs)(H$,{value:e,onValueChange:n,children:[(0,R.jsx)(W$,{"aria-label":l,disabled:r,className:`h-7 rounded-pill border border-hairline bg-transparent px-2 font-mono text-xs text-text-2 hover:border-hairline-strong hover:text-text disabled:opacity-40`,children:(0,R.jsx)(G$,{children:c})}),(0,R.jsxs)(K$,{"aria-label":l,className:`min-w-64 text-xs`,children:[(0,R.jsx)(X$,{value:``,children:`default (project model)`}),Vp(t).map(e=>(0,R.jsxs)(q$,{children:[(0,R.jsx)(J$,{children:e.label}),e.entries.map(e=>(0,R.jsxs)(X$,{value:e.id,children:[e.note?`${e.id} — ${e.note}`:e.id,a===`review`&&Z$(e)?` — not recommended for review`:``]},e.id))]},e.runtime))]})]}),s&&(0,R.jsx)(`span`,{className:`text-xs text-warn`,children:`Implementer-only model — not recommended for review tickets`})]})}var $$=`appearance-none bg-transparent p-0`,e1=`${$$} border-0`,t1=(0,L.createContext)(null);function n1({open:e,children:t}){return(0,R.jsx)(t1.Provider,{value:e,children:t})}function r1({location:e,children:t}){let n=(0,L.useContext)(t1);return n?(0,R.jsx)(`button`,{type:`button`,className:`${e1} cursor-pointer text-accent-hi underline underline-offset-2 hover:text-accent-2`,onClick:t=>{t.stopPropagation(),n(e)},children:t}):(0,R.jsx)(R.Fragment,{children:t})}function i1({text:e}){let t=(0,L.useContext)(t1),n=Am(e);return!t||!n?(0,R.jsx)(R.Fragment,{children:e}):(0,R.jsxs)(R.Fragment,{children:[n.before,(0,R.jsx)(r1,{location:n.location,children:n.phrase}),n.after]})}function a1({ticket:e,busy:t,onCancel:n,onSave:r}){let[i,a]=(0,L.useState)(e.title),[o,s]=(0,L.useState)(e.goal),[c,l]=(0,L.useState)(e.context),[u,d]=(0,L.useState)(e.acceptanceCriteria.join(`
|
|
185
|
+
`)),f=u.split(`
|
|
186
|
+
`).map(e=>e.trim()).filter(Boolean),p=!!i.trim()&&!!o.trim()&&f.length>0,m=`grid gap-1.5`,h=`font-mono text-xs uppercase tracking-wider text-text-4`;return(0,R.jsxs)(`div`,{className:`grid gap-4 border-t border-hairline bg-panel-2 p-4`,children:[(0,R.jsxs)(`label`,{className:m,children:[(0,R.jsx)(`span`,{className:h,children:`Title`}),(0,R.jsx)(`input`,{className:jO,value:i,onChange:e=>a(e.target.value)})]}),(0,R.jsxs)(`label`,{className:m,children:[(0,R.jsx)(`span`,{className:h,children:`Goal`}),(0,R.jsx)(`textarea`,{className:`${jO} min-h-24 resize-y py-2`,value:o,onChange:e=>s(e.target.value)})]}),(0,R.jsxs)(`label`,{className:m,children:[(0,R.jsx)(`span`,{className:h,children:`Context`}),(0,R.jsx)(`textarea`,{className:`${jO} min-h-24 resize-y py-2`,value:c,onChange:e=>l(e.target.value)})]}),(0,R.jsxs)(`label`,{className:m,children:[(0,R.jsx)(`span`,{className:h,children:`Acceptance — one per line`}),(0,R.jsx)(`textarea`,{className:`${jO} min-h-24 resize-y py-2`,value:u,onChange:e=>d(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(J,{className:`h-7 text-xs`,onClick:n,disabled:t,children:`Cancel`}),(0,R.jsx)(J,{variant:`solid`,className:`h-7 text-xs`,disabled:!p||t,onClick:()=>r({title:i.trim(),goal:o.trim(),context:c.trim(),acceptanceCriteria:f}),children:t?`Saving…`:`Save ticket`})]})]})}var o1=new Set([`pending`,`failed`]);function s1({ticket:e,roster:t,readonly:n,onEdit:r,onModel:i,onCancel:a,onCopySha:o}){let[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),h=o1.has(e.status),g=qg(e,t),_=`font-mono text-xs uppercase tracking-wider text-text-4`,v=`grid gap-1.5`;return(0,R.jsxs)(`article`,{className:`border-b border-hairline last:border-b-0`,children:[(0,R.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 px-3`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-label":`${s?`Collapse`:`Expand`} ticket #${e.seq}`,className:`flex min-w-0 flex-1 items-center gap-2 border-0 bg-transparent p-0 text-left text-text`,onClick:()=>c(e=>!e),children:[(0,R.jsx)(`span`,{className:`text-text-4 transition-transform ${s?`rotate-90`:``}`,children:(0,R.jsx)(Kh,{size:11})}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[`#`,e.seq]}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium ${e.status===`cancelled`?`text-text-4`:`text-text`}`,children:e.title}),(0,R.jsx)(rk,{kind:e.kind}),e.blockedBy.length>0&&(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-4`,title:`Runs after these tickets land`,children:[`after #`,e.blockedBy.join(`, #`)]})]}),h&&!n&&i?(0,R.jsx)(Q$,{value:e.model??``,roster:t,onChange:t=>i(e.id,t)}):g&&(0,R.jsxs)(`span`,{className:`inline-flex h-5 items-center rounded-pill border border-hairline px-2 font-mono text-xs text-text-2`,children:[g.id,` · `,g.runtimeLabel]}),(0,R.jsx)(nk,{status:e.status})]}),s&&l&&r&&(0,R.jsx)(a1,{ticket:e,busy:p,onCancel:()=>u(!1),onSave:t=>{m(!0),r(e.id,t).then(()=>u(!1),()=>void 0).finally(()=>m(!1))}}),s&&!l&&(0,R.jsxs)(`div`,{className:`grid gap-4 border-t border-hairline bg-panel-2 p-4`,children:[!n&&h&&r&&a&&(d?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-danger/40 bg-danger/6 p-3 text-sm text-text-2`,children:[(0,R.jsxs)(`span`,{className:`mr-auto`,children:[`Cancel #`,e.seq,`? Tickets that depend on it treat it as done. Its text stays in the ledger.`]}),(0,R.jsx)(J,{className:`h-7 text-xs`,onClick:()=>f(!1),children:`Keep it`}),(0,R.jsx)(J,{variant:`danger`,className:`h-7 text-xs`,onClick:()=>a(e.id),children:`Cancel ticket`})]}):(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(J,{className:`h-7 text-xs`,onClick:()=>u(!0),children:`Edit ticket`}),(0,R.jsx)(J,{className:`h-7 text-xs`,onClick:()=>f(!0),children:`Cancel ticket`})]})),(0,R.jsxs)(`div`,{className:v,children:[(0,R.jsx)(`div`,{className:_,children:`Goal`}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:(0,R.jsx)(AH,{source:e.goal})})]}),e.context&&(0,R.jsxs)(`div`,{className:v,children:[(0,R.jsx)(`div`,{className:_,children:`Context`}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:(0,R.jsx)(AH,{source:e.context})})]}),(0,R.jsxs)(`div`,{className:v,children:[(0,R.jsx)(`div`,{className:_,children:`Acceptance`}),(0,R.jsx)(`ul`,{className:`m-0 grid gap-1 pl-5 text-sm text-text-2`,children:e.acceptanceCriteria.map((e,t)=>(0,R.jsx)(`li`,{children:e},t))})]}),(0,R.jsxs)(`div`,{className:v,children:[(0,R.jsx)(`div`,{className:_,children:`Seams`}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.seams.map((e,t)=>(0,R.jsx)(`span`,{className:`rounded-pill border border-hairline px-2 py-0.5 font-mono text-xs text-text-3`,children:e},t))})]}),(0,R.jsxs)(`div`,{className:v,children:[(0,R.jsx)(`div`,{className:_,children:`Commits`}),e.commits.length===0?(0,R.jsx)(`div`,{className:`font-mono text-xs text-text-4`,children:`no commits yet — the burn writes them`}):(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.commits.map(e=>o?(0,R.jsx)(`button`,{type:`button`,className:`rounded-sm border border-hairline bg-transparent px-2 py-1 font-mono text-xs text-text-2`,onClick:()=>o(e),children:i_(e)},e):(0,R.jsx)(`span`,{className:`rounded-sm border border-hairline px-2 py-1 font-mono text-xs text-text-2`,children:i_(e)},e))})]}),e.digest&&(0,R.jsxs)(`div`,{className:v,children:[(0,R.jsx)(`div`,{className:_,children:`Digest`}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:(0,R.jsx)(AH,{source:e.digest})})]}),e.status===`failed`&&e.error&&(0,R.jsxs)(`div`,{className:`${v} rounded-md border border-danger/40 p-3`,children:[(0,R.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wider text-danger`,children:`Error`}),(0,R.jsx)(i1,{text:e.error})]}),e.status===`cancelled`&&e.error&&(0,R.jsxs)(`div`,{className:v,children:[(0,R.jsx)(`div`,{className:_,children:`Cancelled`}),(0,R.jsx)(i1,{text:e.error})]})]})]})}function c1(e,t){let n=e.filter(e=>e.lap===t&&e.status!==`cancelled`),r=[`${n.filter(e=>e.status===`done`).length}/${n.length} done`,`lap ${t}`],i=n.filter(e=>e.status===`failed`).length,a=n.filter(e=>e.status===`burning`).length;return i&&r.push(`${i} failed`),a&&r.push(`${a} burning`),r.join(` · `)}function l1({tickets:e,currentLap:t,roster:n,readonly:r=!1,docs:i,sandbox:a,defaultModel:o,onDoc:s,onEdit:c,onModel:l,onBulkModel:u,onCancel:d,onCopySha:f}){let p=e.filter(e=>e.lap===t),m=p.filter(e=>e.status===`pending`);return(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col rounded-lg border border-hairline bg-panel`,children:[(0,R.jsxs)(`header`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-hairline px-3`,children:[(0,R.jsx)(MO,{children:`Tickets`}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:c1(e,t)}),s&&(0,R.jsx)(`span`,{className:`inline-flex`,children:(0,R.jsx)(vQ,{docs:i,onPick:s})}),!r&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`ml-auto inline-flex h-5 items-center rounded-pill border border-hairline px-2 font-mono text-xs text-text-3`,children:[`sandbox · `,a]}),(0,R.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-pill border border-hairline px-2 font-mono text-xs text-text-3`,children:o}),u&&(0,R.jsx)(Q$,{value:``,roster:n,disabled:m.length===0,label:`Model for all pending`,onChange:u})]})]}),p.length===0&&(r?(0,R.jsx)(PO,{icon:(0,R.jsx)(Xh,{size:16}),title:`No tickets in this lap.`,compact:!0}):(0,R.jsx)(PO,{icon:(0,R.jsx)(Xh,{size:16}),title:`No tickets yet`,hint:`The session breaks the spec into tickets — they appear here as they land.`,compact:!0})),e.length>0&&(0,R.jsx)(`div`,{className:`min-h-0 overflow-y-auto [&>*+*]:border-t [&>*+*]:border-hairline`,children:(0,R.jsx)(qO,{groups:Kg(e,t),currentLap:t,headClassName:`bg-panel-3 px-3`,meta:e=>`${e.rows.filter(e=>e.status===`done`).length}/${e.rows.filter(e=>e.status!==`cancelled`).length} done`,children:e=>e.map(e=>(0,R.jsx)(s1,{ticket:e,roster:n,readonly:r,onEdit:c,onModel:l,onCancel:d,onCopySha:f},e.id))})}),!r&&(0,R.jsx)(`div`,{className:`border-t border-hairline px-3 py-2 font-mono text-xs text-text-4`,children:`Edit and Cancel are available on pending and failed tickets until you burn.`})]})}function u1({full:e,effective:t,events:n,mapRailCollapsed:r,onToggleMapRail:i}){return e.tickets.length===0?(0,R.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-1`,children:(0,R.jsx)(yQ,{featureId:e.feature.id,kind:`decisions`,docs:e.docs,mode:`static`})}):(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-1 gap-4`,children:[e.feature.mapped&&(0,R.jsx)(CQ,{full:e,relPath:J_(e),collapsed:r,onToggle:i,readonly:!0}),(0,R.jsx)(d1,{full:e})]})}function d1({full:e}){let t=B.settings.get.useQuery({projectId:e.feature.projectId});return(0,R.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:(0,R.jsx)(l1,{tickets:e.tickets,currentLap:e.feature.lap,roster:Bp(t.data),readonly:!0,docs:e.docs})})}function f1(){let e=qy(),[t,n]=(0,L.useState)(null),r=(0,L.useRef)(null);return(0,L.useEffect)(()=>{r.current=t?.preview??null},[t]),(0,L.useEffect)(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]),{staged:t,stage:async t=>{try{let e=await Wm(t),r={png:e,preview:URL.createObjectURL(e)};n(e=>(e&&URL.revokeObjectURL(e.preview),r))}catch(t){e.push(t instanceof Error?t.message:`that image could not be read`)}},drop:()=>{n(e=>(e&&URL.revokeObjectURL(e.preview),null))}}}function p1({preview:e,onDrop:t}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`img`,{src:e,alt:`the picture this note will carry`,className:`h-[54px] w-24 rounded-sm border border-hairline bg-black object-cover`}),(0,R.jsx)(J,{className:`px-2`,onClick:t,children:`Remove picture`})]})}function m1({onPick:e}){let t=(0,L.useRef)(null);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`input`,{ref:t,type:`file`,accept:`image/*`,className:`hidden`,"aria-label":`attach an image`,onChange:t=>{let n=t.target.files?.[0];n&&e(n),t.target.value=``}}),(0,R.jsx)(J,{className:`px-2`,onClick:()=>t.current?.click(),children:`Attach image`})]})}var h1=`min-h-16 w-full resize-y rounded-md border border-hairline bg-panel-inset px-3 py-2 font-mono text-sm text-text placeholder:text-text-4 focus:border-accent-line focus:outline-none`;function g1({featureId:e}){let t=B.useUtils(),n=qy(),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(!1),{staged:s,stage:c,drop:l}=f1(),[u,d]=(0,L.useState)(null),f=B.notes.add.useMutation(),p=e=>{s?d(e):c(e)},m=e=>{let t=Um(e.clipboardData);t&&(e.preventDefault(),p(t))},h=async()=>{if(!(!r.trim()||a)){o(!0);try{let a=s?.png,o=await vU({createNote:()=>f.mutateAsync({featureId:e,text:r}),uploadScreenshot:async e=>{a&&await Gm(e,a)}});o.uploadError&&n.push(`the note was saved, but its picture was not: ${o.uploadError}`),i(``),l(),t.notes.list.invalidate({featureId:e})}catch(e){n.push(e instanceof Error?e.message:`the note could not be saved`)}finally{o(!1)}}};return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,onPaste:m,children:[(0,R.jsx)(`textarea`,{"aria-label":`what did you just see?`,className:h1,placeholder:`What did you just see? Paste a screenshot straight in. (Enter saves, Shift+Enter for a new line)`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||(e.preventDefault(),h())}}),s&&(0,R.jsx)(p1,{preview:s.preview,onDrop:l}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(J,{variant:`solid`,disabled:!r.trim()||a,onClick:()=>void h(),children:a?`Adding…`:`Add`}),(0,R.jsx)(m1,{onPick:p})]}),(0,R.jsx)(v1,{open:!!u,onKeep:()=>d(null),onReplace:()=>{let e=u;d(null),e&&c(e)}})]})}function _1({note:e,onDone:t}){let n=B.useUtils(),r=qy(),[i,a]=(0,L.useState)(e.text),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(null),u=()=>void n.notes.list.invalidate({featureId:e.featureId}),d=B.notes.edit.useMutation({onSuccess:()=>{u(),t()},onError:e=>r.push(e.message)}),f=()=>{i.trim()&&!d.isPending&&d.mutate({noteId:e.id,text:i})},p=async t=>{s(!0);try{await Gm(e.id,await Wm(t)),u()}catch(e){r.push(e instanceof Error?e.message:`that picture could not be attached`)}finally{s(!1)}},m=t=>{e.screenshotUrl?l(t):p(t)};return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,onPaste:e=>{let t=Um(e.clipboardData);t&&(e.preventDefault(),m(t))},children:[(0,R.jsx)(`textarea`,{"aria-label":`edit this note`,className:h1,value:i,autoFocus:!0,onChange:e=>a(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),t();return}e.key!==`Enter`||e.shiftKey||(e.preventDefault(),f())}}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(J,{variant:`solid`,className:`px-2`,disabled:!i.trim()||d.isPending,onClick:f,children:`Save`}),(0,R.jsx)(J,{className:`px-2`,onClick:t,children:`Cancel`}),(0,R.jsx)(m1,{onPick:m}),o&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:`attaching…`})]}),(0,R.jsx)(v1,{open:!!c,onKeep:()=>l(null),onReplace:()=>{let e=c;l(null),e&&p(e)}})]})}function v1({open:e,onKeep:t,onReplace:n}){return(0,R.jsx)(RO,{open:e,onClose:t,size:`sm`,label:`Replace this note’s picture?`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,R.jsx)(`p`,{className:`m-0 text-base text-text`,children:`Replace this note’s picture?`}),(0,R.jsx)(`p`,{className:`m-0 text-sm text-text-3`,children:`A note carries one picture. Keep both by writing a second note.`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(J,{onClick:t,children:`Keep the old one`}),(0,R.jsx)(J,{variant:`danger`,onClick:n,children:`Replace`})]})]})})}function y1({note:e,onClose:t}){let n=B.useUtils(),r=qy(),i=B.notes.remove.useMutation({onSuccess:()=>{e&&n.notes.list.invalidate({featureId:e.featureId}),t()},onError:e=>{r.push(e.message),t()}});return(0,R.jsx)(RO,{open:!!e,onClose:t,size:`sm`,label:`Delete this note and its picture?`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,R.jsx)(`p`,{className:`m-0 text-base text-text`,children:`Delete this note and its picture?`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(J,{onClick:t,children:`Keep it`}),(0,R.jsx)(J,{variant:`danger`,disabled:i.isPending,onClick:()=>e&&i.mutate({noteId:e.id}),children:`Delete`})]})]})})}function b1(e,t,n){return t.has(e.id)?`open`:e.status===`dismissed`?`dismissed`:e.status===`carried`?`carried`:e.status===`fixed`||n?.status===`done`?`fixed`:n&&n.status!==`failed`&&n.status!==`cancelled`?`fixing`:e.status===`open`||e.status===`failed`?`open`:`fixing`}function x1(e,t){if(e.item.kind!==t.item.kind)return e.item.kind===`defect`?-1:1;let n=e.item.kind===`note`?e.item.note.createdAt:e.item.finding.createdAt;return(t.item.kind===`note`?t.item.note.createdAt:t.item.finding.createdAt)-n}function S1(e){let t=new Set(e.openDefects.map(e=>e.id)),n=t=>t?e.tickets.find(e=>e.id===t):void 0,r=[],i=[],a=(e,t,n)=>{(n?r:i).push({lap:bU(e),item:e,open:t})};for(let r of e.findings){if(r.kind!==`defect`)continue;let e=n(r.fixTicketId),i=b1(r,t,e);i!==`carried`&&a({kind:`defect`,finding:r,...i===`fixing`&&e?{fixTicket:{id:e.id,seq:e.seq}}:{}},i===`open`,i===`open`||i===`fixing`)}for(let t of e.notes){let e=n(t.ticketId??null);a({kind:`note`,note:t,...e?{ticket:{seq:e.seq,title:e.title}}:{}},t.status===`open`,t.status===`open`)}return r.sort(x1),i.sort(x1),{attention:r,settled:i}}function C1({featureId:e,rows:t,readonly:n,currentLap:r,onStage:i,onSeek:a,onViewLane:o,highlight:s,scrollTo:c,scroller:l}){let u=B.useUtils(),d=qy(),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(null),[g,_]=(0,L.useState)(null),v=e=>d.push(e.message),y=()=>void u.notes.list.invalidate({featureId:e}),b=()=>void u.findings.listByFeature.invalidate({featureId:e}),x=B.findings.dismiss.useMutation({onSuccess:b,onError:v}),S=B.findings.reopen.useMutation({onSuccess:b,onError:v}),C=B.notes.toggle.useMutation({onSuccess:y,onError:v}),w=B.notes.reopen.useMutation({onSuccess:y,onError:v}),T=C.isPending||w.isPending;(0,L.useEffect)(()=>{let e=l?.current;if(!c||!e)return;let t=document.getElementById(xU(c));if(!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();e.scrollBy({top:n.top-r.top-(r.height-n.height)/2,behavior:`smooth`})},[c,t,l]);let E=new Set(s??[]),D=e=>(0,R.jsx)(TU,{item:e.item,onStage:i,readonly:n,showLap:r===void 0,highlighted:E.has(yU(e.item)),editor:e.item.kind===`note`&&f===e.item.note.id?(0,R.jsx)(_1,{note:e.item.note,onDone:()=>p(null)}):void 0,controls:O(e),onSeek:a,onOpenImage:_,onViewLane:o},yU(e.item));function O(e){let{item:t}=e;if(t.kind===`defect`){let n=t.finding.id,r=(0,R.jsx)(J,{className:`px-2`,disabled:x.isPending,onClick:()=>x.mutate({findingId:n}),children:`Dismiss`});return t.finding.status===`carried`?(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(J,{className:`px-2`,disabled:S.isPending,onClick:()=>S.mutate({findingId:n}),children:`Reopen`}),r]}):e.open?r:void 0}let n=t.note;if(n.status!==`promoted`){if(n.status===`carried`)return(0,R.jsx)(J,{className:`px-2`,disabled:T,onClick:()=>w.mutate({noteId:n.id}),children:`Reopen`});if(f!==n.id)return(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 font-mono text-xs text-text-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`size-3.5 accent-accent`,checked:n.status===`done`,disabled:T,onChange:()=>C.mutate({noteId:n.id})}),`done`]}),n.status===`open`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(J,{className:`px-2`,onClick:()=>p(n.id),children:`Edit`}),(0,R.jsx)(J,{className:`px-2`,onClick:()=>h(n),children:`Delete`})]})]})}}return(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[r===void 0?t.map(e=>D(e)):(0,R.jsx)(qO,{groups:Kg(t,r),currentLap:r,meta:e=>`${e.rows.length} open`,children:e=>e.map(e=>D(e))}),(0,R.jsx)(lU,{url:g,onClose:()=>_(null)}),(0,R.jsx)(y1,{note:m,onClose:()=>h(null)})]})}function w1({featureId:e,findings:t,readonly:n}){if(t.length===0)return null;let r=t.map(e=>({lap:e.lap,item:{kind:`defect`,finding:e},open:!1}));return(0,R.jsxs)(`section`,{id:`carried-findings`,className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,R.jsx)(MO,{children:`Carried, still open`}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[t.length,` carried · not counted as open`]})]}),(0,R.jsx)(C1,{featureId:e,rows:r,readonly:n,onStage:null})]})}function T1({branch:e,conflict:t,readonly:n,liveSessionId:r,resolveEnded:i,busy:a,onResolve:o}){return n?null:(0,R.jsxs)(`div`,{className:`rounded-lg border border-danger/45 bg-panel p-4`,role:`alert`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(MO,{children:`Merge conflict`}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,title:t_(t.at),children:[`recorded `,c_(t.at)]})]}),(0,R.jsxs)(`p`,{className:`mt-2 mb-0 text-sm leading-relaxed text-text-2`,children:[`Merging `,(0,R.jsx)(`code`,{className:`font-mono`,children:t.base}),` into`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:e}),` hit conflicts. An agent can merge the base into this branch in the talk worktree, resolve with full spec context, and commit — then retry Merge & ship.`]}),t.files.length>0&&(0,R.jsx)(`ul`,{className:`mt-3 flex list-none flex-col gap-1 p-0`,children:t.files.map(e=>(0,R.jsx)(`li`,{className:`rounded-sm bg-danger/9 px-2 py-0.5 font-mono text-xs text-danger`,children:e},e))}),i&&(0,R.jsx)(`p`,{className:`mt-3 mb-0 rounded-sm border border-warn/45 bg-warn/8 px-3 py-2 text-sm leading-relaxed text-warn`,children:`The resolve session ended but the merge hasn’t landed — resolve by hand or retry.`}),(0,R.jsx)(J,{variant:`solid`,className:`mt-4`,disabled:a,onClick:o,children:r?`End session & resolve`:`Resolve with agent`}),r&&(0,R.jsx)(`div`,{className:`mt-2 text-xs leading-normal text-text-3`,children:`One terminal per feature — your live session will be closed to open the resolve session.`})]})}function E1({featureId:e,branch:t,conflict:n,readonly:r,liveSessionId:i,resolveEnded:a}){let o=tU(e,t);return(0,R.jsx)(T1,{branch:t,conflict:n,readonly:r,liveSessionId:i,resolveEnded:a,busy:o.pending,onResolve:()=>void o.resolve(n,i??void 0)})}function D1({text:e}){let t=e?.trim();return t?(0,R.jsxs)(`section`,{className:`flex flex-col gap-1 rounded-md border border-hairline bg-panel px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(MO,{children:`How to drive this app`}),(0,R.jsx)(`span`,{className:`flex-1`}),(0,R.jsx)(r1,{location:{page:`project`,field:`driveInstructions`},children:`Edit in settings`})]}),(0,R.jsx)(`p`,{className:`m-0 text-sm whitespace-pre-wrap text-text-2`,children:t}),(0,R.jsx)(`p`,{className:`m-0 text-xs text-text-3`,children:Yp})]}):null}function O1({featureId:e,label:t}){let n=B.useUtils(),r=qy(),i=B.feature.testDrive.useMutation({onSuccess:()=>{n.feature.driveInfo.invalidate(),n.feature.get.invalidate({id:e})},onError:e=>r.push(e.message)});return(0,R.jsx)(J,{className:`self-start`,disabled:i.isPending,onClick:()=>i.mutate({featureId:e,action:`stop`}),children:t})}function k1({featureId:e,failure:t,readonly:n}){let r=B.useUtils(),i=qy(),a=B.feature.fixDrive.useMutation({onSuccess:()=>{r.feature.get.invalidate({id:e}),r.events.invalidate()},onError:e=>i.push(e.message)});return(0,R.jsx)(A1,{failure:t,explanation:(0,R.jsxs)(R.Fragment,{children:[`The branch is checked out, but `,(0,R.jsx)(`code`,{className:`font-mono`,children:t.command}),` `,t.outcome,` — so whatever it was meant to bring up is probably not running. An agent can read this failure on your machine, repair the environment and retry the drive.`]}),children:!n&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.canFix&&(0,R.jsx)(J,{variant:`solid`,disabled:a.isPending,onClick:()=>a.mutate({featureId:e}),children:`Fix drive`}),(0,R.jsx)(O1,{featureId:e,label:`Stop test drive`})]})})}function A1({failure:e,explanation:t,children:n}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(MO,{children:`Drive setup failed`}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:t})]}),e.output&&(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-sm text-text-3`,children:`What the command printed`}),(0,R.jsx)(`pre`,{className:`mt-2 max-h-55 overflow-auto rounded-sm bg-danger/9 px-3 py-2.5 font-mono text-xs whitespace-pre-wrap text-text-2`,children:e.output})]}),n]})}function j1({branch:e,drive:t}){let[n,r]=(0,L.useState)(!1),i=mv(t);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t?.devPaneId&&(0,R.jsx)(`span`,{className:`inline-flex h-6 items-center rounded-pill border border-accent-line bg-accent-soft px-2 font-mono text-xs text-drive`,children:`dev server`}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:e}),i&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:i.state===`ready`?i.url:hv(i)}),(0,R.jsx)(`span`,{className:`flex-1`}),t?.devPaneId&&(0,R.jsx)(J,{className:`h-6 px-2 text-xs`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide output`:`Show output`})]}),n&&t?.devPaneId&&(0,R.jsx)(`div`,{className:`relative h-105 min-h-65 overflow-hidden rounded-md border border-hairline bg-bg`,children:(0,R.jsx)(MU,{label:`dev terminal`,children:(0,R.jsx)(cQ,{sessionId:t.devPaneId})})})]})}function M1(e){let t=e;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable===!0}function N1(e,t){let n=e?.expanded??!1,r=e?.set;(0,L.useEffect)(()=>{if(!t||!r)return;let e=e=>{M1(e.target)||e.metaKey||e.ctrlKey||e.altKey||(e.key===`f`||e.key===`F`?(e.preventDefault(),r(!n)):e.key===`Escape`&&n&&(e.preventDefault(),r(!1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,n,r])}var P1=(e=`pen`)=>({tool:e,shapes:[],redo:[],text:``});function F1(e,t){return{...e,shapes:[...e.shapes,{tool:e.tool,points:[t]}],redo:[]}}function I1(e,t){if(e.shapes.length===0)return e;let n=e.shapes.slice(),r=n[n.length-1];return n[n.length-1]={...r,points:[...r.points,t]},{...e,shapes:n}}function L1(e){return e}function R1(e){let t=e.shapes.at(-1);return t?{...e,shapes:e.shapes.slice(0,-1),redo:[...e.redo,t]}:e}function z1(e){let t=e.redo.at(-1);return t?{...e,shapes:[...e.shapes,t],redo:e.redo.slice(0,-1)}:e}var B1=e=>({...e,shapes:[],redo:[]}),V1=(e,t)=>({...e,tool:t}),H1=(e,t)=>({...e,text:t}),U1=e=>e.shapes.length>0||e.text.trim().length>0,W1=U1;function G1(e,t){switch(t.kind){case`begin`:return F1(e,t.point);case`extend`:return I1(e,t.point);case`commit`:return L1(e);case`undo`:return R1(e);case`redo`:return z1(e);case`clear`:return B1(e);case`tool`:return V1(e,t.tool);case`text`:return H1(e,t.text)}}var K1=[{tool:`pen`,label:`Pen`,key:`P`},{tool:`arrow`,label:`Arrow`,key:`A`},{tool:`rect`,label:`Rect`,key:`R`}],q1={p:`pen`,a:`arrow`,r:`rect`};function J1({video:e,timestamp:t,onSave:n,onCancel:r}){let[i,a]=(0,L.useReducer)(G1,void 0,()=>P1()),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(null),f=(0,L.useRef)(null),p=(0,L.useRef)(!1),m=e=>{let t=e.getBoundingClientRect();return t.width>0?e.width/t.width:1};(0,L.useEffect)(()=>{let t=f.current;if(!t)return;t.width!==e.videoWidth&&(t.width=e.videoWidth),t.height!==e.videoHeight&&(t.height=e.videoHeight);let n=t.getContext(`2d`);n&&(n.clearRect(0,0,t.width,t.height),dU(n,i.shapes,m(t)))},[i.shapes,e]);let h=e=>{let t=f.current;return t?gU(t.getBoundingClientRect(),{width:t.width,height:t.height},{x:e.clientX,y:e.clientY}):null},g=e=>{let t=h(e);t&&(f.current?.setPointerCapture?.(e.pointerId),p.current=!0,a({kind:`begin`,point:t}))},_=e=>{if(!p.current)return;let t=h(e);t&&a({kind:`extend`,point:t})},v=e=>{if(!p.current)return;p.current=!1;let t=f.current;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),a({kind:`commit`})},y=()=>{W1(i)?l(!0):r()},b=async()=>{let t=f.current;if(!(!U1(i)||o||!t)){s(!0),d(null);try{await n(await _U(document.createElement(`canvas`),e,i.shapes,m(t)),i.text.trim())}catch(e){d(e instanceof Error?e.message:`the annotated frame could not be saved`)}finally{s(!1)}}};return(0,L.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){e.preventDefault(),c?l(!1):y();return}let t=e.target;if(t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable===!0||e.metaKey||e.ctrlKey||e.altKey)return;let n=q1[e.key.toLowerCase()];n&&(e.preventDefault(),a({kind:`tool`,tool:n}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c,i,r]),(0,R.jsxs)(`div`,{className:`absolute inset-0 z-20`,"data-testid":`annotation-overlay`,children:[(0,R.jsx)(`canvas`,{ref:f,"aria-label":`draw on this frame`,className:`absolute inset-0 h-full w-full cursor-crosshair touch-none`,onPointerDown:g,onPointerMove:_,onPointerUp:v,onPointerCancel:v}),(0,R.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 flex flex-wrap items-center gap-2 p-2`,children:[(0,R.jsx)(`div`,{className:`pointer-events-auto flex items-center gap-1 rounded-md border border-hairline bg-panel/90 p-1`,children:K1.map(({tool:e,label:t,key:n})=>(0,R.jsxs)(J,{"aria-pressed":i.tool===e,className:i.tool===e?`border-accent-line bg-accent-soft px-2 text-accent`:`px-2`,onClick:()=>a({kind:`tool`,tool:e}),children:[t,` `,(0,R.jsx)(BO,{children:n})]},e))}),(0,R.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-1 rounded-md border border-hairline bg-panel/90 p-1`,children:[(0,R.jsx)(J,{className:`px-2`,disabled:i.shapes.length===0,onClick:()=>a({kind:`undo`}),children:`Undo`}),(0,R.jsx)(J,{className:`px-2`,disabled:i.redo.length===0,onClick:()=>a({kind:`redo`}),children:`Redo`}),(0,R.jsx)(J,{className:`px-2`,disabled:i.shapes.length===0,onClick:()=>a({kind:`clear`}),children:`Clear`})]}),(0,R.jsx)(`span`,{className:`pointer-events-none rounded-md bg-panel/90 px-2 py-1 font-mono text-xs text-text-3`,children:Vd(t)})]}),(0,R.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 flex flex-col gap-2 bg-panel/90 p-3`,children:[u&&(0,R.jsx)(`p`,{className:`text-sm text-danger`,role:`alert`,children:u}),(0,R.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,R.jsx)(`textarea`,{"aria-label":`what’s wrong in this frame?`,className:`h-16 min-w-0 flex-1 resize-none rounded-md border border-hairline bg-panel-inset px-3 py-2 font-mono text-sm text-text placeholder:text-text-4 focus:border-accent-line focus:outline-none`,placeholder:`What’s wrong in this frame? (optional — a drawing alone saves)`,value:i.text,autoFocus:!0,onChange:e=>a({kind:`text`,text:e.target.value}),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||(e.preventDefault(),b())}}),(0,R.jsx)(J,{variant:`solid`,disabled:!U1(i)||o,onClick:()=>void b(),children:o?`Saving…`:`Save note`}),(0,R.jsx)(J,{onClick:y,children:`Cancel`})]})]}),(0,R.jsx)(RO,{open:c,onClose:()=>l(!1),size:`sm`,label:`Discard this annotation?`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,R.jsx)(`p`,{className:`text-base text-text`,children:`Discard this annotation?`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(J,{onClick:()=>l(!1),children:`Keep editing`}),(0,R.jsx)(J,{variant:`danger`,onClick:r,children:`Discard`})]})]})})]})}var Y1=[.5,.75,1,1.25,1.5,1.75,2],X1=1.5,Z1=5,Q1=1/30;function $1(e,t){let n=Y1.indexOf(e);return Y1[((n===-1?Y1.indexOf(X1):n)+t+Y1.length)%Y1.length]}function e0({url:e,featureId:t,ticketId:n,passKind:r,readonly:i,frameClassName:a,expand:o,markers:s=[],onMarkerClick:c,onAnnotationSaved:l,onDuration:u,handleRef:d}){let f=B.useUtils(),p=qy(),m=(0,L.useRef)(null),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(0),[y,b]=(0,L.useState)(0),[x,S]=(0,L.useState)(X1),[C,w]=(0,L.useState)(`loading`),[T,E]=(0,L.useState)(null),[D,O]=(0,L.useState)(!1),[k,A]=(0,L.useState)(null),j=B.notes.add.useMutation({onError:e=>p.push(e.message)});(0,L.useEffect)(()=>{let t=!0;return fetch(e,{method:`HEAD`}).then(e=>{let n=Number(e.headers.get(`content-length`));t&&Number.isFinite(n)&&n>0&&E(n)}).catch(()=>void 0),()=>{t=!1}},[e]);let M=(0,L.useCallback)(e=>{let t=m.current;if(!t)return;let n=hU(e,{playable:mU(t),annotating:D});n!==null&&(t.currentTime=n,v(n))},[D]),N=(0,L.useCallback)(e=>{m.current?.pause(),M(e)},[M]);(0,L.useEffect)(()=>{if(d)return d.current={seek:N,pause:()=>m.current?.pause(),getTicketId:()=>n},()=>{d.current=null}},[d,N,n]);let P=(0,L.useCallback)(()=>{let e=m.current;!e||D||C!==`ready`||(e.paused?e.play().catch(()=>p.push(`the browser refused to play this recording`)):e.pause())},[D,C,p]),F=(0,L.useCallback)(e=>{let t=m.current;t&&M(t.currentTime+e)},[M]),ee=(0,L.useCallback)(e=>{let t=m.current;t?.paused&&M(t.currentTime+e)},[M]),te=(0,L.useCallback)(e=>{S(e);let t=m.current;t&&(t.playbackRate=e)},[]),ne=()=>{C===`ready`&&(m.current?.pause(),O(!0))};N1(o,!D),(0,L.useEffect)(()=>{if(D)return;let e=e=>{if(M1(e.target)||e.metaKey||e.ctrlKey||e.altKey)return;let t=()=>e.preventDefault();switch(e.key){case` `:case`k`:case`K`:return t(),P();case`j`:case`J`:case`ArrowLeft`:return t(),F(-5);case`l`:case`L`:case`ArrowRight`:return t(),F(Z1);case`,`:return t(),ee(-.03333333333333333);case`.`:return t(),ee(Q1);case`<`:return t(),te($1(x,-1));case`>`:return t(),te($1(x,1))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[D,P,F,ee,te,x]);let I=()=>{w(`loading`),m.current?.load()},re=async(e,r)=>{let i=m.current;if(!i)return;let a=i.currentTime,o=await vU({createNote:()=>j.mutateAsync({featureId:t,text:r||`Annotated ${Vd(a)}`,videoTimestamp:a,reviewTicketId:n}),uploadScreenshot:t=>Gm(t,e)});f.notes.list.invalidate({featureId:t}),o.uploadError&&p.push(`the note was saved, but its annotated frame was not: ${o.uploadError}`),O(!1),l?.(o.note.id)},ie=e=>{let t=mU(e);b(t),u?.(t)},ae=y>0&&!D&&C===`ready`,oe=T===null?`Loading the recording`:`Loading the recording — ${o_(T)}`;return(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:a,children:[(0,R.jsx)(`video`,{ref:m,className:`min-h-0 w-full flex-1 object-contain`,src:e,preload:`metadata`,"aria-label":r===`verification`?`verification walkthrough`:`review walkthrough`,onClick:P,onLoadedMetadata:e=>{let t=e.currentTarget;ie(t),t.playbackRate=x,t.currentTime===0&&(t.currentTime=.01)},onDurationChange:e=>ie(e.currentTarget),onProgress:e=>ie(e.currentTarget),onCanPlay:()=>w(e=>e===`error`?e:`ready`),onError:()=>w(`error`),onTimeUpdate:e=>v(e.currentTarget.currentTime),onPlay:()=>g(!0),onPause:()=>g(!1),onEnded:()=>g(!1)}),C===`loading`&&(0,R.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 bg-bg/55`,children:[(0,R.jsx)(`span`,{className:`h-6 w-6 animate-spin rounded-pill border-2 border-hairline border-t-accent`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`text-sm text-text-2`,children:oe})]}),C===`error`&&(0,R.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 bg-bg/85 px-4 text-center`,role:`alert`,children:[(0,R.jsx)(`span`,{className:`text-base text-text`,children:`This recording can’t be played (file may be corrupt)`}),(0,R.jsx)(`code`,{className:`max-w-full truncate font-mono text-xs text-text-3`,children:e}),(0,R.jsx)(J,{onClick:I,children:`Retry`})]}),D&&m.current&&(0,R.jsx)(J1,{video:m.current,timestamp:_,onSave:re,onCancel:()=>O(!1)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(J,{className:`w-11 px-0 font-mono`,disabled:D||C!==`ready`,"aria-label":h?`pause`:`play`,onClick:P,children:h?`❚❚`:`▶`}),(0,R.jsxs)(`div`,{className:`relative flex-1`,onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();t.width<=0||y<=0||A((e.clientX-t.left)/t.width*y)},onMouseLeave:()=>A(null),children:[(0,R.jsx)(`input`,{type:`range`,className:`h-1 w-full cursor-pointer accent-accent disabled:cursor-default disabled:opacity-50`,min:0,step:1,max:y||1,value:Math.min(_,y||1),disabled:!ae,"aria-label":`scrub the walkthrough`,onChange:e=>M(Number(e.target.value))}),k!==null&&(0,R.jsx)(`span`,{className:`pointer-events-none absolute -top-6 -translate-x-1/2 rounded-sm border border-hairline bg-panel px-1.5 font-mono text-xs text-text-2`,style:{left:`${Math.min(100,Math.max(0,k/(y||1)*100))}%`},children:Vd(k)}),y>0&&s.map(e=>(0,R.jsx)(`button`,{type:`button`,className:`absolute -top-1.5 h-4 w-4 -translate-x-1/2 rounded-pill border-0 bg-danger text-xs leading-4 text-accent-ink`,style:{left:`${Math.min(100,e.at/y*100)}%`},"aria-label":`${e.noteIds.length} note${e.noteIds.length>1?`s`:``} at ${Vd(e.at)}`,onClick:()=>{N(e.at),c?.(e.noteIds)},children:e.noteIds.length>1?e.noteIds.length:``},e.at))]}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[Vd(_),` / `,Vd(y)]}),(0,R.jsxs)(J,{className:`px-2 font-mono`,"aria-label":`playback speed ${x}×`,onClick:()=>te($1(x,1)),children:[x,`×`]}),!i&&!D&&(0,R.jsx)(J,{onClick:ne,children:`Annotate`})]})]})}function t0(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function n0(e,t,n,r){let i=r>0&&n>0?n/r:1;return{x:Math.round((e.x+t.left)*i),y:Math.round((e.y+t.top)*i),width:Math.round(e.width*i),height:Math.round(e.height*i)}}function r0(e){return e.width>=8&&e.height>=8}function i0(e){return e?typeof e.mediaDevices?.getDisplayMedia==`function`&&`userAgentData`in e:!1}var a0=6e3,o0=120;function s0(e){return new Promise(t=>{if(typeof e.requestVideoFrameCallback==`function`){e.requestVideoFrameCallback(()=>t());return}setTimeout(t,o0)})}function c0({url:e,agentDriving:t=!1,readonly:n=!1,...r}){let i=qy(),a=B.useUtils(),o=B.notes.add.useMutation(),s=(0,L.useRef)(null),c=(0,L.useRef)(null),l=(0,L.useRef)(null),[u]=(0,L.useState)(()=>!n&&i0(typeof navigator>`u`?void 0:navigator)),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(null),_=(0,L.useRef)(null),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(``),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(!1),[E,D]=(0,L.useState)(!1),[O,k]=(0,L.useState)(0);(0,L.useEffect)(()=>{T(!1),D(!1);let e=setTimeout(()=>D(!0),a0);return()=>clearTimeout(e)},[e,O]),(0,L.useEffect)(()=>()=>{l.current?.getTracks().forEach(e=>e.stop()),l.current=null},[]),(0,L.useEffect)(()=>()=>URL.revokeObjectURL(v?.preview??``),[v]);let A=async()=>{if(!l.current){f(!0);try{let e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`});l.current=e,e.getVideoTracks().forEach(t=>{t.addEventListener(`ended`,()=>{l.current===e&&(l.current=null)})});let t=c.current;t&&(t.srcObject=e,await t.play())}catch(e){i.push(e instanceof Error&&e.name===`NotAllowedError`?`tab sharing was declined — nothing to capture from`:`tab capture failed: ${e instanceof Error?e.message:String(e)}`);return}finally{f(!1)}}m(!0)},j=async e=>{let t=s.current,n=c.current;if(!t||!n)return;if(await new Promise(requestAnimationFrame),await new Promise(requestAnimationFrame),await s0(n),!n.videoWidth){i.push(`the tab is no longer being shared — click Select area again`),l.current=null;return}let r=n0(e,t.getBoundingClientRect(),n.videoWidth,window.innerWidth),a=document.createElement(`canvas`);a.width=r.width,a.height=r.height;let o=a.getContext(`2d`);if(!o)return;o.drawImage(n,r.x,r.y,r.width,r.height,0,0,r.width,r.height);let u=await new Promise(e=>a.toBlob(e,`image/png`));if(!u){i.push(`the selected region could not be turned into a picture`);return}x(``),y({png:u,preview:URL.createObjectURL(u)})},M=e=>{let t=s.current?.getBoundingClientRect();t&&(_.current={x:e.clientX-t.left,y:e.clientY-t.top},e.currentTarget.setPointerCapture?.(e.pointerId))},N=e=>{let t=s.current?.getBoundingClientRect();!_.current||!t||g(t0(_.current,{x:e.clientX-t.left,y:e.clientY-t.top}))},P=e=>{let t=s.current?.getBoundingClientRect(),n=_.current;if(_.current=null,!n||!t)return;let r=t0(n,{x:e.clientX-t.left,y:e.clientY-t.top});m(!1),g(null),r0(r)&&j(r)},F=()=>{y(null),x(``)},ee=async()=>{if(!v||S)return;C(!0);let e=b.trim()||`Screenshot from the test drive`;try{let t;if(r.projectId!==void 0){let n=r.projectId;t=await vU({createNote:()=>a.client.projectNotes.add.mutate({projectId:n,text:e}),uploadScreenshot:e=>Yy(e,v.png)}),a.projectNotes.invalidate()}else{let n=r.featureId;t=await vU({createNote:()=>o.mutateAsync({featureId:n,text:e}),uploadScreenshot:e=>Gm(e,v.png)}),a.notes.list.invalidate({featureId:n})}t.uploadError&&i.push(`the note was saved, but its screenshot was not: ${t.uploadError}`),F()}catch(e){i.push(e instanceof Error?e.message:`the note could not be saved`)}finally{C(!1)}};return(0,R.jsxs)(`div`,{ref:s,className:`relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-hairline bg-black`,children:[(0,R.jsx)(`iframe`,{className:`min-h-0 flex-1 border-0 bg-white`,src:e,title:`the app on this branch`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,onLoad:()=>T(!0)},O),(0,R.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 flex flex-wrap items-center gap-2 p-2`,children:[(0,R.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-1 rounded-md border border-hairline bg-panel/90 p-1`,children:[u?(0,R.jsx)(J,{className:`px-2`,"aria-pressed":p,disabled:d,onClick:()=>void A(),children:d?`Sharing…`:p?`Drag a region`:`Select area`}):(0,R.jsx)(`span`,{className:`px-2 font-mono text-xs text-text-3`,children:`this browser can’t capture its own tab — paste a screenshot into a note instead`}),(0,R.jsx)(J,{className:`px-2`,onClick:()=>k(e=>e+1),children:`Reload`}),(0,R.jsx)(`a`,{className:`inline-flex h-8 items-center rounded-md border border-hairline px-2 font-mono text-xs text-text-2 no-underline hover:border-hairline-strong hover:text-text`,href:e,target:`_blank`,rel:`noreferrer noopener`,children:`Open app ↗`})]}),t&&(0,R.jsxs)(`span`,{className:`pointer-events-none flex items-center gap-2 rounded-md bg-panel/90 px-2 py-1 text-sm text-drive`,children:[(0,R.jsx)(`span`,{className:`size-2 animate-pulse rounded-pill bg-drive`}),`review agent driving — notes land below as it finds things`]}),!w&&E&&(0,R.jsx)(`span`,{className:`pointer-events-none rounded-md bg-panel/90 px-2 py-1 font-mono text-xs text-text-3`,children:`Can’t embed? Open app ↗ and paste a screenshot into a note.`})]}),p&&(0,R.jsx)(`div`,{className:`absolute inset-0 z-10 cursor-crosshair touch-none bg-bg/15`,"aria-label":`drag over the part of the app that needs fixing`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:h&&(0,R.jsx)(`div`,{className:`absolute border-2 border-danger bg-danger/15`,style:{left:h.x,top:h.y,width:h.width,height:h.height}})}),v&&(0,R.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 z-20 flex items-end gap-3 bg-panel/95 p-3`,children:[(0,R.jsx)(`img`,{className:`h-14 w-24 rounded-sm border border-hairline bg-black object-contain`,src:v.preview,alt:`the region you selected`}),(0,R.jsx)(`textarea`,{"aria-label":`what’s wrong here?`,className:`h-16 min-w-0 flex-1 resize-none rounded-md border border-hairline bg-panel-inset px-3 py-2 font-mono text-sm text-text placeholder:text-text-4 focus:border-accent-line focus:outline-none`,placeholder:`What’s wrong here? (optional — the picture is the note)`,value:b,autoFocus:!0,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||(e.preventDefault(),ee())}}),(0,R.jsx)(J,{variant:`solid`,disabled:S,onClick:()=>void ee(),children:S?`Saving…`:`Save note`}),(0,R.jsx)(J,{onClick:F,children:`Discard`})]}),u&&(0,R.jsx)(`video`,{ref:c,muted:!0,playsInline:!0,className:`hidden`})]})}var l0=`No walkthrough was recorded for this feature — the review reported without driving.`;function u0(e,t){return Cv(e).stageKind===`player`&&t?`player`:`drive`}function d0(e,t){return`relative flex w-full flex-col rounded-md border border-hairline ${e?`min-h-0 flex-1`:`aspect-video max-h-[calc(100vh-320px)]`} ${t===`screen`?`overflow-hidden bg-black`:`overflow-auto bg-panel-2 p-4`}`}function f0(e,t,n){let r=[`Lap ${e.lap}`,e.passKind===`verification`?`Verification walkthrough`:`Walkthrough`];return t!==null&&t>0&&r.push(Vd(t)),e.passKind===`verification`&&n!==null&&n>0&&r.push(`confirms ${n} fix${n===1?``:`es`}`),r.push(e.landedSince===0?`this build`:`reviewed ${e.reviewedCommit?e.reviewedCommit.slice(0,7):`an earlier build`}`),r.join(` · `)}function p0({featureId:e,branch:t,recordings:n,picked:r=null,notes:i,readonly:a,driveState:o,drive:s,dryRun:c,failure:l,expand:u,handleRef:d,onStageRecording:f,onMarkerClick:p,onAnnotationSaved:m}){let[h,g]=(0,L.useState)(null),_=Vv(n),v=n.find(e=>e.ticketId===r)??_,y=u0(o,!!v?.videoUrl);(0,L.useEffect)(()=>g(null),[v?.ticketId]);let b=v?n.indexOf(v):-1,x=b>0?n[b-1]:void 0,S=v&&x?x.landedSince-v.landedSince:null,C=Cv(o),w=C.stageKind===`panel`||C.stageKind===`agent`,T=y===`player`&&v?.videoUrl?v.ticketId:null;(0,L.useEffect)(()=>{f?.(T?{ticketId:T}:null)},[f,T]),N1(u,y!==`player`);let E=u?.expanded??!1;return(0,R.jsxs)(`section`,{id:`evidence-stage`,className:`flex min-h-0 flex-1 flex-col gap-2`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[v&&(0,R.jsx)(`span`,{className:`font-mono text-sm text-text-2`,title:v.passKind===`verification`?`the fix count is derived from what landed between the two passes`:void 0,children:f0(v,h,S)}),u&&(0,R.jsxs)(J,{className:`ml-auto px-2`,"aria-pressed":E,onClick:()=>u.set(!E),children:[E?`Collapse`:`Expand`,` `,(0,R.jsx)(BO,{children:`F`})]})]}),y===`player`&&v?.videoUrl?(0,R.jsx)(e0,{url:v.videoUrl,featureId:e,ticketId:v.ticketId,passKind:v.passKind,readonly:a,frameClassName:d0(E,`screen`),expand:u,markers:pU(i,v.ticketId),onMarkerClick:p,onAnnotationSaved:m,onDuration:g,handleRef:d},v.ticketId):(0,R.jsx)(`div`,{className:d0(E,w?`screen`:`prose`),children:(0,R.jsx)(m0,{featureId:e,branch:t,driveState:o,drive:s,dryRun:c,failure:l,hasRecording:!!v?.videoUrl,readonly:a})}),C.footer.showDevChip&&(0,R.jsx)(j1,{branch:s?.branch??t,drive:s})]})}function m0({featureId:e,branch:t,driveState:n,drive:r,dryRun:i,failure:a,hasRecording:o,readonly:s}){if(n===`idle`)return i?(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`A preparation dry-run is holding the drive — it is proving this project’s drive commands on your machine. Stop it from Preparation, and this branch can take the wheel.`}):o?(0,R.jsx)(`div`,{className:`font-mono text-sm text-text-3`,children:t}):(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`Starting the test drive — the branch is being checked out.`});let c=s?null:(0,R.jsx)(O1,{featureId:e,label:`Stop test drive`});switch(Cv(n).stageKind){case`starting`:return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,R.jsx)(`span`,{className:`size-2 animate-pulse rounded-pill bg-drive`}),(0,R.jsx)(`span`,{className:`text-sm font-semibold text-drive`,children:`starting the dev server…`}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-2`,children:r?.branch??t})]}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`The branch is checked out and the project’s dev command is running. The app appears here as soon as it answers — its output is under the stage.`})]});case`failed`:return a?(0,R.jsx)(k1,{featureId:e,failure:a,readonly:s}):(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`The drive’s setup command failed — its output is in the timeline.`});case`bare`:return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsx)(`div`,{className:`text-sm font-semibold text-text`,children:`Branch checked out — nothing started.`}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:s?`This project had no dev command, so the drive checked the branch out and started nothing.`:(0,R.jsxs)(R.Fragment,{children:[`This project has no dev command ·`,` `,(0,R.jsx)(r1,{location:{page:`project`,field:`devCommand`},children:`Set one in Settings`}),` `,`and the next drive boots the app right here.`]})}),c]});case`agent`:return(0,R.jsxs)(R.Fragment,{children:[r?.devUrl?(0,R.jsx)(c0,{featureId:e,url:r.devUrl,agentDriving:!0,readonly:s}):(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,R.jsx)(`span`,{className:`size-2 animate-pulse rounded-pill bg-drive`}),(0,R.jsx)(`span`,{className:`text-sm font-semibold text-drive`,children:`review agent driving`}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-2`,children:r?.branch??t})]}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`Notes land below as it finds things. No dev server answered, so there is nothing to show here.`})]}),!s&&(0,R.jsx)(`div`,{className:`p-2`,children:(0,R.jsx)(O1,{featureId:e,label:`Stop the review drive`})})]});default:return r?.devUrl?(0,R.jsx)(c0,{featureId:e,url:r.devUrl,readonly:s}):(0,R.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`The dev server is up but has not printed an address yet — its output is under the stage.`})}}function h0({account:e,tickets:t,observations:n=[],carried:r}){let i=t.filter(e=>(e.digest??``).trim().length>0).sort((e,t)=>e.seq-t.seq),a=!!e||i.length>0;return!a&&!r&&n.length===0?null:(0,R.jsxs)(`details`,{id:`full-accounts`,className:`rounded-lg border border-hairline bg-panel`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer list-none px-4 py-3 text-sm text-text-2`,children:[`Full account — `,[a?`digest`:null,r?`carried`:null,n.length>0?`${n.length} observation${n.length===1?``:`s`}`:null].filter(e=>e!==null).join(` · `)]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 border-t border-hairline-soft px-4 py-4`,children:[e&&(0,R.jsx)(_0,{account:e}),i.length>0&&(0,R.jsxs)(`section`,{children:[(0,R.jsx)(MO,{children:`Ticket digests`}),(0,R.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:i.map(e=>(0,R.jsxs)(`div`,{className:`border-t border-hairline-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,R.jsxs)(`div`,{className:`font-mono text-xs text-text-2`,children:[`#`,e.seq,` `,e.title,` · lap `,e.lap,e.kind===`review`?e.passKind===`verification`?` · verification pass`:` · review pass`:``]}),(0,R.jsx)(AH,{source:e.digest.trim(),className:`mt-2`})]},e.seq))})]}),r&&(0,R.jsxs)(`section`,{children:[(0,R.jsx)(MO,{children:`Carried, quick-fixed and handled`}),(0,R.jsx)(`div`,{className:`mt-3`,children:r})]}),n.length>0&&(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(MO,{children:[`Observations (`,n.length,`)`]}),(0,R.jsx)(`ul`,{className:`m-0 mt-3 flex list-none flex-col gap-1.5 p-0`,children:n.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col`,children:[(0,R.jsx)(`span`,{className:`text-sm text-text-2`,children:e.title}),(0,R.jsx)(g0,{detail:e.detail})]},e.id))})]})]})]})}function g0({detail:e}){let{head:t,rest:n}=iy(e);return n?(0,R.jsxs)(`details`,{className:`min-w-0`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer list-none text-sm text-text-3 underline decoration-dotted`,children:t}),(0,R.jsx)(`p`,{className:`m-0 mt-1.5 text-sm leading-relaxed text-pretty text-text-2`,children:n})]}):(0,R.jsx)(`span`,{className:`text-sm text-text-3`,children:t})}function _0({account:e}){return(0,R.jsxs)(`section`,{children:[(0,R.jsx)(MO,{children:`What landed this lap`}),e.source===`review`?(0,R.jsx)(AH,{source:e.prose,className:`mt-3`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`mt-3 text-sm text-text-3`,children:`No review summary this lap — below is each burner’s own account of the ticket it ran.`}),(0,R.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:e.entries.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`font-mono text-xs text-text-2`,children:[`#`,e.seq,` `,e.title]}),(0,R.jsx)(AH,{source:e.digest,className:`mt-2`})]},e.seq))})]})]})}function v0({featureId:e,line:t,readonly:n,onOpen:r}){if(n)return null;let{phase:i}=t;return(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md border border-hairline border-l-2 border-l-accent-line bg-panel-2 px-3 py-2 text-sm text-text-2`,role:`status`,children:[(0,R.jsx)(uk,{status:`live`}),(0,R.jsx)(`span`,{children:t.text}),(0,R.jsx)(`span`,{className:`flex-1`}),i&&r&&(0,R.jsx)(J,{className:`h-7 px-2 text-xs`,onClick:()=>r(i),children:`Open`}),(0,R.jsx)(jU,{featureId:e,sessionId:t.sessionId})]})}function y0({lap:e,outcome:t,agenticReview:n}){return(0,R.jsxs)(`div`,{className:`rounded-lg border border-warn/45 bg-panel p-4`,role:`alert`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(MO,{children:`Nothing verified this lap`}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[`lap `,e]})]}),(0,R.jsx)(`p`,{className:`mt-2 mb-0 text-sm leading-relaxed text-text-2`,children:`The review pass ran and produced no evidence, so nothing on this branch has been checked this lap. Nothing is blocked — run another review, or drive it yourself, before you ship.`}),t.line&&(0,R.jsx)(`p`,{className:`mt-3 mb-0 font-mono text-xs break-words text-warn`,children:t.line}),t.reason&&(0,R.jsx)(`p`,{className:`mt-2 mb-0 font-mono text-xs break-words text-text-3`,children:t.reason}),n&&(0,R.jsx)(`div`,{className:`mt-4`,children:(0,R.jsx)(J,{variant:`solid`,disabled:!!n.blocked,...n.blocked?{title:n.blocked}:{},onClick:n.onStart,children:`Agentic review`})})]})}var b0={key:`runcastle.notesrail.w`,min:260,max:560,default:360};function x0(e){return tb(b0,e)}function S0(){return ib(b0)}function C0({featureId:e,lap:t,rows:n,readonly:r,onStage:i,onSeek:a,onViewLane:o,highlight:s,scrollTo:c}){let l=n.filter(e=>e.item.kind===`defect`&&e.item.fixTicket).length,u=[`${n.length-l} open`];l>0&&u.push(`${l} being fixed`);let d=(0,L.useRef)(null);return(0,R.jsxs)(`section`,{id:`open-work`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`flex flex-none items-baseline gap-3 border-b border-hairline-soft px-4 py-3`,children:[(0,R.jsx)(MO,{children:`What still needs attention`}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:u.join(` · `)})]}),(0,R.jsx)(`div`,{ref:d,className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:n.length===0?(0,R.jsx)(PO,{compact:!0,title:`Nothing needs attention`,hint:r?`Nothing was left open when this feature shipped.`:`The review found nothing open and you have written no notes. Take a test drive and write what you see.`}):(0,R.jsx)(C1,{featureId:e,rows:n,readonly:r,currentLap:t,onStage:i,onSeek:a,onViewLane:o,highlight:s,scrollTo:c,scroller:d})}),!r&&(0,R.jsx)(`div`,{className:`flex-none border-t border-hairline px-4 py-3`,children:(0,R.jsx)(g1,{featureId:e})})]})}function w0(e){let{width:t,setWidth:n}=S0();return(0,R.jsxs)(`aside`,{className:`relative flex min-h-0 w-(--notes-rail-w) flex-none flex-col border-l border-hairline bg-panel-2`,style:{"--notes-rail-w":`${t}px`},children:[(0,R.jsx)(eM,{width:t,side:`right`,label:`Resize the notes rail`,clamp:x0,onResize:n}),(0,R.jsx)(C0,{...e})]})}function T0({projectId:e,holderLabel:t}){let n=B.useUtils(),r=qy(),i=B.project.testDrive.useMutation({onSuccess:()=>void n.feature.driveInfo.invalidate(),onError:e=>r.push(e.message)});return(0,R.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-text-2`,role:`status`,children:[(0,R.jsxs)(`span`,{children:[gv(t),` is running`]}),(0,R.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,R.jsx)(J,{size:`xs`,disabled:i.isPending,onClick:()=>i.mutate({projectId:e,action:`stop`}),children:i.isPending?`Stopping…`:`Stop it`})]})}function E0({denial:e,readonly:t,primary:n,busy:r,refusal:i,onReview:a,onDismiss:o}){return t?null:(0,R.jsxs)(`div`,{className:`rounded-lg border border-warn/45 bg-panel p-4`,role:`alert`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(MO,{children:`Review couldn’t drive — uncommitted changes`}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,title:t_(e.at),children:[`denied `,c_(e.at)]})]}),(0,R.jsx)(`p`,{className:`mt-2 mb-0 text-sm leading-relaxed text-text-2`,children:`The drive was refused because the working tree had uncommitted changes, so the review ran repo-only — the gates and the diff, with no app to walk. Commit or discard the files below, then run another review: a fresh pass is minted for this lap and burns with the drive available to it.`}),e.dirtyFiles.length>0?(0,R.jsx)(`ul`,{className:`mt-3 flex list-none flex-col gap-1 p-0`,children:e.dirtyFiles.map(e=>(0,R.jsx)(`li`,{className:`rounded-sm bg-warn/8 px-2 py-0.5 font-mono text-xs text-warn`,children:e},e))}):(0,R.jsx)(`p`,{className:`mt-3 mb-0 font-mono text-xs break-words text-text-3`,children:e.message}),i&&(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(FO,{message:i})}),(0,R.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,R.jsx)(J,{variant:n?`solid`:`ghost`,disabled:r,onClick:a,children:r?`Starting…`:`Agentic review`}),(0,R.jsx)(J,{onClick:o,children:`Dismiss`})]})]})}function D0({featureId:e,denial:t,readonly:n,primary:r,onDismiss:i}){let a=B.useUtils(),[o,s]=(0,L.useState)(null),c=B.feature.agenticReview.useMutation({onSuccess:()=>{a.feature.get.invalidate({id:e}),a.events.invalidate()},onError:e=>s(e.message)});return(0,R.jsx)(E0,{denial:t,readonly:n,primary:r,busy:c.isPending,refusal:o,onReview:()=>{s(null),c.mutate({featureId:e})},onDismiss:i})}var O0=`inline-flex items-center rounded-pill border bg-panel px-3 py-1 font-mono text-xs`;function k0(e){switch(e.kind){case`verified`:return{label:e.mode?`Verified · ${e.mode}`:`Verified`,className:`border-ok/45 text-ok`};case`unverified`:return{label:`Unverified`,className:`border-warn/45 text-warn`};case`could-not-run`:return{label:`Could not run`,className:`border-warn/45 text-warn`};case`none`:return null}}function A0(e){let t=[e.passKind===`verification`?`verification`:`review`];return e.mode&&t.push(`${e.mode} mode`),e.couldNotRun?t.push(`could not run`):e.verdict&&t.push(e.verdict),t.join(` · `)}function j0({entry:e,staged:t,onStage:n,onViewRun:r}){let i=k0(e.outcome),{found:a,fixed:o,carried:s}=e.defects;return(0,R.jsxs)(`li`,{className:`rounded-lg border border-hairline bg-panel p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1.5`,children:[(0,R.jsxs)(`span`,{className:`text-sm font-semibold text-text`,children:[`Lap `,e.lap]}),e.completedAt!==null&&(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,title:t_(e.completedAt),children:[`reviewed `,c_(e.completedAt)]}),i&&(0,R.jsx)(`span`,{className:`${O0} ${i.className}`,children:i.label}),(0,R.jsx)(`span`,{className:`flex-1`}),r?(0,R.jsxs)(J,{size:`xs`,onClick:r,children:[e.burned,` ticket`,e.burned===1?``:`s`,` burned`]}):(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[e.burned,` ticket`,e.burned===1?``:`s`,` burned`]})]}),e.outcome.kind===`unverified`&&(0,R.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[e.outcome.line&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-warn`,children:e.outcome.line}),e.outcome.reason&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:e.outcome.reason})]}),e.passes.length>0&&(0,R.jsx)(`ul`,{className:`mt-3 flex list-none flex-col gap-1 p-0`,children:e.passes.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-2`,children:[`#`,e.seq,` · `,A0(e)]}),e.videoUrl&&(0,R.jsx)(J,{size:`xs`,"aria-pressed":t===e.ticketId,onClick:()=>n(e.ticketId),children:`Recording`})]},e.ticketId))}),(0,R.jsxs)(`div`,{className:`mt-3 font-mono text-xs text-text-3`,children:[a,` defect`,a===1?``:`s`,` found · `,o,` fixed · `,s,` carried ·`,` `,e.notes,` test note`,e.notes===1?``:`s`]})]})}function M0({passes:e,tickets:t,findings:n,notes:r,currentLap:i,staged:a,onStage:o,onViewRun:s}){if(e.length===0)return null;let c=ty({passes:e,tickets:t,findings:n,notes:r,currentLap:i});return(0,R.jsxs)(`section`,{id:`lap-trail`,className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,R.jsx)(MO,{children:`Lap trail`}),(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[c.length,` lap`,c.length===1?``:`s`,` · newest first`]})]}),(0,R.jsx)(`ul`,{className:`flex list-none flex-col gap-3 p-0`,children:c.map(e=>(0,R.jsx)(j0,{entry:e,staged:a,onStage:o,...s?{onViewRun:s}:{}},e.lap))})]})}var N0={ok:`border-ok/45 text-ok`,warn:`border-warn/45 text-warn`,danger:`border-danger/45 text-danger`,idle:`border-hairline text-text-3`},P0={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,idle:`bg-text-3`},F0=`inline-flex items-center gap-2 rounded-pill border bg-panel px-3 py-1 font-mono text-xs`;function I0({tone:e}){return(0,R.jsx)(`span`,{className:`size-2 shrink-0 rounded-pill ${P0[e]}`,"aria-hidden":`true`})}function L0({chip:e,children:t}){return(0,R.jsxs)(`details`,{className:`group relative`,children:[(0,R.jsxs)(`summary`,{className:`${F0} ${N0[e.tone]} cursor-pointer list-none`,children:[(0,R.jsx)(I0,{tone:e.tone}),e.label]}),(0,R.jsx)(`div`,{className:`absolute top-[calc(100%+6px)] left-0 z-20 w-90 rounded-md border border-hairline-strong bg-panel-3 p-3 text-sm text-text-2 shadow-menu`,children:t})]})}function R0({chip:e,href:t}){return(0,R.jsxs)(`a`,{className:`${F0} ${N0[e.tone]} no-underline`,href:t,children:[(0,R.jsx)(I0,{tone:e.tone}),e.label]})}function z0({chip:e}){return(0,R.jsxs)(`span`,{className:`${F0} ${N0[e.tone]}`,children:[(0,R.jsx)(I0,{tone:e.tone}),e.label]})}function B0({artifact:e,currentLap:t,landedSince:n,tickets:r,checks:i,runState:a,verification:o,lap:s,laterLaps:c,readonly:l,driveLap:u,unverifiedKeys:d,testDrive:f,agenticReview:p,shipped:m=!1}){return(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Kv({artifact:e,currentLap:t,landedSince:n,tickets:r,checks:{passed:i.filter(e=>e.tone===`ok`).length,total:i.length},runState:a,...o?{verification:o}:{},...u===void 0?{}:{driveLap:u},...d?{unverifiedKeys:d}:{},shipped:m}).map(e=>{switch(e.key){case`drive`:return(0,R.jsx)(z0,{chip:e},e.key);case`review`:return m?(0,R.jsx)(z0,{chip:e},e.key):(0,R.jsx)(R0,{chip:e,href:`#open-work`},e.key);case`run`:return m?(0,R.jsx)(z0,{chip:e},e.key):(0,R.jsx)(R0,{chip:e,href:`#full-accounts`},e.key);case`checks`:return(0,R.jsx)(L0,{chip:e,children:i.map(e=>(0,R.jsx)(GO,{row:e},e.key))},e.key);case`unverified`:return(0,R.jsx)(L0,{chip:e,children:e.detail},e.key);case`lap`:return(0,R.jsxs)(L0,{chip:e,children:[(0,R.jsxs)(`div`,{children:[s.story,`.`]}),s.promotedFromEarlier>0&&(0,R.jsxs)(`div`,{className:`mt-2 text-text-3`,children:[`Includes `,s.promotedFromEarlier,` ticket`,s.promotedFromEarlier===1?``:`s`,` promoted in an earlier lap.`]}),c&&(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsx)(`div`,{className:`text-text-3`,children:l?`The spec kept this out of lap ${t} on purpose, and it was still deferred when this feature shipped.`:`The spec kept this out of lap ${t} on purpose. Start lap ${t+1} from the next step to take it on — or ship what landed, if lap ${t} is enough.`}),(0,R.jsx)(AH,{source:c,className:`mt-2`})]})]},e.key)}}),(f||p)&&(0,R.jsx)(`span`,{className:`flex-1`}),f&&(0,R.jsxs)(J,{className:`gap-2`,disabled:!!f.blocked,...f.blocked?{title:f.blocked}:{},onClick:f.onStart,children:[(0,R.jsx)(`span`,{className:`size-2 shrink-0 rounded-pill bg-drive`,"aria-hidden":`true`}),`Test drive`]}),p&&(0,R.jsx)(J,{disabled:!!p.blocked,...p.blocked?{title:p.blocked}:{},onClick:p.onStart,children:`Agentic review`})]})}function V0({full:e,driving:t,conflict:n,readonly:r=!1,onViewPhase:i}){let{feature:a,tickets:o,runs:s}=e,c=qy(),l=B.useUtils(),u=Ty(e.sessions),d=m_(s),f=yM(a.id),p=B.feature.commitCount.useQuery({featureId:a.id},{refetchInterval:$m(5e3)}),m=B.feature.driveInfo.useQuery(void 0,{refetchInterval:$m()}),h=m.data?.featureId===a.id?m.data:void 0,g=$m(),_=a.phase===`review`&&g,v=B.notes.list.useQuery({featureId:a.id},{refetchInterval:_}),y=B.findings.listByFeature.useQuery({featureId:a.id},{refetchInterval:_}),b=ay(e),x=B.docs.read.useQuery({featureId:a.id,relPath:b??`spec.md`},{enabled:!!b}),S=Hm(a.id).data??[],C=S.filter(e=>e.hasVideo&&e.videoUrl),w=Vv(S.filter(e=>e.completedAt!==null))??null,T=jp(B.project.prep.useQuery({projectId:a.projectId}).data?.findings??[]),E=B.project.list.useQuery().data?.find(e=>e.id===a.projectId),D=B.feature.testDrive.useMutation({onSuccess:()=>{l.feature.driveInfo.invalidate(),l.feature.get.invalidate({id:a.id})},onError:e=>c.push(e.message)}),O=B.feature.agenticReview.useMutation({onSuccess:()=>{l.feature.get.invalidate({id:a.id}),l.events.invalidate()},onError:e=>c.push(e.message)}),k=(0,L.useRef)(null),[A,j]=(0,L.useState)(null),[M,N]=(0,L.useState)(null),[P,F]=(0,L.useState)(!1),[ee,te]=(0,L.useState)(null),[ne,I]=(0,L.useState)({ids:[],scrollTo:null});(0,L.useEffect)(()=>{if(ne.ids.length===0)return;let e=setTimeout(()=>I({ids:[],scrollTo:null}),2e3);return()=>clearTimeout(e)},[ne]);let re=(0,L.useCallback)(e=>{j(e),document.getElementById(`evidence-stage`)?.scrollIntoView({behavior:`smooth`,block:`start`})},[]),ie=(0,L.useCallback)(e=>{k.current?.seek(e),document.getElementById(`evidence-stage`)?.scrollIntoView({behavior:`smooth`,block:`start`})},[]),ae=i?e=>{i(`building`),requestAnimationFrame(()=>document.getElementById(`lane-${e}`)?.scrollIntoView({behavior:`smooth`,block:`center`}))}:void 0,oe=h?.state??`idle`,se=oe!==`idle`||!!t,ce=C.length>0||se,le={expanded:P&&ce,set:F},ue=m.data&&m.data.featureId!==a.id?m.data:void 0,de=ue?.projectDrive&&ue.projectId?ue.projectId:void 0,fe=a.phase===`review`?bv(f,s,ee):null,pe=r?null:ny({passes:S,tickets:o,currentLap:a.lap}),me=r?null:{onStart:()=>O.mutate({featureId:a.id}),...O.isPending?{blocked:`starting…`}:d?.status===`running`?{blocked:`a burn is running`}:{}},{attention:he,settled:ge}=S1({findings:y.data?.findings??[],notes:v.data??[],tickets:o,openDefects:y.data?.openDefects??[]}),_e=(y.data?.findings??[]).filter(e=>e.kind===`observation`),ve=Wg(o,a.lap),ye=y.data?.summary,be=ye?ye.found+ye.observations:void 0,xe=Gg(ve)??Xv(ye),Se=ce?(0,R.jsx)(p0,{featureId:a.id,branch:a.branch,recordings:C,picked:A,notes:v.data??[],readonly:r,driveState:oe,drive:h,dryRun:m.data?.dryRun??!1,failure:vv(h,{sessionLive:!!u}),expand:le,handleRef:k,onStageRecording:N,onMarkerClick:e=>I({ids:e,scrollTo:null}),onAnnotationSaved:e=>I({ids:[e],scrollTo:e})}):null;return(0,R.jsxs)(`div`,{className:le.expanded?`fixed inset-0 z-[100] flex bg-bg`:`flex min-h-0 min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:le.expanded?`flex min-h-0 min-w-0 flex-1 flex-col px-7 py-4`:`flex min-w-0 flex-1 flex-col gap-6 overflow-y-auto px-7 pt-5 pb-8`,children:le.expanded?Se:(0,R.jsxs)(R.Fragment,{children:[n&&(0,R.jsx)(E1,{featureId:a.id,branch:a.branch,conflict:n,readonly:r,liveSessionId:u?.sessionId??null,resolveEnded:Mg(f,e.sessions)}),fe&&(0,R.jsx)(D0,{featureId:a.id,denial:fe,readonly:r,primary:!pe,onDismiss:()=>te(fe.eventId)},fe.eventId),pe&&(0,R.jsx)(y0,{lap:a.lap,outcome:pe,agenticReview:me}),u&&(0,R.jsx)(v0,{featureId:a.id,line:u,readonly:r,onOpen:i}),Se,(0,R.jsx)(B0,{artifact:w,currentLap:a.lap,landedSince:w?.landedSince??0,tickets:o,checks:Yv({tickets:o,run:d,commitCount:p.data?.count,findings:be}),runState:d?.status??`no run recorded`,verification:Gv(o),lap:Jg(o,{lap:a.lap,lapSessionRan:o.some(e=>e.lap===a.lap)}),laterLaps:sy(x.data?.content),readonly:r,unverifiedKeys:T,...me?{agenticReview:me}:{},...r||se?{}:{testDrive:{onStart:()=>D.mutate({featureId:a.id,action:`start`}),...D.isPending?{blocked:`starting…`}:ue?{blocked:_v(ue.holderLabel)}:{}}}}),!r&&!se&&ue&&de&&(0,R.jsx)(T0,{projectId:de,holderLabel:ue.holderLabel}),(0,R.jsx)(D1,{text:E?.driveInstructions}),xe&&(0,R.jsx)(`p`,{className:`m-0 text-sm text-text-2`,children:xe}),(0,R.jsx)(w1,{featureId:a.id,findings:y.data?.carriedFindings??[],readonly:r}),(0,R.jsx)(M0,{passes:S,tickets:o,findings:y.data?.findings??[],notes:v.data??[],currentLap:a.lap,staged:M?.ticketId??null,onStage:re,...i?{onViewRun:()=>i(`building`)}:{}}),(0,R.jsx)(h0,{account:ve,tickets:o,observations:_e,carried:ge.length>0?(0,R.jsx)(C1,{featureId:a.id,rows:ge,readonly:r,onStage:ce?M:null,onSeek:ie,onViewLane:ae}):null})]})}),(0,R.jsx)(w0,{featureId:a.id,lap:a.lap,rows:he,readonly:r,onStage:ce?M:null,onSeek:ie,highlight:ne.ids,scrollTo:ne.scrollTo,onViewLane:ae})]})}function H0({sessionId:e,className:t}){let n=B.project.conversationTranscript.useQuery({sessionId:e});if(n.isPending)return(0,R.jsx)(NO,{children:`reading the transcript…`});if(n.data?.status===`unavailable`)return(0,R.jsx)(NO,{children:`transcript not available for this session.`});let r=n.data?.turns??[];return r.length===0?(0,R.jsx)(NO,{children:`no transcript kept for this conversation.`}):(0,R.jsx)(W0,{turns:r,assistant:nv(n.data?.runtime),...t?{className:t}:{}})}var U0=`flex max-h-[clamp(300px,calc(100dvh-340px),1200px)] flex-col gap-4 overflow-y-auto pr-1`;function W0({turns:e,assistant:t,className:n=U0}){return(0,R.jsx)(`div`,{className:n,children:e.map((e,n)=>{let r=e.role===`user`;return(0,R.jsxs)(`div`,{className:`flex max-w-[80%] flex-col gap-2 ${r?`self-end`:`self-start`}`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold tracking-[0.06em] text-text-3 uppercase`,children:r?`You`:t}),r?(0,R.jsx)(`div`,{className:`rounded-lg rounded-tr-sm border border-accent-line bg-accent-soft px-4 py-3 text-base leading-relaxed break-words whitespace-pre-wrap text-text`,children:e.text}):(0,R.jsx)(`div`,{className:`rounded-lg rounded-tl-sm border border-hairline bg-panel px-4 py-3`,children:(0,R.jsx)(AH,{source:e.text})})]},n)})})}function G0({full:e,chatDocked:t=!1}){let{feature:n,tickets:r,runs:i}=e,a=yM(n.id),o=Cy(a),[s,c]=(0,L.useState)(!1),l=oy(e),u=Hm(n.id).data??[],d=u.filter(e=>e.hasVideo&&e.videoUrl),f=Hv(u),p=B.findings.listByFeature.useQuery({featureId:n.id}),m=ay(e),h=B.docs.read.useQuery({featureId:n.id,relPath:m??`spec.md`},{enabled:!!m}),g=Sy(e.sessions),_=m_(i);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,R.jsxs)(`div`,{className:`mx-auto mt-9 max-w-140 animate-[fadeUp_var(--dur-3)_ease-out] text-center`,children:[(0,R.jsx)(`div`,{className:`mx-auto flex size-10 animate-[popIn_var(--dur-3)_ease-out] items-center justify-center rounded-pill border border-ok/45 text-ok`,children:(0,R.jsx)(Vh,{size:17})}),(0,R.jsx)(`div`,{className:`mt-3.5 text-lg font-semibold`,children:`Shipped to main`}),(0,R.jsxs)(`div`,{className:`mt-1.5 inline-flex items-center gap-1.5 font-mono text-sm text-text-2`,children:[(0,R.jsx)(Lh,{size:12}),n.branch,o===null?``:` · merged ${c_(o)}`]}),(0,R.jsx)(`div`,{className:`mt-2.5 text-sm leading-relaxed text-text-3`,children:`The branch is merged and the pipeline is complete. The full history lives in the Activity tab.`}),l&&(0,R.jsx)(J,{className:`mt-4`,onClick:()=>c(!0),children:`Read the outcome doc`})]}),d.length===0?(0,R.jsx)(NO,{children:l0}):(0,R.jsx)(p0,{featureId:n.id,branch:n.branch,recordings:d,notes:[],readonly:!0,driveState:`idle`,dryRun:!1,failure:null}),(0,R.jsx)(B0,{artifact:f,currentLap:n.lap,landedSince:f?.landedSince??0,tickets:r,checks:Yv({tickets:r,run:_,findings:p.data?.findings.length}).filter(e=>e.key!==`changes`),runState:_?.status??`no run recorded`,lap:Jg(r,{lap:n.lap,lapSessionRan:!0}),laterLaps:sy(h.data?.content),readonly:!0,shipped:!0,driveLap:Pg(a)}),(0,R.jsx)(dQ,{featureId:n.id,sessions:xy(g.filter(zg),t),className:`shipped-session`}),(0,R.jsx)(K0,{sessions:g}),s&&l&&(0,R.jsx)(jH,{featureId:n.id,relPath:l,title:`outcome`,onClose:()=>c(!1)})]})}function K0({sessions:e}){return e.length===0?null:(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(MO,{children:`Questions asked`}),(0,R.jsx)(`ul`,{className:`flex list-none flex-col gap-2 p-0`,children:e.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsx)(q0,{session:e})},e.id))})]})}function q0({session:e}){let[t,n]=(0,L.useState)(!1),r=e.createdAt===void 0?null:c_(e.createdAt);return e.transcriptMissing?(0,R.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-hairline bg-panel px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`flex-1 text-base text-text-3`,children:`session opened · nothing recorded`}),r&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:r})]}):(0,R.jsxs)(`div`,{className:`rounded-md border border-hairline bg-panel`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-3 py-2.5 text-left`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,R.jsx)(`span`,{className:`flex-1 text-base text-text`,children:e.title??`Conversation`}),r&&(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,children:r}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,"aria-hidden":`true`,children:t?`▾`:`▸`})]}),t&&(0,R.jsx)(`div`,{className:`border-t border-hairline p-3`,children:(0,R.jsx)(H0,{sessionId:e.id})})]})}function J0({featureId:e,chatDocked:t=!1}){let n=qy(),r=B.useUtils(),i=B.feature.get.useQuery({id:e},{refetchInterval:$m()}),[a,o]=(0,L.useState)(null),s=B.ticket.edit.useMutation({onSuccess:()=>{r.feature.get.invalidate({id:e})},onError:e=>n.push(e.message)}),c=B.ticket.cancel.useMutation({onSuccess:()=>{r.feature.get.invalidate({id:e}),n.push(`ticket cancelled`,`success`)},onError:e=>n.push(e.message)}),l=i.data?.feature.projectId,u=B.settings.get.useQuery({projectId:l??``},{enabled:!!l}),d=Bp(u.data),f=pm(u.data,`implement`)??`…`,p=i.data,m=xy(p?.sessions??[],t),h=[...m].reverse().find(zg),g=p?p.tickets.filter(e=>e.lap===p.feature.lap):[],_=X0(h?.id,g.length);if(i.isLoading)return(0,R.jsx)(NO,{children:`loading tickets…`});if(!p)return(0,R.jsxs)(NO,{children:[`could not load tickets: `,i.error?.message??`unknown`]});let{feature:v,tickets:y,docs:b}=p,x=[...m].reverse().find(e=>e.status===`ended`),S=async(e,t)=>{await s.mutateAsync({ticketId:e,...t}),n.push(`ticket updated`,`success`)},C=(e,t)=>s.mutate({ticketId:e,model:t}),w=async t=>{let i=Y0(y,v.lap);try{for(let e of i)await r.client.ticket.edit.mutate({ticketId:e.id,model:t});await r.feature.get.invalidate({id:e}),n.push(`${i.length} tickets set to ${t||`the default model`}`,`success`)}catch(e){n.push(e instanceof Error?e.message:`could not update ticket models`)}},T=(0,R.jsx)(l1,{tickets:y,currentLap:v.lap,roster:d,docs:b,sandbox:qH,defaultModel:f,onDoc:o,onEdit:S,onModel:C,onBulkModel:e=>{w(e)},onCancel:e=>c.mutate({ticketId:e}),onCopySha:e=>{navigator.clipboard.writeText(e),n.push(`copied ${i_(e)}`,`info`)}});return(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-y-auto`,children:[h&&(0,R.jsx)(Z0,{featureId:e,live:h,ticketCount:g.length,open:_.open,onToggle:_.toggle}),!h&&x&&(0,R.jsx)(uQ,{session:x}),(0,R.jsx)(`div`,{className:`flex min-h-0 flex-col${_.open?` shrink-0`:``}`,children:T}),a&&(0,R.jsx)(jH,{featureId:e,relPath:a,title:b.find(e=>e.relPath===a)?.title??a,onClose:()=>o(null)})]})}function Y0(e,t){return e.filter(e=>e.lap===t&&e.status===`pending`)}function X0(e,t){let n=`runcastle.tickets.term:${e??``}`,[r,i]=(0,L.useState)(t===0);return(0,L.useEffect)(()=>{let e=null;try{e=sessionStorage.getItem(n)}catch{}i(e===null?t===0:e===`open`)},[n,t]),{open:r,toggle:e=>{i(e);try{sessionStorage.setItem(n,e?`open`:`closed`)}catch{}}}}function Z0({featureId:e,live:t,ticketCount:n,open:r,onToggle:i}){return r?(0,R.jsx)(`div`,{className:`flex h-full shrink-0 flex-col`,children:(0,R.jsx)(dQ,{featureId:e,sessions:[t],right:(0,R.jsx)(J,{className:`h-7 text-xs`,onClick:()=>i(!1),children:`Hide terminal`})})}):(0,R.jsx)(`div`,{className:`flex-none rounded-lg border border-hairline bg-panel-2`,children:(0,R.jsx)(uQ,{session:t,right:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`font-mono text-xs text-text-3`,children:[`· `,n,` tickets emitted`]}),(0,R.jsx)(J,{className:`h-7 text-xs`,onClick:()=>i(!0),children:`Show terminal ▸`}),(0,R.jsx)(jU,{featureId:e,sessionId:t.id})]})})})}function Q0({open:e,title:t,body:n,confirmLabel:r,busy:i,onConfirm:a,onClose:o}){return(0,R.jsx)(RO,{open:e,onClose:o,size:`sm`,label:t,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-6 p-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`strong`,{className:`text-lg font-semibold text-text`,children:t}),(0,R.jsx)(`div`,{className:`text-base leading-relaxed text-text-2`,children:n})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(J,{variant:`ghost`,onClick:o,disabled:i,children:`Keep going`}),(0,R.jsx)(J,{variant:`danger`,autoFocus:!0,disabled:i,onClick:()=>{a(),o()},children:r})]})]})})}var $0=[`pending`,`failed`],e2={pending:`border-l-hairline-strong`,burning:`border-l-ph-implementation`,done:`border-l-ok`,failed:`border-l-danger`,"launch-failed":`border-l-danger`,stopped:`border-l-warn`,waived:`border-l-hairline`},t2=`inline-flex h-5 shrink-0 items-center gap-1.5 rounded-pill border px-2 font-mono text-xs`,n2={pending:`border-hairline text-text-3`,burning:`border-ph-implementation/45 bg-ph-implementation/8 text-ph-implementation animate-[pulse_1.5s_ease-in-out_infinite]`,done:`border-ok/40 text-ok`,failed:`border-danger/45 text-danger`,"launch-failed":`border-danger/45 text-danger`,stopped:`border-warn/45 text-warn`,waived:`border-hairline text-text-4 line-through`},r2={pending:`pending`,burning:`burning`,done:`done`,failed:`failed`,"launch-failed":`launch failed`,stopped:`stopped`,waived:`set aside`},i2=`animate-[fadeUp_220ms_ease-out]`,a2={"claude-code":ig,codex:ag};function o2({ticket:e,featureBranch:t,readonly:n,expanded:r,onToggle:i,hadOutput:a,elapsed:o,duration:s,model:c,roster:l,defectTitle:u,busy:d,stopping:f,waiving:p,terminalBlocked:m,onModel:h,onRetry:g,onRetryWithModel:_,onRetryFresh:v,onWaive:y,onStop:b,onResolveInTerminal:x,onCopySha:S,children:C}){let[w,T]=(0,L.useState)(!1),E=T_({...e,hadOutput:a}),D=E_({...e,hadOutput:a}),O=e.status===`failed`?e.conflictFiles:void 0,k=e.error?.split(`
|
|
187
|
+
`)[0],A=E===`failed`||E===`launch-failed`,j=A||E===`stopped`,M=!n&&l&&h&&$0.includes(e.status)?{roster:l,onChange:h}:null,N=c?a2[c.runtime]:null,P=E===`done`?e.commits[0]:void 0;return(0,R.jsxs)(`div`,{id:`lane-${e.id}`,className:`rounded-md border border-hairline border-l-2 bg-panel-2 transition-[border-color,background-color] duration-(--dur-2) ease-app ${e2[E]} ${E===`waived`?`opacity-60`:``} ${E===`done`||A?i2:``}`,children:[(0,R.jsxs)(`button`,{className:`flex w-full items-center gap-2 border-0 bg-transparent px-3 py-2.5 text-left`,"aria-expanded":r,onClick:i,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-text-4 transition-transform duration-(--dur-1) ease-app ${r?`rotate-90`:``}`,children:(0,R.jsx)(Kh,{size:11})}),(0,R.jsxs)(`span`,{className:`shrink-0 font-mono text-sm text-text-3`,children:[`#`,e.seq]}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-base text-text`,children:e.title}),u&&(0,R.jsx)(`span`,{className:`${t2} max-w-60 border-ph-review/40 text-ph-review`,title:`Fixes: ${u}`,children:(0,R.jsx)(`span`,{className:`truncate`,children:u})}),(0,R.jsx)(rk,{kind:e.kind,passKind:e.passKind}),c&&N&&(0,R.jsxs)(`span`,{className:`${t2} border-hairline text-text-2`,title:`Burns on ${c.id} (${c.runtimeLabel})`,children:[(0,R.jsx)(N,{size:11}),c.id,` · `,c.runtimeLabel]}),o&&E===`burning`&&(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-text-3`,children:o}),s&&E!==`burning`&&(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-text-3`,children:s}),(0,R.jsx)(`span`,{className:`${t2} ${n2[E]}`,children:r2[E]})]}),P&&(0,R.jsx)(`div`,{className:`px-3 pb-2.5`,children:S?(0,R.jsx)(`button`,{className:`${t2} cursor-pointer border-hairline text-text-2`,title:`copy sha`,onClick:()=>S(P),children:i_(P)}):(0,R.jsx)(`span`,{className:`${t2} border-hairline text-text-2`,title:P,children:i_(P)})}),k&&!O&&(0,R.jsx)(`div`,{className:`px-3 pb-2.5 font-mono text-xs ${A?`text-danger`:`text-text-3`}`,title:e.error,children:(0,R.jsx)(i1,{text:k})}),O&&(0,R.jsxs)(`div`,{className:`mx-3 mb-2.5 rounded-sm border border-danger/35 bg-danger/6 px-2.5 py-2`,children:[(0,R.jsxs)(`div`,{className:`text-sm leading-relaxed text-text-2`,children:[`Merge conflict — the work is committed but could not land on`,` `,(0,R.jsx)(`code`,{className:`font-mono text-xs text-text`,children:t})]}),O.length>0&&(0,R.jsx)(`ul`,{className:`m-0 mt-1.5 flex list-none flex-col gap-0.5 p-0`,children:O.map(e=>(0,R.jsx)(`li`,{className:`truncate text-left font-mono text-xs text-danger`,title:e,children:e},e))}),k&&(0,R.jsx)(`div`,{className:`mt-1.5 font-mono text-xs text-danger`,title:e.error,children:(0,R.jsx)(i1,{text:k})})]}),!n&&(j||E===`burning`||M)&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 pb-3`,children:[j&&g&&(0,R.jsx)(J,{disabled:d,title:O?`run an agent that merges the feature branch into this ticket’s branch and resolves the conflict — it gets the ticket, the feature docs, and the commits it is reconciling against`:`retry this ticket — continues from any commits preserved by previous attempts`,onClick:g,children:O?`Resolve with agent`:`Retry`}),j&&l&&_&&(0,R.jsx)(Q$,{value:``,roster:l,label:`Retry on…`,ticketKind:e.kind,onChange:_}),O&&x&&(0,R.jsx)(J,{disabled:d||m,title:m?`available once this run finishes and no terminal is open`:`open a terminal on the feature branch, briefed with this ticket and its conflicting files, and resolve it yourself`,onClick:x,children:`Resolve in terminal`}),j&&v&&(0,R.jsx)(J,{disabled:d,title:O?`throw away the conflicting branch and re-implement the ticket from the current feature branch tip`:`discard any preserved commits from previous attempts and redo the ticket from the feature branch tip`,onClick:()=>T(!0),children:`Retry fresh`}),j&&y&&(0,R.jsx)(J,{disabled:d,title:`set this ticket aside — it stops asking to be retried and is carried into review as explicitly unfinished work`,onClick:y,children:p?`Waiving…`:`Waive`}),E===`burning`&&b&&(0,R.jsx)(J,{variant:`danger`,disabled:d,title:`stop this ticket's agent — other lanes keep burning; committed work is preserved for retry`,onClick:b,children:f?`Stopping…`:`Stop ticket`}),M&&(0,R.jsx)(Q$,{value:e.model??``,roster:M.roster,ticketKind:e.kind,onChange:M.onChange})]}),r&&(0,R.jsxs)(`div`,{className:`border-t border-hairline-soft`,children:[D&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-hairline-soft bg-danger/6 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-sm text-text`,children:D.text}),D.hint&&(0,R.jsx)(`span`,{className:`text-sm text-text-2`,children:D.hint}),e.error&&(0,R.jsxs)(`details`,{className:`text-sm text-text-3`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer`,children:`What the engine reported`}),(0,R.jsx)(`pre`,{className:`m-0 mt-1.5 overflow-x-auto font-mono text-xs whitespace-pre-wrap text-text-3`,children:e.error})]})]}),C]}),v&&(0,R.jsx)(Q0,{open:w,title:`Start ticket #${e.seq} over?`,body:`Any commits preserved from previous attempts are discarded and the ticket is redone from the feature branch tip.`,confirmLabel:`Retry fresh`,busy:d,onConfirm:v,onClose:()=>T(!1)})]})}function s2({digest:e}){return e?.trim()?(0,R.jsxs)(`details`,{className:`border-b border-hairline-soft`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2 text-xs font-semibold tracking-[0.07em] text-text-3 uppercase [&::-webkit-details-marker]:hidden`,children:`What this ticket produced`}),(0,R.jsx)(`div`,{className:`border-t border-hairline-soft px-3 py-2`,children:(0,R.jsx)(AH,{source:e})})]}):null}function c2({ticketId:e,bootEvents:t,poll:n=!0}){let{chunks:r,live:i,trimmed:a}=u2(e,n),o=(0,L.useRef)(null),[s,c]=(0,L.useState)(!0),{blocks:l,completed:u}=(0,L.useMemo)(()=>R_(r),[r]);return(0,L.useEffect)(()=>{if(!s)return;let e=o.current;e&&(e.scrollTop=e.scrollHeight)},[l,i,s]),(0,R.jsxs)(`div`,{className:`max-h-120 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,ref:o,onScroll:()=>{let e=o.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<24;c(t)},children:[a&&(0,R.jsx)(`div`,{className:`pb-2 text-center text-xs text-text-4`,children:`… earlier output trimmed …`}),l.length===0&&!i&&(0,R.jsx)(NO,{children:`no agent output captured — transcripts are held in server memory for the current burn; older runs keep only the event timeline.`}),l.length===0&&i&&(0,R.jsx)(l2,{events:t}),l.map((e,t)=>e.kind===`text`?(0,R.jsxs)(`div`,{className:`mb-2.5 flex items-start gap-2`,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-text-2`,children:`⏺`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 break-words whitespace-pre-wrap text-text`,children:e.text})]},t):(0,R.jsxs)(`div`,{className:`mb-1.5 flex items-start gap-2`,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-ok`,children:`●`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-text`,children:e.name}),e.args&&(0,R.jsxs)(`span`,{className:`text-text-3`,children:[`(`,e.args,`)`]})]})]},t)),u&&(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-text-3`,children:[(0,R.jsx)(`span`,{className:`text-ok`,children:`✓`}),`agent reported complete`]}),i&&(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-ph-implementation`,children:[(0,R.jsx)(`span`,{className:`inline-block animate-[spin_1.2s_linear_infinite]`,children:`✳`}),(0,R.jsx)(`span`,{className:`text-xs text-text-3`,children:`Burning…`}),(0,R.jsx)(`span`,{className:`animate-[pulse_1.1s_ease-in-out_infinite] text-text-2`,children:`▍`})]}),!s&&(0,R.jsx)(`button`,{className:`sticky bottom-1.5 ml-auto block cursor-pointer rounded-pill border border-accent bg-panel-2 px-2.5 text-xs text-accent-hi`,onClick:()=>c(!0),children:`Follow ⇣`})]})}function l2({events:e}){return e.length===0?(0,R.jsx)(NO,{children:`starting the container…`}):(0,R.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`flex gap-2.5 text-xs text-text-3`,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-text-4`,children:e_(e.ts)}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.message})]},e.id))})}function u2(e,t){let[n,r]=(0,L.useState)([]),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),c=n.length>0?n[n.length-1].i:void 0,l=$m(1e3),u=B.run.agentTranscript.useQuery({ticketId:e,after:c},{refetchInterval:t?l:!1});return(0,L.useEffect)(()=>{let e=u.data;e&&(a(e.live),s(e.firstIndex>0),r(t=>{let n=t.length>0?t[t.length-1].i:-1;if(e.nextIndex<=n)return[];if(e.chunks.length===0)return t;let r=e.chunks.filter(e=>e.i>n);return r.length===0?t:[...t,...r]}))},[u.data]),{chunks:n,live:i,trimmed:o}}function d2({runs:e,selectedId:t,latestId:n,onPick:r}){let[i,a]=(0,L.useState)(!1);return e.length===0?null:(0,R.jsxs)(`details`,{className:`rounded-md border border-hairline bg-panel-2`,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer list-none px-2.5 py-1 font-mono text-xs text-text-3 [&::-webkit-details-marker]:hidden`,children:[e.length,` run`,e.length===1?``:`s`,` `,(0,R.jsx)(`span`,{"aria-hidden":!0,children:`▾`})]}),(0,R.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-hairline-soft p-1`,children:e.map(e=>{let i=e.ticketIds.length,o=e.id===t;return(0,R.jsxs)(`button`,{type:`button`,"aria-current":o||void 0,title:t_(e.startedAt),className:`flex cursor-pointer items-center gap-2 rounded-sm border-0 px-2 py-1.5 text-left hover:bg-accent-soft ${o?`bg-accent-soft text-text`:`bg-transparent text-text-2`}`,onClick:()=>{r(e.id),a(!1)},children:[(0,R.jsx)(`span`,{className:`w-20 shrink-0 font-mono text-xs text-text-3`,children:c_(e.startedAt)}),(0,R.jsx)(ck,{status:e.status}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:[`Lap `,e.lap,` · `,i,` lane`,i===1?``:`s`]}),e.id===n&&(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-text-3`,children:`latest`})]},e.id)})})]})}function f2({headline:e,elapsed:t,status:n,burning:r,busy:i,cancelling:a,onCancelRun:o,runs:s=[],selectedRunId:c=null,latestRunId:l=null,onPickRun:u,onBackToLatest:d}){let[f,p]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{className:`mb-6 flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(MO,{children:d?`Past run`:`Run`}),n&&(0,R.jsx)(ck,{status:n}),(0,R.jsx)(`span`,{className:`flex-1`}),u&&(0,R.jsx)(d2,{runs:s,selectedId:c,latestId:l,onPick:u}),d&&(0,R.jsx)(J,{onClick:d,children:`Back to latest`}),o&&(0,R.jsx)(J,{variant:`danger`,disabled:i,onClick:()=>p(!0),children:a?`Stopping…`:`Cancel run`})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`text-lg text-text`,children:e}),(0,R.jsx)(`span`,{className:`font-mono text-sm text-text-3`,children:t})]}),o&&(0,R.jsx)(Q0,{open:f,title:`Cancel this run?`,body:r>0?(0,R.jsxs)(R.Fragment,{children:[`Stops `,r,` burning agent`,r===1?``:`s`,`. Finished work is kept; the burn can resume later.`]}):`Stops the run before its remaining tickets start. Finished work is kept; the burn can resume later.`,confirmLabel:`Cancel run`,busy:i,onConfirm:o,onClose:()=>p(!1)})]})}function p2({tickets:e,currentLap:t,lane:n}){return(0,R.jsx)(qO,{groups:Kg(e,t),currentLap:t,meta:e=>`${e.rows.length} lane${e.rows.length===1?``:`s`}`,children:e=>(0,R.jsx)(`div`,{className:`flex flex-col gap-2`,children:B_(e).map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.title&&(0,R.jsx)(`div`,{className:`mt-2 border-l-2 border-ph-review/40 pl-3`,children:(0,R.jsx)(MO,{children:e.title})}),(0,R.jsx)(`div`,{className:`flex flex-col gap-2${e.kind===`plain`?``:` pl-3`}`,children:e.rows.map(n)})]},e.kind))})})}var m2={error:`text-danger`,ok:`text-ok`,active:`text-ph-implementation`,info:`text-accent-hi`};function h2({events:e}){return(0,R.jsxs)(`details`,{open:e.some(IM),className:`mt-6 rounded-md border border-hairline bg-panel-2`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer list-none px-3 py-2 text-xs font-semibold tracking-[0.07em] text-text-3 uppercase [&::-webkit-details-marker]:hidden`,children:[`Run timeline · `,e.length]}),(0,R.jsxs)(`div`,{className:`max-h-96 overflow-y-auto border-t border-hairline-soft px-3 py-2 font-mono text-xs leading-relaxed`,children:[e.length===0&&(0,R.jsx)(NO,{children:`waiting for events…`}),e.map(e=>(0,R.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,R.jsx)(`span`,{className:`w-11 shrink-0 text-text-4`,children:e_(e.ts)}),(0,R.jsx)(`span`,{className:`w-30 shrink-0 truncate ${m2[FM(e)]??`text-text-2`}`,children:e.type}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 ${IM(e)?`break-words text-warn`:`truncate text-text-2`}`,children:e.message})]},e.id))]})]})}function g2({gates:e}){return e.length===0?null:(0,R.jsxs)(`section`,{className:`mb-4 rounded-lg border border-warn/45 bg-warn/8 px-3 py-2`,role:`alert`,children:[(0,R.jsx)(`div`,{className:`text-sm font-semibold text-warn`,children:`Verification unavailable`}),(0,R.jsx)(`div`,{className:`mt-0.5 text-xs text-text-2`,children:`The sandbox lacked a command or runtime. Ticket results were kept; these gates still need checking.`}),(0,R.jsx)(`ul`,{className:`mt-2 mb-0 list-none space-y-1 p-0`,children:e.map(e=>(0,R.jsxs)(`li`,{className:`grid gap-0.5 rounded-sm bg-panel-2 px-2 py-1.5`,children:[(0,R.jsx)(`code`,{className:`text-xs text-text`,children:e.command}),(0,R.jsx)(`span`,{className:`font-mono text-xs text-warn`,children:e.error})]},e.command))})]})}function _2({featureId:e,runId:t,readonly:n=!1,chatDocked:r=!1}){let i=$m(),a=qy(),o=B.useUtils(),[s,c]=(0,L.useState)(null),l=!!s&&s!==t,u=s??t,d=n||l,f=B.feature.get.useQuery({id:e},{refetchInterval:i}),p=B.run.get.useQuery({runId:u},{refetchInterval:!l&&i,enabled:!!u}),m=B.run.listByFeature.useQuery({featureId:e},{refetchInterval:i}),h=yM(e),g=f.data?.feature.projectId,_=B.settings.get.useQuery({projectId:g},{enabled:!!g}),v=B.findings.listByFeature.useQuery({featureId:e}),y={onSuccess:()=>o.feature.get.invalidate({id:e}),onError:e=>a.push(e.message)},b=B.ticket.retry.useMutation(y),x=B.ticket.edit.useMutation(y),S=B.ticket.stop.useMutation(y),C=B.ticket.cancel.useMutation(y),w=B.feature.launchSession.useMutation(y),T=B.run.cancel.useMutation(y),E=b.isPending||x.isPending||S.isPending||C.isPending||w.isPending||T.isPending,D=l?p.data?.tickets??[]:f.data?.tickets??[],O=f.data?.feature.branch??``,k=f.data?.feature.lap??1,A=(0,L.useMemo)(()=>h.filter(e=>e.runId===u),[h,u]),j=(0,L.useMemo)(()=>Ig(A),[A]),M=(0,L.useMemo)(()=>V_(A),[A]),N=(0,L.useMemo)(()=>S_(A),[A]),[P,F]=(0,L.useState)(null),ee=D.find(e=>e.status===`burning`)?.id,te=P??new Set(ee?[ee]:[]),ne=e=>F(()=>{let t=new Set(te);return t.has(e)?t.delete(e):t.add(e),t}),I=Bp(_.data),re=(0,L.useMemo)(()=>new Map((v.data?.findings??[]).map(e=>[e.id,e.title])),[v.data]),ie=e=>qg(e,I)??qg({model:pm(_.data,e.kind===`review`?`review`:`implement`)},I),ae=f.data?.sessions??[],oe=ae.some(zg),se=oe||p.data?.status===`running`,ce=p.data?p.data.status===`running`:!!u;if(!t&&!oe)return(0,R.jsx)(`div`,{className:`surface`,children:(0,R.jsx)(PO,{icon:(0,R.jsx)(Jh,{size:16}),title:`No run yet`,hint:`${av} Every ticket gets its own lane here.`})});let le=D.filter(e=>e.status===`burning`).length,ue=e=>{navigator.clipboard?.writeText(e).then(()=>a.push(`copied ${i_(e)}`,`info`),()=>a.push(`copy failed`))},de=e=>b.mutate({ticketId:e.id},{onSuccess:t=>{t.resolvingConflict?a.push(`resolving ticket #${e.seq}'s conflict with an agent`,`info`):t.resumedFrom&&a.push(`resuming ticket #${e.seq} from ${t.preservedCommits} preserved commit(s)`,`info`)}}),fe=t=>{let n=M.get(t.id),r=j.get(t.id),i=t.status===`failed`?t.conflictFiles:void 0;return(0,R.jsxs)(o2,{ticket:t,featureBranch:O,readonly:d,expanded:te.has(t.id),onToggle:()=>ne(t.id),hadOutput:n?.hadOutput,elapsed:n?l_(n.startedAt,Date.now()):void 0,duration:r===void 0?void 0:l_(0,r),model:ie(t),roster:I,defectTitle:t.originFindingId?re.get(t.originFindingId):void 0,busy:E,stopping:S.isPending&&S.variables?.ticketId===t.id,waiving:C.isPending&&C.variables?.ticketId===t.id,terminalBlocked:se,onCopySha:ue,onModel:e=>x.mutate({ticketId:t.id,model:e}),onRetry:()=>de(t),onRetryWithModel:ce?void 0:e=>x.mutate({ticketId:t.id,model:e},{onSuccess:()=>de(t)}),onRetryFresh:()=>b.mutate({ticketId:t.id,fresh:!0}),onWaive:()=>C.mutate({ticketId:t.id,reason:`waived from the run view`},{onSuccess:e=>{a.push(`ticket #${t.seq} set aside — it stays visible as unfinished work at review`,`info`),e.confirmed||a.push(sv)}}),onStop:()=>S.mutate({ticketId:t.id},{onSuccess:e=>{e.swept?a.push(`no live agent — the lane was orphaned; marked failed, retry to resume it`,`info`):e.stopped?e.confirmed||a.push(sv):a.push(`no live agent for this ticket (already finishing?)`,`info`)}}),onResolveInTerminal:i?()=>w.mutate({featureId:e,kind:`chat`,kickoffLine:Og({seq:t.seq,title:t.title,branch:t.attemptBranch??``,featureBranch:O,files:i}),purpose:`resolve-conflict`,purposeData:{mergeFrom:t.attemptBranch??``,mergeInto:O}}):void 0,children:[(0,R.jsx)(s2,{digest:t.digest}),(0,R.jsx)(MU,{label:`agent transcript`,children:(0,R.jsx)(c2,{ticketId:t.id,bootEvents:A.filter(e=>e.ticketId===t.id),poll:!l})})]},t.id)};return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(dQ,{featureId:e,sessions:xy(ae,r),className:`tickets-session`}),(0,R.jsx)(f2,{headline:O_(D.map(e=>({...e,hadOutput:M.get(e.id)?.hadOutput,reviewFix:!!e.originFindingId})),{status:p.data?.status},H_(D,A)),elapsed:p.data?l_(p.data.startedAt,p.data.endedAt??Date.now()):``,status:p.data?.status,burning:le,busy:E,cancelling:T.isPending,onCancelRun:d||!t||p.data?.status!==`running`?void 0:()=>T.mutate({runId:t},{onSuccess:e=>{e.confirmed||a.push(sv)}}),runs:m.data??[],selectedRunId:u,latestRunId:t,onPickRun:c,...l?{onBackToLatest:()=>c(null)}:{}}),(0,R.jsx)(g2,{gates:N}),D.length===0?(0,R.jsx)(PO,{icon:(0,R.jsx)(Jh,{size:16}),title:`No ticket lanes`,hint:`This run has nothing to burn — a session breaks the work into tickets, and they appear here as lanes.`}):(0,R.jsx)(p2,{tickets:D,currentLap:k,lane:fe}),(0,R.jsx)(h2,{events:A}),p.data?.digest&&(0,R.jsx)(v2,{digest:p.data.digest})]})}function v2({digest:e}){return(0,R.jsxs)(`details`,{className:`mt-3 rounded-md border border-hairline bg-panel-2`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2 text-xs font-semibold tracking-[0.07em] text-text-3 uppercase [&::-webkit-details-marker]:hidden`,children:`What this run produced`}),(0,R.jsx)(`div`,{className:`border-t border-hairline-soft px-3 py-2`,children:(0,R.jsx)(AH,{source:e})})]})}function y2({open:e,panel:t,children:n}){return e?(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:n}),t]}):(0,R.jsx)(R.Fragment,{children:n})}function b2({featureId:e,sessions:t,busy:n,onOpenChat:r,onCollapse:i}){let a=by(t),o=!!a&&zg(a);return(0,R.jsxs)(`aside`,{className:`flex min-h-0 w-(--chat-panel-w) flex-none flex-col border-l border-hairline bg-panel-2`,"aria-label":`Feature chat`,children:[(0,R.jsxs)(`header`,{className:`flex h-12 flex-none items-center gap-2 border-b border-hairline px-3`,children:[o&&a?(0,R.jsx)(uk,{status:a.status}):(0,R.jsx)(`span`,{className:`size-2 rounded-pill bg-text-4`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`text-base font-semibold text-text`,children:`Chat`}),(0,R.jsx)(`span`,{className:`truncate text-sm text-text-3`,children:`one transcript · resumed`}),(0,R.jsx)(`span`,{className:`flex-1`}),o&&a&&(0,R.jsx)(jU,{featureId:e,sessionId:a.id}),(0,R.jsx)(J,{size:`xs`,"aria-label":`Collapse the chat`,title:`Collapse the chat`,onClick:i,children:`▸`})]}),o&&a?(0,R.jsx)(`div`,{className:`min-h-0 flex-1 bg-panel-inset`,id:`chat-panel-terminal`,children:(0,R.jsx)(MU,{label:`terminal`,children:(0,R.jsx)(cQ,{sessionId:a.id})})}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:a?(0,R.jsx)(H0,{sessionId:a.id,className:`flex flex-col gap-4`}):(0,R.jsx)(PO,{compact:!0,icon:(0,R.jsx)(Jh,{size:16}),title:`No conversation yet`,hint:`One chat per feature — it knows the state, answers questions, and edits the next burn's tickets.`})}),(0,R.jsxs)(`div`,{className:`flex flex-none items-center gap-3 border-t border-hairline px-3 py-3`,children:[(0,R.jsx)(J,{disabled:n,onClick:r,children:a?`Resume the conversation`:`Start the conversation`}),(0,R.jsx)(`span`,{className:`truncate text-sm text-text-3`,children:`every door resumes it`})]})]})]})}function x2({tag:e,details:t,children:n}){let r=qy();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`ws-banner is-broken`,role:`alert`,children:[(0,R.jsx)(`span`,{className:`ws-banner-tag`,children:e}),(0,R.jsx)(`span`,{children:n})]}),(0,R.jsx)(`div`,{className:`ws-body`,children:(0,R.jsx)(`div`,{className:`ws-body-inner`,children:(0,R.jsxs)(`div`,{className:`broken-detail`,children:[(0,R.jsx)(NO,{children:t}),(0,R.jsx)(J,{variant:`ghost`,size:`xs`,onClick:()=>$j(t,r),children:`Copy details`})]})})})]})}function S2({featureId:e,error:t}){return(0,R.jsx)(`section`,{className:`workspace`,children:(0,R.jsx)(x2,{tag:`BROKEN`,details:`feature ${e} — ${t.name}: ${t.message}`,children:`This feature couldn't be rendered. Everything else still works.`})})}function C2({feature:e}){return(0,R.jsxs)(`section`,{className:`workspace`,children:[(0,R.jsx)(`div`,{className:`ws-head`,children:(0,R.jsxs)(`div`,{className:`ws-title-row`,children:[(0,R.jsx)(`span`,{className:`font-mono text-sm font-semibold lowercase`,children:`unknown`}),(0,R.jsx)(`span`,{className:`ws-title`,children:e.title})]})}),(0,R.jsxs)(x2,{tag:`UNRECOGNIZED`,details:`feature ${e.id} (${e.slug}) has phase "${e.phase}"`,children:[`This feature's phase is `,(0,R.jsx)(`strong`,{className:`font-mono`,children:e.phase}),`, which this version of runcastle doesn't know. Nothing here can be acted on until the row is fixed.`]})]})}function w2(...e){return e.filter(Boolean).join(` `)}var T2={done:`text-text-2`,current:`font-semibold text-text`,upcoming:`text-text-4`},E2={done:`opacity-100`,current:`bg-accent opacity-100 shadow-[0_0_0_3px_rgba(124,108,246,0.2)] animate-[dotGlow_2.4s_ease-in-out_infinite]`,upcoming:`opacity-50`};function D2({steps:e,lap:t,onView:n}){return(0,R.jsxs)(`div`,{className:`mt-4 -ml-2.5 flex flex-wrap items-center gap-y-1.5`,children:[e.map((t,r)=>(0,R.jsxs)(L.Fragment,{children:[(0,R.jsxs)(`button`,{className:w2(`inline-flex h-6.5 shrink-0 items-center gap-1.5 rounded-pill border border-transparent px-2.5 text-sm lowercase`,`transition-[background-color,color,border-color] duration-(--dur-1)`,T2[t.state],t.isViewed&&`border-hairline bg-panel`,t.isViewed&&t.state===`current`&&`border-accent-line`,t.clickable?`cursor-pointer hover:bg-panel hover:text-text active:scale-[0.97]`:`cursor-default`),title:t.tip,disabled:!t.clickable,onClick:()=>t.clickable&&n(t.phase),children:[(0,R.jsx)(`span`,{className:w2(`size-2 shrink-0 rounded-pill bg-current transition-[opacity,box-shadow] duration-(--dur-2)`,E2[t.state])}),(0,R.jsx)(`span`,{children:t.label})]}),r<e.length-1&&(0,R.jsx)(`span`,{className:`h-px w-4 shrink-0 transition-colors duration-(--dur-2) ${t.state===`done`?`bg-text-4`:`bg-hairline`}`})]},t.phase)),t>1&&(0,R.jsxs)(`span`,{className:`ml-3 shrink-0 rounded-sm border border-hairline px-1.5 py-px font-mono text-[10px] tracking-wider text-text-3`,title:lv(t),children:[`Lap `,t]})]})}function O2({feature:e,isDraft:t,steps:n,onViewPhase:r}){let i=qy();return(0,R.jsxs)(`div`,{className:`ws-head`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-2.5`,children:[t?(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-sm font-semibold lowercase text-text-4`,children:`draft`}):(0,R.jsx)(YO,{phase:e.phase}),(0,R.jsx)(`span`,{className:`ws-title min-w-0 flex-1 truncate`,title:e.title,children:e.title}),(0,R.jsxs)(`button`,{className:`inline-flex min-w-0 items-center gap-1.5 self-center border-0 bg-transparent p-0 font-mono text-xs text-text-3 transition-colors duration-(--dur-1) hover:text-text`,title:`Copy branch name`,onClick:()=>$j(e.branch,i),children:[(0,R.jsx)(Lh,{size:11,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.branch})]})]}),!t&&(0,R.jsx)(D2,{steps:n,lap:e.lap,onView:t=>r(t===e.phase?null:t)})]})}var k2={danger:`border-danger/30 text-danger`,note:`border-hairline text-text-2`,clear:`border-ok/30 text-ok`},A2={danger:`bg-danger`,note:`bg-text-4`,clear:`bg-ok`};function j2({ns:e,guidance:t,busy:n,onAction:r,draftBranch:i}){let a=[e.primary,...e.secondary].filter(e=>!!e?.disabled&&!!e.escape);return(0,R.jsxs)(`div`,{className:`flex min-h-24 flex-wrap items-center gap-6 border-b bg-panel-2 px-6 py-4 ${e.alert?`border-warn`:`border-hairline`}`,role:e.alert?`alert`:void 0,children:[e.busy&&(0,R.jsx)(`span`,{className:`size-4 animate-spin rounded-pill border-2 border-hairline-strong border-t-accent`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 basis-[26rem]`,children:[(0,R.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-[0.12em] text-text-3`,children:e.kick}),e.title&&(0,R.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-text`,children:e.title}),e.counts&&(0,R.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-sm text-text-2`,children:[e.counts.pills.map(e=>(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-pill border px-2.5 py-0.5 font-mono text-sm ${k2[e.tone]}`,children:[(0,R.jsx)(`span`,{className:`size-1.5 rounded-pill ${A2[e.tone]}`}),e.label]},e.label)),e.counts.trailing&&(0,R.jsx)(`span`,{children:e.counts.trailing})]}),t&&e.desc&&(0,R.jsx)(`div`,{className:`mt-1 max-w-[68ch] text-sm text-text-2`,children:e.desc}),e.note&&(0,R.jsx)(`div`,{className:`mt-2 text-sm text-text-3`,role:`note`,children:e.note}),a.map(e=>(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-text-3`,children:[(0,R.jsx)(`span`,{children:e.disabled}),(0,R.jsx)(J,{size:`xs`,onClick:()=>r(e.escape.kind),disabled:n,children:e.escape.label})]},e.kind))]}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-2`,children:[e.secondary.map((e,t)=>(0,R.jsx)(J,{variant:`ghost`,disabled:n||!!e.disabled,title:e.disabled??e.hint,onClick:()=>r(e.kind,e.waypointId),children:e.label},t)),e.primary&&(0,R.jsxs)(R.Fragment,{children:[i&&(0,R.jsx)(UO,{prefix:`from`,value:i.value,branches:i.branches,detected:i.detected,missing:i.missing,onPick:i.onPick}),(0,R.jsx)(J,{variant:e.primary.danger?`danger`:`solid`,disabled:n||!!e.primary.disabled,title:e.primary.disabled,onClick:()=>r(e.primary.kind,e.primary.waypointId),children:n?`Working…`:e.primary.label}),i&&e.primary.disabled===`pick a branch first`&&(0,R.jsx)(`span`,{className:`text-sm text-warn`,children:`pick a branch first`})]})]})]})}function M2({phase:e,livePhase:t,facts:n,onBack:r}){return(0,R.jsxs)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-3 border-b border-hairline bg-panel-2 px-6 py-3`,children:[(0,R.jsx)(`span`,{className:`rounded-sm border border-hairline px-1.5 py-0.5 font-mono text-[10.5px] tracking-wider text-text-3 uppercase`,children:`READ-ONLY`}),(0,R.jsx)(`span`,{className:`font-semibold text-text capitalize`,children:kv[e]}),n&&(0,R.jsxs)(`span`,{className:`min-w-0 truncate text-sm text-text-3`,children:[`· `,n]}),(0,R.jsxs)(`button`,{type:`button`,className:`ml-auto bg-transparent p-0 text-sm text-accent-hi hover:text-accent-2`,onClick:r,children:[`Back to `,kv[t],` →`]})]})}function N2(e){let t=yM(e),[n,r]=(0,L.useState)(null),i=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(t.length===0)return;let e=t[t.length-1].id;if(i.current===null){i.current=e;return}let n=i.current;i.current=e;let a=t.filter(e=>e.id>n&&e.type===`session.resume_failed`),o=a[a.length-1];o&&r(o.message||`session resume failed — relaunch to continue`)},[t]),(0,L.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(null),8e3);return()=>clearTimeout(e)},[n]),{message:n,dismiss:()=>r(null)}}function P2({featureId:e,viewedPhase:t,onViewPhase:n,guidance:r,mapRailCollapsed:i,onToggleMapRail:a,artifactPaneCollapsed:o,onToggleArtifactPane:s,chatPanelOpen:c,onToggleChatPanel:l,driving:u,onDriveChange:d}){let f=B.useUtils(),p=qy(),m=B.feature.get.useQuery({id:e},{refetchInterval:$m()}),h=N2(e),g=yM(e),_=Md(g),v=Ng(g),y=m.data?.feature.phase===`review`,b=B.feature.mergeDelta.useQuery({featureId:e},{refetchInterval:$m(5e3),enabled:y}),x=$m(),S=y?x:!1,C=B.notes.list.useQuery({featureId:e},{refetchInterval:S}),w=C.data?.filter(e=>e.status===`open`)??[],T=C.data?w.length:void 0,E=B.findings.listByFeature.useQuery({featureId:e},{refetchInterval:S}),D=E.data?.openDefects??[],O=E.data?.summary.open,k=Hm(e,y),A=Hv(k.data??[]),j=Wv(A,{landedSince:A?.landedSince??0,lap:m.data?.feature.lap??1},Gv(m.data?.tickets??[])),M=ny({passes:k.data??[],tickets:m.data?.tickets??[],currentLap:m.data?.feature.lap??1}),[N,P]=(0,L.useState)(!1),[F,ee]=(0,L.useState)(!1),te=!!m.data&&m.data.feature.phase!==`shipped`,ne=B.feature.burnWarnings.useQuery({featureId:e},{refetchInterval:$m(),enabled:te}),[I,re]=(0,L.useState)(null),ie=B.notes.triagePreview.useQuery({featureId:e},{enabled:I!==null}),ae=m.data?J_(m.data):void 0,oe=B.docs.read.useQuery({featureId:e,relPath:ae??`map.md`},{enabled:!!ae}),se=m.data?.feature.phase===`review`?ay(m.data):void 0,ce=sy(B.docs.read.useQuery({featureId:e,relPath:se??`spec.md`},{enabled:!!se}).data?.content),le=m.data?.feature.projectId,ue=B.project.prep.useQuery({projectId:le??``},{enabled:!!le,refetchInterval:$m()}),de=B.feature.driveInfo.useQuery(void 0,{refetchInterval:$m()}),fe=B.ticket.durationStats.useQuery({projectId:le??``},{enabled:!!le}),pe=pm(B.settings.get.useQuery({projectId:le??``},{enabled:!!le&&te}).data,`implement`),me=m.data?.feature.phase===`planning`||m.data?.feature.phase===`building`,he=B.docs.digestSize.useQuery({featureId:e},{enabled:me}),ge=m.data?.feature.status===`draft`,_e=B.project.branches.useQuery({projectId:le??``},{enabled:!!le&&ge}),[ve,ye]=(0,L.useState)(null),be=(ve?.featureId===e?ve.base:``)||(_e.data?Cg(_e.data):``),xe=!ge||be?void 0:_e.data?`unpicked`:`loading`,Se=nU(m_(m.data?.runs??[])),Ce=rU(e,iU(m.data?.docs??[],`decisions.md`)).content,we=()=>{f.feature.get.invalidate({id:e}),f.feature.list.invalidate(),f.events.invalidate()},Te=B.feature.launchSession.useMutation({onSuccess:we,onError:e=>p.push(e.message)}),Ee=B.feature.burn.useMutation({onSuccess:()=>{we(),n(null)},onError:e=>p.push(e.message)}),De=B.feature.converge.useMutation({onSuccess:()=>{we(),n(null)},onError:e=>p.push(e.message)}),Oe=B.feature.workWaypoint.useMutation({onSuccess:we,onError:e=>p.push(e.message)}),ke=B.feature.endSession.useMutation({onError:e=>p.push(e.message)}),Ae=B.notes.triage.useMutation(),je=B.findings.dismiss.useMutation(),Me=B.run.cancel.useMutation({onSuccess:e=>{we(),e.confirmed?p.push(`run cancelled — its agents are stopped`,`info`):p.push(sv)},onError:e=>p.push(e.message)}),Ne=B.feature.fixDrive.useMutation({onSuccess:we,onError:e=>p.push(e.message)}),Pe=B.feature.testDrive.useMutation({onSuccess:e=>{if(we(),e.hookFailure){let t=e.hookFailure;p.push(`${t.phase===`setup`?`Test drive setup`:`Test drive teardown`} failed: ${t.command}${t.timedOut?` (timed out)`:``} — see the timeline for its output`)}e.dbDrift&&p.push(e.dbDrift.resetCommand?`Migrations differ between the branches — your dev database may be ahead. Rebuild it with: ${e.dbDrift.resetCommand}`:`Migrations differ between the branches — your dev database may be ahead. Set a database reset command in settings for a one-line fix here.`,`info`),e.carriedChanges?.length&&p.push(`${e.carriedChanges.length} uncommitted file(s) came back with you onto ${e.branch}`,`info`)},onError:e=>p.push(e.message)}),Fe=B.feature.merge.useMutation({onSettled:we,onError:e=>p.push(e.message)}),Ie=B.feature.unarchive.useMutation({onSuccess:()=>{we(),p.push(`feature unarchived`,`success`)},onError:e=>p.push(e.message)}),Le=B.feature.start.useMutation({onSuccess:(e,t)=>{we(),Te.mutate({featureId:t.featureId,kind:`chat`})},onError:e=>p.push(e.message)}),Re=tU(e,m.data?.feature.branch??``);if(m.isLoading)return(0,R.jsx)(`section`,{className:`workspace`,children:(0,R.jsx)(`div`,{className:`ws-body`,children:(0,R.jsx)(NO,{children:`loading feature…`})})});if(!m.data)return(0,R.jsx)(`section`,{className:`workspace`,children:(0,R.jsx)(`div`,{className:`ws-body`,children:(0,R.jsxs)(NO,{children:[`could not load feature`,m.error?`: ${m.error.message}`:``]})})});let ze=!!m.error,Be=m.data,Ve=Be.feature;if(td(Ve.phase)===null)return(0,R.jsx)(C2,{feature:Ve});let He=Fv(Ve,t),Ue=Iv(Ve,He),We=!ge&&(He===`planning`||He===`review`),Ge=Lv(Ve,He,{planning:(e=>Oy({phase:e,full:Be,events:g,decisions:Ce}))(`planning`)}),Ke=m_(Be.runs),qe=x_(g,Ke?.id),Je=Se&&Ke?.id===Se&&He===`review`?`building`:He,Ye=Dv(Be,{driving:u?.featureId===Ve.id,driveState:de.data?.featureId===Ve.id?de.data.state:`idle`,mapContent:oe.data?.content,conflict:_,unverifiedDriveKeys:jp(ue.data?.findings??[]),...de.data&&de.data.featureId!==Ve.id?{slotHolder:de.data.holderLabel}:{},...fe.data?{burnStats:fe.data}:{},...he.data?{docsDigestBytes:he.data.bytes}:{},...xe?{draftBaseMissing:xe}:{},openNotes:T,openDefects:O,...M?{unverifiedReview:{reason:M.reason}}:{},laterLaps:ce,interruptedBurn:qe}),Xe=Vg(Be.sessions),Ze=Xe?.kind===`chat`?Xe:void 0,Qe=Le.isPending||Te.isPending||Ee.isPending||De.isPending||Oe.isPending||Me.isPending||Pe.isPending||Fe.isPending||Ae.isPending||je.isPending||Ne.isPending||Ie.isPending||ke.isPending||Re.pending,$e=()=>{(T??0)+(O??0)>0?re(Date.now()):Te.mutate({featureId:e,kind:`chat`})},et=async()=>{if(!Xe)return!0;try{await ke.mutateAsync({sessionId:Xe.id})}catch{return!1}return we(),!0},tt=async t=>{let{dismissFindingIds:n,...r}=t;try{for(let e of n)await je.mutateAsync({findingId:e});await Ae.mutateAsync({featureId:e,...r}),re(null),we(),f.notes.list.invalidate({featureId:e}),f.findings.listByFeature.invalidate({featureId:e}),t.carry?await et()&&Te.mutate({featureId:e,kind:`chat`}):Ee.mutate({featureId:e})}catch(e){p.push(e instanceof Error?e.message:String(e))}},nt=()=>{Te.mutate({featureId:e,kind:`chat`})},rt=()=>{!c&&!Ze&&nt(),l()},it=(t,n)=>{switch(t){case`startDraft`:Le.mutate({featureId:e,baseBranch:be});break;case`chat`:rt();break;case`iterate`:$e();break;case`endSessionAndIterate`:et().then(e=>{e&&$e()});break;case`converge`:case`resumeConverge`:De.mutate({featureId:e});break;case`workNext`:n&&Oe.mutate({featureId:e,waypointId:n});break;case`burn`:ee(!0);break;case`cancelRun`:Ke&&Me.mutate({runId:Ke.id});break;case`unarchive`:Ie.mutate({featureId:e});break;case`testDriveStart`:Pe.mutate({featureId:e,action:`start`},{onSuccess:t=>{we(),t.ok&&t.branch?d({featureId:e,branch:t.branch}):t.ok||p.push(t.deniedReason??`test drive denied`)}});break;case`testDriveStop`:Pe.mutate({featureId:e,action:`stop`},{onSuccess:()=>{we(),d(null)}});break;case`stopDriveAndIterate`:Pe.mutate({featureId:e,action:`stop`},{onSuccess:()=>{we(),d(null),$e()}});break;case`fixDrive`:Ne.mutate({featureId:e});break;case`merge`:P(!0);break;case`resolveConflict`:_&&Re.resolve(_,Xe?.id);break;default:}},at=()=>{Ee.mutate({featureId:e},{onSuccess:()=>ee(!1)})},ot=()=>{Fe.mutate({featureId:e},{onSuccess:e=>{if(we(),P(!1),e.ok)d(null),p.push(`merged — feature shipped`,`success`);else if(e.conflict){let t=e.files.length;p.push(t>0?`merge conflict in ${t} file${t===1?``:`s`} — resolve below and retry`:`merge conflict — resolve below and retry`)}}})};return(0,R.jsxs)(`section`,{className:`workspace overflow-clip`,children:[(0,R.jsx)(O2,{feature:Ve,isDraft:ge,steps:Ge,onViewPhase:n}),Ue?(0,R.jsx)(M2,{phase:He,livePhase:Ve.phase,facts:ky({phase:He,full:Be,events:g,decisions:Ce}),onBack:()=>n(null)}):(0,R.jsx)(j2,{ns:Ye,guidance:r,busy:Qe,onAction:it,draftBranch:ge?{branches:_e.data?.branches,value:be||null,detected:_e.data?.detected,missing:xe===`unpicked`,onPick:t=>ye({featureId:e,base:t})}:void 0}),ze&&(0,R.jsxs)(`div`,{className:`ws-banner is-offline`,role:`status`,children:[(0,R.jsx)(`span`,{className:`ws-banner-tag`,children:`OFFLINE`}),(0,R.jsx)(`span`,{children:`server unreachable — retrying…`})]}),h.message&&(0,R.jsxs)(`div`,{className:`ws-banner`,role:`alert`,onClick:h.dismiss,title:`dismiss`,children:[(0,R.jsx)(`span`,{className:`ws-banner-tag`,children:`RESUME FAILED`}),(0,R.jsx)(`span`,{children:h.message})]}),F&&(0,R.jsx)(aU,{title:Ve.title,branch:Ve.branch,summary:_y({branch:Ve.branch,pendingTickets:Qg(Be.tickets),lap:hy(Be.runs),...pe?{defaultModel:pe}:{},warnings:ne.data}),busy:Ee.isPending,warningsPending:!ne.data,onConfirm:at,onCancel:()=>ee(!1)}),N&&(0,R.jsx)(sU,{title:Ve.title,branch:Ve.branch,base:b.data?.base,summary:my({branch:Ve.branch,...b.data?.base?{base:b.data.base}:{},...b.data?{delta:b.data}:{},tickets:Be.tickets,lap:Ve.lap,driveTaken:v,openNotes:T,...de.data?.projectDrive&&de.data.projectId===Ve.projectId?{projectDrive:{holderLabel:de.data.holderLabel}}:{},freshness:j,conflict:_,laterLaps:ce,burning:Ke?.status===`running`}),busy:Fe.isPending,resolving:Re.pending,onConfirm:ot,onResolve:_?()=>void Re.resolve(_,Xe?.id??void 0):void 0,onCancel:()=>P(!1)}),I!==null&&(0,R.jsx)(DU,{lap:Ve.lap,notes:w,defects:D,standing:ie.data?.standingFixTickets??[],openedAt:I,busy:Qe,readonly:Ue,sessionLive:!!Xe,onCommit:e=>void tt(e),onClose:()=>re(null)}),(0,R.jsx)(y2,{open:c,panel:(0,R.jsx)(b2,{featureId:e,sessions:Be.sessions,busy:Te.isPending,onOpenChat:nt,onCollapse:l}),children:(0,R.jsx)(`div`,{className:We?`flex min-h-0 flex-1 overflow-hidden`:`ws-body`,children:(0,R.jsx)(`div`,{className:We?`flex min-h-0 min-w-0 flex-1`:`ws-body-inner`,children:ge?(0,R.jsx)(AU,{full:Be}):(0,R.jsx)(F2,{effective:Je,full:Be,events:g,driving:u,conflict:_,runId:Ke?.id??null,readonly:Ue,chatDocked:c,mapRailCollapsed:i,onToggleMapRail:a,onViewPhase:n,artifactPaneCollapsed:o,onToggleArtifactPane:s})},ge?`draft`:Je)})})]})}function F2({effective:e,full:t,events:n,driving:r,conflict:i,runId:a,readonly:o,chatDocked:s,mapRailCollapsed:c,onToggleMapRail:l,onViewPhase:u,artifactPaneCollapsed:d,onToggleArtifactPane:f}){if(o&&e===`planning`)return(0,R.jsx)(u1,{full:t,effective:e,events:n,mapRailCollapsed:c,onToggleMapRail:l});switch(e){case`planning`:return(0,R.jsx)(EQ,{full:t,effective:e,chatDocked:s,mapRailCollapsed:c,onToggleMapRail:l,artifactPaneCollapsed:d,onToggleArtifactPane:f});case`building`:return a?(0,R.jsx)(_2,{featureId:t.feature.id,runId:a,readonly:o,chatDocked:s}):(0,R.jsx)(J0,{featureId:t.feature.id,chatDocked:s});case`review`:return(0,R.jsx)(V0,{full:t,driving:r,conflict:i,readonly:o,onViewPhase:u});case`shipped`:return(0,R.jsx)(G0,{full:t,chatDocked:s})}}function I2(e){let t=B.useUtils(),n=qy(),r=B.project.sessionBranch.useQuery({projectId:e}),i=B.project.branches.useQuery({projectId:e,includeFeatureBranches:!0}),a=My(r.data,i.data?.branches),o=B.settings.update.useMutation({onSuccess:()=>{t.project.sessionBranch.invalidate(),t.settings.get.invalidate()},onError:e=>n.push(e.message)});return{value:a?.value??null,branches:i.data?.branches,detected:r.data?.detected,missing:a?.origin===`vanished`,pick:t=>o.mutate({projectId:e,key:`sessionBranch`,value:t}),picking:o.isPending}}function L2({conversations:e,pending:t,busy:n,onResume:r,onOpen:i,onView:a}){return t?null:(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(MO,{children:`Conversations`}),e.length===0?(0,R.jsx)(NO,{children:`No conversations yet.`}):(0,R.jsx)(`div`,{className:`flex flex-col`,children:[...e].sort((e,t)=>Number(t.status!==`ended`)-Number(e.status!==`ended`)).map(e=>(0,R.jsxs)(`div`,{className:`group -mx-3 grid h-11 grid-cols-[1fr_auto_auto] items-center gap-4 rounded-md border-t border-hairline-soft px-3 first:border-t-0 hover:bg-panel-3`,children:[(0,R.jsxs)(`button`,{className:`flex min-w-0 items-center gap-2.5 text-left text-base text-text`,onClick:()=>a(e),children:[e.status!==`ended`&&(0,R.jsx)(uk,{status:e.status}),(0,R.jsx)(`span`,{className:`truncate`,children:e.title})]}),(0,R.jsx)(`span`,{className:`font-mono text-sm text-text-3 tabular-nums`,children:e.createdAt===null?``:s_(e.createdAt)}),(0,R.jsx)(J,{className:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,disabled:n||!e.resumable,title:e.resumable?void 0:`this one never got started`,onClick:()=>e.status===`ended`?r(e.id):i?.(e.id),children:e.status===`ended`?`Reopen`:`Open`})]},e.id))})]})}function R2({landing:e,onStart:t,starting:n,openSession:r}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-hairline bg-panel px-6 py-5`,children:[r&&(0,R.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 rounded-md border border-hairline bg-panel-2 px-4 py-3`,children:[(0,R.jsx)(`span`,{className:`mr-auto text-sm text-text-2`,children:`A chat is already open.`}),(0,R.jsx)(J,{onClick:r.onOpen,children:`Open it`}),(0,R.jsx)(J,{variant:`solid`,disabled:n,onClick:r.onReplace,children:n?`Opening…`:`End it and start new`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 text-lg font-semibold text-text`,children:`Talk it through`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[46ch] text-sm text-text-2`,children:`Bring a raw idea; the chat checks it against what’s built and cuts it into features.`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(UO,{prefix:`landing on`,value:e.value,branches:e.branches,detected:e.detected,missing:e.missing,disabled:e.picking,onPick:e.pick}),(0,R.jsx)(J,{variant:`solid`,disabled:n||e.missing,title:e.missing?`the branch this chat would land on is gone — pick another`:void 0,onClick:t,children:n?`Opening…`:`New chat`})]})]})]})}function z2({lead:e,when:t,actions:n,className:r=`py-1.5 pr-3 pl-4.5`,children:i}){return(0,R.jsxs)(`li`,{className:`group grid min-h-10.5 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 border-t border-hairline-soft first:border-t-0 focus-within:bg-panel-3 hover:bg-panel-3 ${r}`,children:[e,(0,R.jsx)(`div`,{className:`flex min-w-0 flex-col text-base wrap-anywhere`,children:i}),(0,R.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[t&&(0,R.jsx)(`span`,{className:`pr-1.5 font-mono text-xs text-text-3 tabular-nums ${n?`group-focus-within:hidden group-hover:hidden`:``}`,children:t}),n&&(0,R.jsx)(`span`,{className:`flex gap-0.5 opacity-0 transition-opacity duration-(--dur-1) group-focus-within:opacity-100 group-hover:opacity-100`,children:n})]})]})}function B2({note:e}){let t=eb(e);return t?(0,R.jsx)(`span`,{className:`mt-px font-mono text-xs text-drive`,title:t.title,children:t.label}):null}function V2({projectId:e,onTriage:t,triaging:n,reveal:r=!1,onRevealed:i}){let a=B.useUtils(),o=qy(),s=B.projectNotes.list.useQuery({projectId:e},{refetchInterval:$m()}),c=B.feature.list.useQuery({projectId:e},{refetchInterval:$m()}),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(null),h=e=>o.push(e.message),g=()=>void a.projectNotes.invalidate(),_=B.projectNotes.edit.useMutation({onSuccess:()=>{g(),u(null)},onError:h}),v=B.projectNotes.delete.useMutation({onSuccess:g,onError:h}),y=B.projectNotes.dismiss.useMutation({onSuccess:g,onError:h}),b=B.projectNotes.reopen.useMutation({onSuccess:g,onError:h}),x=s.data??[],S=_.isPending||v.isPending||y.isPending||b.isPending,C=W2(x.filter(e=>e.status===`open`)),w=W2(x.filter(e=>e.status===`triaged`)),T=(0,L.useRef)(null),E=x.length>0;if((0,L.useEffect)(()=>{!r||!T.current||(T.current.scrollIntoView?.({block:`center`}),i?.())},[r,E,i]),!E)return null;let D=e=>{d.trim()&&!_.isPending&&_.mutate({noteId:e,text:d})};return(0,R.jsxs)(`section`,{ref:T,"aria-label":`Notes`,className:`rounded-lg border border-hairline bg-panel`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-hairline-soft py-3 pr-3 pl-4.5`,children:[(0,R.jsx)(`h3`,{className:`m-0 text-base font-semibold text-text`,children:`Notes`}),C.length>0&&(0,R.jsx)(`span`,{className:`inline-grid h-4.5 min-w-4.5 place-items-center rounded-pill border border-accent-line bg-accent-soft px-1.5 text-xs font-semibold text-accent-hi tabular-nums`,title:`${C.length} open`,children:C.length}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-text-3`,children:`Grouped, questioned and routed in a triage chat.`}),(0,R.jsx)(J,{variant:`accent`,className:`shrink-0`,disabled:C.length===0||n,title:C.length===0?`nothing is open to triage`:void 0,onClick:t,children:n?`Opening…`:`Triage ${C.length}`})]}),(0,R.jsx)(`ul`,{className:H2,children:C.length===0?(0,R.jsx)(`li`,{className:`px-4.5 py-3 text-sm text-text-3`,children:`Nothing open — every note has been triaged.`}):C.map(e=>(0,R.jsx)(z2,{lead:e.screenshotUrl?(0,R.jsx)(fk,{size:`sm`,url:e.screenshotUrl,onOpen:m}):(0,R.jsx)(`span`,{className:`grid w-10 place-items-center`,"aria-hidden":!0,children:(0,R.jsx)(`i`,{className:`size-1.25 rounded-pill bg-accent-line`})}),when:s_(e.createdAt),actions:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K2,{label:`Edit`,onClick:()=>{u(e.id),f(e.text)},children:(0,R.jsx)(Zh,{size:14})}),(0,R.jsx)(K2,{label:`Dismiss`,disabled:S,onClick:()=>y.mutate({noteId:e.id}),children:(0,R.jsx)(Vh,{size:14})}),(0,R.jsx)(K2,{label:`Delete`,tone:`danger`,disabled:S,onClick:()=>v.mutate({noteId:e.id}),children:(0,R.jsx)(Uh,{size:14})})]}),children:l===e.id?(0,R.jsx)(`input`,{"aria-label":`edit this note`,className:U2,value:d,autoFocus:!0,onChange:e=>f(e.target.value),onKeyDown:t=>{t.key===`Escape`?(t.preventDefault(),u(null)):t.key===`Enter`&&(t.preventDefault(),D(e.id))}}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-text`,children:e.text}),(0,R.jsx)(B2,{note:e})]})},e.id))}),w.length>0&&(0,R.jsxs)(`details`,{className:`group/tri border-t border-hairline-soft`,children:[(0,R.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1.5 px-4.5 py-2.5 text-sm text-text-3 hover:text-text-2 [&::-webkit-details-marker]:hidden`,children:[(0,R.jsx)(Kh,{size:12,className:`transition-transform duration-(--dur-1) group-open/tri:rotate-90`}),w.length,` triaged`]}),(0,R.jsx)(`ul`,{className:H2,children:w.map(t=>(0,R.jsxs)(z2,{lead:t.screenshotUrl?(0,R.jsx)(fk,{size:`sm`,url:t.screenshotUrl,onOpen:m}):(0,R.jsx)(`span`,{className:`w-10`,"aria-hidden":!0}),actions:(0,R.jsx)(K2,{label:`Reopen`,disabled:S,onClick:()=>b.mutate({noteId:t.id}),children:(0,R.jsx)(Wh,{size:14})}),children:[(0,R.jsx)(`span`,{className:`text-text-3`,children:t.text}),(0,R.jsx)(B2,{note:t}),(0,R.jsxs)(`span`,{className:`mt-px flex flex-wrap items-baseline gap-x-2 text-sm text-text-3`,children:[(0,R.jsx)(`span`,{children:t.outcome}),(0,R.jsx)(q2,{projectId:e,feature:c.data?.find(e=>e.id===t.featureId)})]})]},t.id))})]}),(0,R.jsx)(lU,{url:p,onClose:()=>m(null)})]})}var H2=`m-0 list-none py-1 pl-0`,U2=`h-7 w-full min-w-0 rounded-sm border border-accent-line bg-panel-inset px-2 text-base text-text focus:outline-none`;function W2(e){return[...e].sort((e,t)=>t.createdAt-e.createdAt)}var G2={plain:`group-hover/act:text-text`,danger:`group-hover/act:text-danger`};function K2({label:e,tone:t=`plain`,disabled:n,onClick:r,children:i}){return(0,R.jsx)(`button`,{type:`button`,"aria-label":e,title:e,disabled:n,onClick:r,className:`${AO} group/act grid size-6.5 cursor-pointer place-items-center rounded-sm p-0 hover:bg-hairline disabled:cursor-not-allowed disabled:opacity-40`,children:(0,R.jsx)(`span`,{className:`flex text-text-3 ${G2[t]}`,children:i})})}function q2({projectId:e,feature:t}){return t?(0,R.jsx)(`a`,{className:`text-accent-hi underline decoration-dotted`,href:bh({kind:`feature`,projectId:e,featureSlug:t.slug}),children:t.title}):null}function J2({conversation:e,onBack:t,onReopen:n,reopening:r,children:i}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(J,{className:`border-transparent text-text-2`,onClick:t,children:`← Conversations`}),(0,R.jsx)(`span`,{className:`truncate text-lg font-semibold text-text`,children:e.title}),e.createdAt!==null&&(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-sm text-text-3`,children:s_(e.createdAt)}),(0,R.jsx)(J,{className:`ml-auto`,disabled:r||!e.resumable,onClick:n,children:r?`Opening…`:e.status===`ended`?`Reopen`:`Open`})]}),i]})}function Y2({session:e,title:t,branch:n,hidden:r,onBack:i,endControl:a,switcher:o,children:s}){return(0,R.jsxs)(`div`,{className:r?`hidden`:`flex min-h-0 flex-1 flex-col`,"data-live-chat":!0,"aria-hidden":r,children:[(0,R.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-hairline-soft bg-panel px-4`,children:[(0,R.jsx)(J,{className:`border-transparent text-text-2`,onClick:i,children:`← Conversations`}),(0,R.jsx)(`span`,{className:`max-w-[36ch] truncate rounded-pill border border-accent-line bg-accent-soft px-2 py-0.5 font-mono text-xs text-accent-hi`,children:t}),(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-text-3`,children:[(0,R.jsx)(uk,{status:e.status}),Bg(e)]}),(0,R.jsxs)(`span`,{className:`rounded-pill border border-hairline px-2 py-0.5 font-mono text-xs text-text-2`,children:[`→ `,n??`…`]}),(0,R.jsx)(`span`,{className:`flex-1`}),o,(0,R.jsx)(`span`,{className:`font-mono text-xs text-text-3`,title:e.ccSessionId??e.id,children:(e.ccSessionId??e.id).slice(0,8)}),a]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 bg-panel-inset`,children:s})]})}function X2({projectId:e,startedAt:t}){let n=B.projectNotes.list.useQuery({projectId:e},{refetchInterval:$m()}),[r,i]=(0,L.useState)(null),{thisDrive:a,alreadyOpen:o}=$y(n.data??[],t),s=a.length+o.length;return(0,R.jsxs)(`aside`,{"aria-label":`Project notes`,className:`flex min-h-0 w-[320px] shrink-0 flex-col border-l border-hairline bg-panel-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5 py-3 pr-3 pl-3.5`,children:[(0,R.jsx)(`h3`,{className:`m-0 text-base font-semibold text-text`,children:`Notes`}),s>0&&(0,R.jsx)(`span`,{className:`inline-grid h-4.5 min-w-4.5 place-items-center rounded-pill border border-accent-line bg-accent-soft px-1.5 text-xs font-semibold text-accent-hi tabular-nums`,title:`${s} open`,children:s}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-text-3`,children:`to the project’s inbox`})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,R.jsx)(Z2,{title:`This drive`,children:a.length===0?(0,R.jsx)(Q2,{children:`Nothing yet. Select an area of the app, or type below.`}):a.map(e=>(0,R.jsx)($2,{note:e,onOpen:i},e.id))}),(0,R.jsx)(Z2,{title:`Already open`,children:o.length===0?(0,R.jsx)(Q2,{children:`No other open notes.`}):o.map(e=>(0,R.jsx)($2,{note:e,onOpen:i},e.id))})]}),(0,R.jsx)(e4,{projectId:e}),(0,R.jsx)(lU,{url:r,onClose:()=>i(null)})]})}function Z2({title:e,children:t}){return(0,R.jsxs)(`section`,{"aria-label":e,children:[(0,R.jsx)(`h4`,{className:`m-0 px-3.5 pt-2.5 pb-1 text-xs font-semibold tracking-[0.1em] text-text-3 uppercase`,children:e}),(0,R.jsx)(`ul`,{className:`m-0 list-none py-1 pl-0`,children:t})]})}function Q2({children:e}){return(0,R.jsx)(`li`,{className:`px-3.5 py-1.5 text-sm text-text-3`,children:e})}function $2({note:e,onOpen:t}){return(0,R.jsxs)(z2,{className:`py-1.5 pr-2.5 pl-3.5`,lead:e.screenshotUrl?(0,R.jsx)(fk,{size:`sm`,url:e.screenshotUrl,onOpen:t}):(0,R.jsx)(`span`,{className:`grid w-10 place-items-center`,"aria-hidden":!0,children:(0,R.jsx)(`i`,{className:`size-1.25 rounded-pill bg-accent-line`})}),when:s_(e.createdAt),children:[(0,R.jsx)(`span`,{className:`text-sm text-text`,children:e.text}),(0,R.jsx)(B2,{note:e})]})}function e4({projectId:e}){let t=B.useUtils(),n=qy(),r=B.projectNotes.add.useMutation(),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>URL.revokeObjectURL(o?.preview??``),[o]);let d=e=>{let t=Um(e.clipboardData);t&&(e.preventDefault(),Wm(t).then(e=>s({png:e,preview:URL.createObjectURL(e)})).catch(e=>n.push(e instanceof Error?e.message:`that image could not be read`)))},f=async()=>{if(!(!i.trim()||c)){l(!0);try{let c=await r.mutateAsync({projectId:e,text:i});if(o)try{await Yy(c.id,o.png)}catch(e){n.push(`the note was saved, but its picture was not: ${e instanceof Error?e.message:String(e)}`)}t.projectNotes.invalidate(),a(``),s(null),u.current?.focus()}catch(e){n.push(e instanceof Error?e.message:`the note could not be saved`)}finally{l(!1)}}};return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-hairline bg-panel p-2.5`,onPaste:d,children:[(0,R.jsx)(`input`,{ref:u,className:`h-8 min-w-0 rounded-sm border border-hairline bg-panel-inset px-2.5 font-sans text-sm text-text outline-none placeholder:text-text-4 focus:border-accent-line`,autoComplete:`off`,"aria-label":`New note`,placeholder:`What did you just notice?`,value:i,disabled:c,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f())}}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5 text-xs text-text-3`,children:[o?(0,R.jsxs)(`span`,{className:`inline-flex h-5 items-center gap-1.5 rounded-sm border border-hairline-strong bg-panel-3 pr-0.5 pl-0.5 text-text-2`,children:[(0,R.jsx)(`img`,{src:o.preview,alt:`the picture this note will carry`,className:`h-4 w-6 rounded-[3px] bg-black object-cover`}),`Screenshot`,(0,R.jsx)(`button`,{type:`button`,className:`flex size-4 cursor-pointer items-center justify-center rounded-[4px] border-0 bg-transparent p-0 hover:bg-hairline`,"aria-label":`remove the picture`,title:`Remove the picture`,onClick:()=>s(null),children:(0,R.jsx)(`span`,{className:`flex items-center text-text-3`,children:(0,R.jsx)(Hh,{size:10})})})]}):(0,R.jsx)(`span`,{children:`paste a screenshot`}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(BO,{children:`↵`}),` save`]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(BO,{children:gb(`J`)}),` works too`]})]})]})}function t4({projectId:e,repoPath:t,drive:n,hidden:r,onProjectPage:i,onStop:a,stopping:o,onOpenPreparation:s,switcher:c}){let l=(0,R.jsx)(J,{disabled:o,onClick:a,children:o?`Stopping…`:`Stop drive`});return(0,R.jsxs)(`div`,{className:r?`hidden`:`flex min-h-0 flex-1`,"aria-hidden":r,"data-project-drive":!0,children:[(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-y-auto p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,R.jsxs)(`h2`,{className:`m-0 shrink-0 text-base font-semibold text-text`,children:[`Driving`,` `,(0,R.jsx)(`code`,{className:`rounded-sm border border-accent-line bg-accent-soft px-1.5 font-mono text-sm text-drive`,children:n.branch})]}),(0,R.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-xs text-text-3`,title:n.commit?`${t??``} @ ${n.commit}`:t,children:[t,n.commit&&` @ ${n.commit}`]})]}),c,(0,R.jsx)(J,{onClick:i,children:`Project page`}),l]}),(0,R.jsx)(n4,{projectId:e,drive:n,stop:l,onOpenPreparation:s}),(0,R.jsx)(j1,{branch:n.branch,drive:n})]}),(0,R.jsx)(X2,{projectId:e,startedAt:n.startedAt})]})}function n4({projectId:e,drive:t,stop:n,onOpenPreparation:r}){let i=vv(t);switch(Cv(t.state).stageKind){case`failed`:return i?(0,R.jsx)(i4,{children:(0,R.jsx)(A1,{failure:i,explanation:(0,R.jsxs)(R.Fragment,{children:[`Your checkout is as it was, but`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:i.command}),` `,i.outcome,` — so whatever it was meant to bring up is probably not running. Preparation is where this project’s drive commands are repaired and proven.`]}),children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(J,{variant:`solid`,onClick:r,children:`Open preparation`}),n]})})}):(0,R.jsx)(i4,{children:(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`The drive’s setup command failed — its output is in the timeline.`})});case`bare`:return(0,R.jsx)(i4,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsx)(`div`,{className:`text-sm font-semibold text-text`,children:`Setup ran — nothing started.`}),(0,R.jsxs)(`div`,{className:`text-sm text-text-2`,children:[`This project has no dev command ·`,` `,(0,R.jsx)(r1,{location:{page:`project`,field:`devCommand`},children:`Set one in Settings`}),` `,`and the next drive boots the app right here.`]})]})});case`panel`:case`agent`:return t.devUrl?(0,R.jsx)(`div`,{className:`flex min-h-100 flex-1 flex-col`,children:(0,R.jsx)(c0,{projectId:e,url:t.devUrl})}):(0,R.jsx)(i4,{children:(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`The dev server is up but has not printed an address yet — its output is under the stage.`})});default:return(0,R.jsx)(i4,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,R.jsx)(`span`,{className:`size-2 animate-pulse rounded-pill bg-drive`}),(0,R.jsx)(`span`,{className:`text-sm font-semibold text-drive`,children:`starting the dev server…`})]}),(0,R.jsx)(`div`,{className:`text-sm text-text-2`,children:`Your checkout is driven as it is and the project’s dev command is running. The app appears here as soon as it answers — its output is under the stage.`})]})})}}function r4({front:e,onPick:t}){let n=(n,r,i)=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":e===n,onClick:()=>t(n),className:`inline-flex h-6.5 cursor-pointer items-center gap-1.5 border-0 px-2.5 ${e===n?`bg-panel-3`:`bg-transparent hover:bg-panel-2`}`,children:[(0,R.jsx)(`i`,{className:`size-1.5 rounded-pill ${i}`}),(0,R.jsx)(`span`,{className:`text-sm ${e===n?`text-text`:`text-text-3`}`,children:r})]});return(0,R.jsxs)(`span`,{role:`group`,"aria-label":`Show`,className:`inline-flex shrink-0 divide-x divide-hairline-strong overflow-hidden rounded-sm border border-hairline-strong`,children:[n(`chat`,`Chat`,`bg-ok`),n(`drive`,`Drive`,`bg-drive`)]})}function i4({children:e}){return(0,R.jsx)(`div`,{className:`flex min-h-65 flex-1 flex-col justify-center rounded-md border border-hairline bg-panel p-5`,children:e})}var a4=`project-drive`;function o4({card:e,branch:t,setupCommand:n,devCommand:r,stopCommand:i,starting:a,onStart:o,onPrepare:s,onReturn:c}){if(e.state===`hidden`)return null;let l=e.state===`running`;return(0,R.jsxs)(`section`,{"aria-label":`Test drive`,className:`flex flex-wrap items-center gap-6 rounded-lg border border-hairline bg-panel px-6 py-5`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-[240px] flex-1 flex-col gap-2`,children:[(0,R.jsxs)(`h2`,{className:`m-0 text-lg font-semibold text-text`,children:[`Test drive`,l&&(0,R.jsx)(`span`,{className:`font-normal text-drive`,children:` · running`})]}),(0,R.jsx)(`p`,{className:`m-0 max-w-[56ch] text-sm text-text-2`,children:`Run everything that has shipped and jot what you notice. Notes land below.`}),(0,R.jsxs)(`dl`,{className:`m-0 mt-1 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-sm`,children:[(0,R.jsxs)(s4,{term:`branch`,children:[(0,R.jsx)(`code`,{className:`font-mono text-text`,children:t??`…`}),` — your checkout, as it is. No branch switch.`]}),(0,R.jsx)(s4,{term:`as`,children:(0,R.jsx)(`code`,{className:`font-mono text-text`,children:a4})}),(0,R.jsx)(c4,{term:`setup`,command:n,field:`driveSetupCommand`}),(0,R.jsx)(c4,{term:`dev`,command:r,field:`devCommand`}),(0,R.jsx)(c4,{term:`stop`,command:i,field:`driveStopCommand`})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[e.state===`prepare`?(0,R.jsx)(J,{onClick:s,children:`Prepare drive`}):l?(0,R.jsx)(J,{onClick:c,children:`Return to drive`}):(0,R.jsxs)(J,{className:`gap-2`,disabled:e.state===`blocked`||a,title:e.state===`blocked`?e.reason:void 0,onClick:o,children:[(0,R.jsx)(ng,{size:12}),a?`Starting…`:`Test drive`]}),e.state===`blocked`&&(0,R.jsx)(`span`,{className:`max-w-[28ch] text-right text-xs text-text-3`,children:e.reason}),e.state===`prepare`&&(0,R.jsx)(`span`,{className:`max-w-[28ch] text-right text-xs text-text-3`,children:`no setup or dev command yet`})]})]})}function s4({term:e,children:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{className:`pt-px font-mono text-xs text-text-3`,children:e}),(0,R.jsx)(`dd`,{className:`m-0 min-w-0 wrap-anywhere text-text-2`,children:t})]})}function c4({term:e,command:t,field:n}){return(0,R.jsx)(s4,{term:e,children:t?.trim()?(0,R.jsx)(`code`,{className:`font-mono text-text`,children:t}):(0,R.jsxs)(`span`,{className:`text-text-3`,children:[`nothing set ·`,` `,(0,R.jsx)(r1,{location:{page:`project`,field:n},children:`Settings`})]})})}function l4(e){let t=B.useUtils(),n=qy(),r=B.feature.driveInfo.useQuery(void 0,{refetchInterval:$m()}),i=B.project.testDrive.useMutation({onSuccess:()=>void t.feature.driveInfo.invalidate(),onError:e=>n.push(e.message)}),a=r.data??null,o=(t,r)=>i.mutate({projectId:e,action:t},{onSuccess:e=>{e.ok?r?.():n.push(e.deniedReason??`the drive could not ${t}`)}});return{slot:a,drive:Zy(a,e)?a:null,start:e=>o(`start`,e),stop:e=>o(`stop`,e),starting:i.isPending&&i.variables?.action===`start`,stopping:i.isPending&&i.variables?.action===`stop`}}function u4({projectId:e,talk:t,newChatRequest:n=0,onConsumeNewChatRequest:r,inboxRequest:i=0,onConsumeInboxRequest:a,empty:o=!1,onOpenPreparation:s,driveRequest:c=0,onConsumeDriveRequest:l}){let u=B.useUtils(),d=B.project.list.useQuery().data?.find(t=>t.id===e),f=I2(e),p=B.project.branches.useQuery({projectId:e,includeFeatureBranches:!0}),m=l4(e),h=m.drive,g=t.session,[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!!(g&&n>0)),[x,S]=(0,L.useState)(`chat`),[C,w]=(0,L.useState)(!!(g&&n>0)),[T,E]=(0,L.useState)(void 0);(0,L.useEffect)(()=>{n>0&&g&&(b(!0),w(!0),E(void 0),r?.())},[n,r,g]),(0,L.useEffect)(()=>{i>0&&(v(null),b(!0))},[i]),(0,L.useEffect)(()=>{g||(w(!1),E(void 0))},[g]);let D=g?.id;(0,L.useEffect)(()=>{D&&S(`chat`)},[D]);let O=()=>{v(null),b(!1),S(`drive`)},k=()=>{b(!1),S(`chat`)},A=()=>{S(`chat`),g&&b(!0)};(0,L.useEffect)(()=>{c>0&&(O(),l?.())},[c,l]);let j=_,M=j!==null||y||!g&&!(h&&x===`drive`),N=!!h&&!M&&(x===`drive`||!g),P=!!g&&!M&&!N,F=g&&h?(0,R.jsx)(r4,{front:N?`drive`:`chat`,onPick:S}):void 0,ee=e=>{t.resume(e),v(null),k()};return(0,R.jsxs)(`section`,{className:`workspace`,children:[(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pt-6 pb-8`,hidden:!M,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[calc(var(--content-max)+56px)] flex-col gap-8 px-7`,children:[(0,R.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center rounded-pill border border-accent-line bg-accent-soft px-2 py-0.5 text-xs font-semibold tracking-[0.1em] text-accent-hi uppercase`,children:`Project`}),(0,R.jsx)(`h1`,{className:`text-xl leading-tight font-semibold tracking-[-0.01em] text-text`,children:d?.name??`This project`})]}),(0,R.jsxs)(`p`,{className:`text-sm text-text-3`,children:[`Chats run on `,(0,R.jsx)(`code`,{className:`font-mono text-text-2`,children:Ay}),` and land on `,(0,R.jsx)(`code`,{className:`font-mono text-text-2`,children:f.value??`…`}),`.`]})]}),j?(0,R.jsx)(J2,{conversation:j,onBack:()=>v(null),onReopen:()=>{j.status===`ended`?ee(j.id):(v(null),k())},reopening:t.starting,children:(0,R.jsx)(H0,{sessionId:j.id})}):M?(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,R.jsx)(R2,{landing:f,onStart:t.start,starting:t.starting,openSession:g&&C?{onOpen:()=>{w(!1),E(void 0),k()},onReplace:()=>{w(!1),t.replace(T),k()}}:void 0}),(0,R.jsx)(o4,{card:Qy({empty:o||!d,setupCommand:d?.driveSetupCommand,devCommand:d?.devCommand,drive:m.slot,projectId:e}),branch:h?.branch??(p.data?.current||null),setupCommand:d?.driveSetupCommand,devCommand:d?.devCommand,stopCommand:d?.driveStopCommand,starting:m.starting,onStart:()=>m.start(O),onPrepare:()=>s?.(),onReturn:O}),(0,R.jsx)(V2,{projectId:e,triaging:t.starting,reveal:i>0,onRevealed:a,onTriage:()=>{if(!g){t.triage();return}E(`triage`),w(!0)}}),(0,R.jsx)(L2,{conversations:t.conversations,pending:t.conversationsPending,busy:t.starting,onResume:ee,onOpen:k,onView:v})]}):null]})}),h&&(0,R.jsx)(t4,{projectId:e,repoPath:d?.repoPath,drive:h,hidden:!N,onProjectPage:A,onStop:()=>m.stop(A),stopping:m.stopping,onOpenPreparation:()=>s?.(),switcher:F}),g&&(0,R.jsx)(Y2,{session:g,title:d4(t.conversations,g.id)??`project`,branch:f.value,hidden:!P,switcher:F,onBack:()=>{w(!1),b(!0)},endControl:(0,R.jsx)(jU,{sessionId:g.id,onEnded:()=>{u.project.projectSession.invalidate(),u.project.conversations.invalidate()}}),children:(0,R.jsx)(MU,{label:`terminal`,children:(0,R.jsx)(cQ,{sessionId:g.id})})})]})}function d4(e,t){return e.find(e=>e.id===t)?.title??null}function f4({dirty:e,onDismiss:t,children:n}){return(0,R.jsx)(RO,{open:!0,onClose:t,dirty:e,inline:!0,className:`max-w-[640px] p-6`,children:n})}function p4({title:e,slug:t,oneLiner:n,notes:r,duplicate:i,busy:a,ready:o,onTitleChange:s,onOneLinerChange:c,onNotesChange:l,onSubmit:u,onCancel:d}){let f=`h-(--control-h) rounded-md border border-hairline-strong bg-panel-inset px-3 text-base text-text outline-none focus:border-accent`,p=()=>u(r.trim()||void 0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,R.jsx)(`h2`,{className:`m-0 text-xl font-semibold text-text`,children:`Park it for later`}),(0,R.jsx)(`p`,{className:`m-0 text-base text-text-2`,children:`Write it down now, work it out later. Nothing is cut until you Start it.`})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,R.jsx)(zO,{label:`Title`,error:i,children:(0,R.jsx)(`input`,{className:f,value:e,onChange:e=>s(e.target.value),placeholder:`e.g. Slack alerts on failed runs`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&p()}})}),(0,R.jsx)(zO,{label:`One-liner (optional)`,children:(0,R.jsx)(`input`,{className:f,value:n,onChange:e=>c(e.target.value),placeholder:`what & why in a sentence`,onKeyDown:e=>{e.key===`Enter`&&p()}})}),(0,R.jsx)(zO,{label:`Notes (optional — becomes the brief)`,children:(0,R.jsx)(`textarea`,{className:`min-h-24 resize-y rounded-md border border-hairline-strong bg-panel-inset px-3 py-2 text-base text-text outline-none focus:border-accent`,value:r,onChange:e=>l(e.target.value),placeholder:`notes (optional) — anything Start should know`})})]}),(0,R.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 border-t border-hairline-soft pt-6`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-sm text-text-3`,children:[`feature/`,t||`…`,` · draft`]}),(0,R.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,R.jsx)(J,{variant:`ghost`,onClick:d,disabled:a,children:`Cancel`}),(0,R.jsx)(J,{variant:`solid`,onClick:p,disabled:!o||a,children:a?`Parking…`:`Park draft`})]})]})]})}function m4({projectId:e,onCancel:t,onCreated:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),l=B.useUtils(),u=qy(),d=Tg(r,B.feature.list.useQuery({projectId:e},{refetchInterval:$m()}).data??[]),f=async e=>{await l.feature.list.invalidate(),n(e)},p=B.feature.create.useMutation({onSuccess:e=>void f(e.id),onError:e=>u.push(e.message)}),m=p.isPending,h=!!r.trim(),g=!!r.trim()||!!a.trim()||!!s.trim(),_=t=>{!h||m||p.mutate({projectId:e,title:r.trim(),oneLiner:a.trim(),draft:!0,...t?{brief:t}:{}})};return(0,R.jsx)(f4,{dirty:g,onDismiss:t,children:e=>(0,R.jsx)(p4,{title:r,slug:wg(r),oneLiner:a,notes:s,duplicate:d,busy:m,ready:h,onTitleChange:i,onOneLinerChange:o,onNotesChange:c,onSubmit:_,onCancel:e})})}function h4({projectId:e,onClose:t}){let n=B.useUtils(),r=qy(),i=B.project.list.useQuery().data?.find(t=>t.id===e),a=B.project.prep.useQuery({projectId:e},{refetchInterval:$m(3e3)}),o=B.project.prepSession.useQuery({projectId:e},{refetchInterval:$m()}),s=B.project.talkToPrep.useMutation({onSuccess:()=>void n.project.prepSession.invalidate(),onError:e=>r.push(e.message)}),c=B.project.dryRunStop.useMutation({onSuccess:()=>{n.project.prep.invalidate(),n.feature.driveInfo.invalidate()},onError:e=>r.push(e.message)}),l=a.data,u=o.data??null,d=l?.findings??[],f=l?.pendingKeys??[],p=d.filter(Fp).length;return(0,R.jsxs)(`section`,{className:`workspace`,children:[(0,R.jsxs)(`div`,{className:`ws-head`,children:[(0,R.jsxs)(`div`,{className:`ws-title-row`,children:[(0,R.jsx)(`span`,{className:`inline-flex h-[18px] items-center rounded-pill border border-accent-line bg-accent-soft px-2 text-[9.5px] font-bold tracking-[0.09em] text-accent-hi`,children:`PREPARE`}),(0,R.jsx)(`span`,{className:`ws-title`,children:i?.name??`This project`}),(0,R.jsx)(`span`,{className:`ws-title-spacer`}),t&&(0,R.jsx)(`button`,{className:`settings-clear`,onClick:t,children:`Back`})]}),(0,R.jsx)(`div`,{className:`mt-2 text-sm leading-6 text-text-3`,children:`Repo facts an agent establishes once — how to install, how to verify, what is already red — so no burn agent re-derives them per ticket.`})]}),(0,R.jsx)(`div`,{className:`ws-body`,children:(0,R.jsxs)(`div`,{className:`ws-body-inner flex flex-col gap-[18px]`,children:[a.isLoading&&(0,R.jsx)(NO,{children:`loading…`}),a.error&&(0,R.jsxs)(NO,{children:[`could not load preparation: `,a.error.message]}),l?.dryRun&&(0,R.jsx)(v4,{open:mv(l.dryRun),stopping:c.isPending,onStop:()=>c.mutate({projectId:e})}),u?(0,R.jsxs)(`div`,{className:`grill-panel`,children:[(0,R.jsxs)(`div`,{className:`grill-strip`,children:[(0,R.jsx)(`span`,{className:`grill-kind`,children:`prepare`}),(0,R.jsx)(uk,{status:u.status}),(0,R.jsx)(`span`,{className:`grill-live-label`,children:Bg(u)}),(0,R.jsx)(`span`,{className:`grill-strip-spacer`}),(0,R.jsx)(`span`,{className:`grill-sid`,title:u.ccSessionId??u.id,children:(u.ccSessionId??u.id).slice(0,8)}),(0,R.jsx)(jU,{sessionId:u.id,onEnded:()=>{n.project.prepSession.invalidate(),n.project.prep.invalidate()}})]}),(0,R.jsx)(`div`,{className:`grill-term h-[clamp(300px,calc(100dvh-420px),1200px)]`,children:(0,R.jsx)(MU,{label:`terminal`,children:(0,R.jsx)(cQ,{sessionId:u.id})})})]}):l?(0,R.jsx)(g4,{prepared:l.prepared,preparedAt:l.preparedAt,pending:f,findings:d,staleCount:p,starting:s.isPending,onStart:()=>s.mutate({projectId:e}),onStartFresh:()=>s.mutate({projectId:e,fresh:!0})}):null,u&&(0,R.jsx)(_4,{findings:d,staleCount:p})]})})]})}function g4({prepared:e,preparedAt:t,pending:n,findings:r,staleCount:i,starting:a,onStart:o,onStartFresh:s}){let c=r.length>0;return e?(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-7 pt-10 text-center`,children:[(0,R.jsx)(`div`,{className:`flex opacity-85`,children:(0,R.jsx)(sg,{size:44,variant:`outline`})}),(0,R.jsx)(`div`,{className:`text-lg font-medium text-text`,children:`Re-prepare this project`}),(0,R.jsxs)(`div`,{className:`max-w-[52ch] text-sm leading-6 text-text-3`,children:[t===null?`No preparation conversation on record — every field already had a value. `:`Prepared ${Op(t)}. `,`Repo facts drift; re-preparing measures them again with you there.`]}),i>0&&(0,R.jsx)(b4,{count:i}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(J,{variant:`solid`,disabled:a,onClick:o,children:a?`Opening…`:`Resume`}),(0,R.jsx)(J,{disabled:a,onClick:s,children:`Start fresh`})]}),(0,R.jsx)(`div`,{className:`max-w-[52ch] text-sm leading-6 text-text-3`,children:`Resume continues your last preparation conversation; Start fresh opens one that has never seen it — values you typed by hand are never overwritten.`}),r.length>0&&(0,R.jsx)(x4,{findings:r})]}):(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-7 pt-10 text-center`,children:[(0,R.jsx)(`div`,{className:`flex opacity-85`,children:(0,R.jsx)(sg,{size:44,variant:`outline`})}),(0,R.jsx)(`div`,{className:`text-lg font-medium text-text`,children:c?`Finish preparing this project`:`Prepare this project first`}),(0,R.jsx)(`div`,{className:`max-w-[52ch] text-sm leading-6 text-text-3`,children:`Opens a terminal session here with an agent in your own checkout — it runs this repo's commands, records the answers, and asks you the ones only you know.`}),n.length>0&&(0,R.jsx)(`ul`,{className:`m-0 flex max-w-[56ch] list-none flex-wrap justify-center gap-1.5 p-0 [&_li]:rounded-pill [&_li]:border [&_li]:border-hairline [&_li]:bg-panel-3 [&_li]:px-2 [&_li]:py-[3px] [&_li]:text-xs [&_li]:text-text-3`,children:n.map(e=>(0,R.jsx)(`li`,{children:Ep[e]??e},e))}),(0,R.jsx)(J,{variant:`solid`,disabled:a,onClick:o,children:a?`Opening…`:`Start preparation`}),(0,R.jsx)(_4,{findings:r,staleCount:i})]})}function _4({findings:e,staleCount:t}){return(0,R.jsxs)(R.Fragment,{children:[t>0&&(0,R.jsx)(b4,{count:t}),e.length>0&&(0,R.jsx)(x4,{findings:e})]})}function v4({open:e,stopping:t,onStop:n}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-[9px] rounded-md border border-drive/35 bg-drive/10 px-[11px] py-2`,children:[(0,R.jsx)(`span`,{className:`drive-pulse`}),(0,R.jsx)(`span`,{className:`text-sm font-semibold text-drive`,children:`Preparation dry-run in progress`}),e&&(e.state===`ready`?(0,R.jsx)(`a`,{className:`font-mono text-sm text-text-2`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url}):(0,R.jsx)(`span`,{className:`font-mono text-sm text-text-3`,children:hv(e)})),(0,R.jsx)(`span`,{className:`flex-1`}),(0,R.jsx)(J,{className:`btn-xs`,disabled:t,onClick:n,children:t?`Stopping…`:`Stop`})]})}function y4({finding:e}){let t=Ap(e);if(!t)return null;let n=e.verifiedAt!==void 0;return(0,R.jsx)(`span`,{className:`settings-badge${n?` is-verified`:` is-unverified`}`,title:n?`A preparation dry run ran this value on the real drive machinery and it worked`:`No dry run has ever proven this value — a drive that depends on it may fall over`,children:t})}function b4({count:e}){return(0,R.jsxs)(`div`,{className:`w-full max-w-[62ch] rounded-md border border-drive/35 bg-drive/10 px-[9px] py-[7px] text-left text-sm leading-5 text-text-2`,children:[e,` finding`,e===1?` has`:`s have`,` not been re-measured in a long time. A stale test baseline is worse than none — agents trust it and file their own breakage under “already red on main”.`]})}function x4({findings:e}){return(0,R.jsxs)(`div`,{className:`w-full max-w-[62ch] rounded-lg border border-hairline bg-panel-2 px-4 py-3.5 text-left`,children:[(0,R.jsx)(`div`,{className:`mb-2 text-xs font-bold tracking-[0.09em] text-text-3 uppercase`,children:`Established`}),(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2.5 p-0`,children:e.map(e=>(0,R.jsx)(S4,{finding:e,label:Ep[e.key]??e.key},e.key))})]})}function S4({finding:e,label:t}){let[n,r]=(0,L.useState)(!1);return(0,R.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-[7px]`,children:[(0,R.jsx)(`span`,{className:`text-sm text-text`,children:t}),(0,R.jsx)(`span`,{className:`settings-badge${e.source===`human`?``:` is-override`}`,title:e.source===`human`?`You set this by hand — preparation will never overwrite it`:e.source===`build`?`Built by runcastle from this repo's own Dockerfile`:e.source===`session`?`Established in a conversation on your own machine`:Dp.has(e.key)?`Read from config by an older automatic run, not executed`:`Measured by an older automatic run, in a sandbox`,children:e.source===`human`?`yours`:e.source===`build`?`built`:e.source===`session`?`verified`:Dp.has(e.key)?`proposed`:`measured`}),(0,R.jsx)(y4,{finding:e})]}),(0,R.jsx)(`div`,{className:`text-xs ${Fp(e)?`text-drive`:`text-text-4`}`,children:Mp(e)}),e.evidence&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`rounded-r-md border-l-2 border-accent-line bg-panel-inset px-[7px] py-[5px]`,children:(0,R.jsx)(`div`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-[1.45] text-text-3 ${n?``:`line-clamp-3`}`,children:e.evidence})}),(0,R.jsx)(`button`,{className:`self-start border-0 bg-transparent p-0 text-xs text-accent-hi hover:text-accent`,onClick:()=>r(e=>!e),"aria-expanded":n,"aria-label":`${n?`Collapse`:`Show full`} evidence for ${t}`,children:n?`Show less`:`Show full evidence`})]})]})}var C4=`flex cursor-pointer items-center gap-2.5 rounded-sm px-2.5 py-2`,w4=`px-2.5 pt-2.5 pb-1 text-xs font-semibold tracking-[0.09em] text-text-4 uppercase`,T4=`shrink-0 text-xs text-text-3`;function E4(e){let{open:t,onClose:n,features:r,selectedFeatureId:i,onSelect:a,onOpenSettings:o,onOpenPreparation:s,onOpenProjectChat:c,onOpenNote:l,nav:u}=e,[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(0),h=(0,L.useRef)(null),g=(0,L.useRef)([]);(0,L.useEffect)(()=>{t&&(f(``),m(0),h.current?.focus())},[t]),(0,L.useEffect)(()=>{m(0)},[d]);let _=d.trim().toLowerCase(),v=(0,L.useMemo)(()=>_===``?r:r.filter(e=>e.slug.toLowerCase().includes(_)||e.title.toLowerCase().includes(_)),[r,_]),y=(0,L.useMemo)(()=>(u.projects??[]).filter(e=>e.id!==u.currentProjectId),[u.projects,u.currentProjectId]),b=(0,L.useMemo)(()=>_===``?y:y.filter(e=>e.name.toLowerCase().includes(_)),[y,_]),x=(0,L.useMemo)(()=>[{kind:`projectChat`,shows:zy(_),glyph:(0,R.jsx)(Yh,{size:13}),label:`Project chat — talk an idea through, or reopen a past conversation`,run:c},{kind:`newNote`,shows:_===``||`new note jot capture`.includes(_),glyph:(0,R.jsx)(Zh,{size:13}),label:`New note — jot what you just noticed, triage it later`,run:l},{kind:`preparation`,shows:Ry(_),glyph:(0,R.jsx)(Fh,{size:13}),label:`Preparation — establish this repo’s commands and baseline`,run:s},{kind:`settings`,shows:_===``||`settings preferences`.includes(_),glyph:(0,R.jsx)(Fh,{size:13}),label:`Settings`,run:o},{kind:`home`,shows:_===``||`all projects home`.includes(_),glyph:(0,R.jsx)(Qh,{size:13}),label:`All projects (home)`,run:u.goHome},{kind:`openProject`,shows:_===``||`open a project`.includes(_),glyph:(0,R.jsx)(Qh,{size:13}),label:`Open a project…`,run:u.showOpen}].filter(e=>e.shows),[_,c,l,o,s,u]),S=(0,L.useMemo)(()=>{let e=v.map(e=>({kind:`feature`,feature:e}));for(let t of b)e.push({kind:`project`,id:t.id,name:t.name,current:!1});for(let t of x)e.push({kind:`action`,action:t});return e},[v,b,x]);if(!t)return null;let C=e=>{if(S.length===0)return;let t=(p+e+S.length)%S.length;m(t),g.current[t]?.scrollIntoView({block:`nearest`})},w=e=>{let t=S[e];if(t){switch(t.kind){case`feature`:a(t.feature.id);break;case`project`:u.enterProject(t.id);break;case`action`:t.action.run();break}n()}},T=e=>{e.key===`ArrowDown`?(e.preventDefault(),C(1)):e.key===`ArrowUp`?(e.preventDefault(),C(-1)):e.key===`Enter`?(e.preventDefault(),w(p)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},E=v.length,D=E+b.length,O=e=>t=>{g.current[e]=t},k=e=>`${C4} ${e===p?`bg-panel-3 text-text`:`text-text-2`}`;return(0,R.jsx)(`div`,{className:`fixed inset-0 z-[300] flex animate-[backdropIn_var(--dur-2)_var(--ease-out-app)] items-start justify-center bg-[rgba(4,6,10,0.55)] px-4 pt-[12vh] pb-4 backdrop-blur-[2px]`,onClick:n,children:(0,R.jsxs)(`div`,{className:`w-full max-w-[560px] animate-[cmdkIn_var(--dur-2)_var(--ease-out-app)] overflow-hidden rounded-lg border border-hairline-strong bg-panel shadow-overlay`,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`input`,{ref:h,className:`h-12 w-full border-0 border-b border-hairline bg-transparent px-4 font-sans text-base text-text outline-none placeholder:text-text-3`,placeholder:`Search features, projects, or jump to…`,value:d,onChange:e=>f(e.target.value),onKeyDown:T,"aria-label":`Search features, projects, or jump to`}),(0,R.jsxs)(`div`,{className:`max-h-[340px] overflow-y-auto p-1.5`,children:[(0,R.jsx)(`div`,{className:w4,children:`Features`}),v.map((e,t)=>(0,R.jsxs)(`div`,{ref:O(t),className:k(t),onMouseEnter:()=>m(t),onClick:()=>w(t),children:[(0,R.jsx)(`span`,{className:`flex w-3.5 shrink-0 justify-center`,children:(0,R.jsx)(ZO,{phase:e.phase})}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title,children:e.title}),e.id===i&&(0,R.jsx)(`span`,{className:`shrink-0 rounded-pill border border-accent-line px-1.5 text-xs text-accent-hi`,children:`open`}),(0,R.jsx)(`span`,{className:T4,children:kv[e.phase]??e.phase})]},e.id)),(0,R.jsx)(`div`,{className:w4,children:`Projects`}),b.map((e,t)=>{let n=E+t;return(0,R.jsxs)(`div`,{ref:O(n),className:k(n),onMouseEnter:()=>m(n),onClick:()=>w(n),children:[(0,R.jsx)(`span`,{className:`flex w-3.5 shrink-0 justify-center text-text-3`,children:(0,R.jsx)(Qh,{size:13})}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),(0,R.jsx)(`span`,{className:T4,children:`project`})]},e.id)}),(0,R.jsx)(`div`,{className:w4,children:`Actions`}),x.map((e,t)=>{let n=D+t;return(0,R.jsxs)(`div`,{ref:O(n),className:k(n),onMouseEnter:()=>m(n),onClick:()=>w(n),children:[(0,R.jsx)(`span`,{className:`flex w-3.5 shrink-0 justify-center text-text-3`,children:e.glyph}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.label,children:e.label}),(0,R.jsx)(`span`,{className:T4,children:`action`})]},e.kind)}),S.length===0&&(0,R.jsx)(`div`,{className:`p-6 text-center text-base text-text-3`,children:`No matches`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4 border-t border-hairline px-3.5 py-2 text-xs text-text-3`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(BO,{children:`↑↓`}),` navigate`]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(BO,{children:`↵`}),` select`]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(BO,{children:`esc`}),` close`]})]})]})})}var D4=1500,O4=`cursor-pointer rounded-sm border-0 bg-transparent p-0`;function k4({projectId:e,projectName:t,open:n,openRequest:r=0,onClose:i,onOpenInbox:a}){let o=B.useUtils(),s=qy(),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(!1),g=(0,L.useRef)(null),_=(0,L.useRef)(0),v=()=>{l(``),d(null),p(!1),h(!1)},[y,b]=(0,L.useState)(n);n!==y&&(b(n),_.current+=1,n&&v());let[x,S]=(0,L.useState)(r);r!==x&&(S(r),n&&m&&v()),(0,L.useEffect)(()=>{n&&g.current?.focus()},[r]);let C=B.projectNotes.add.useMutation(),w=B.projectNotes.openCount.useQuery({projectId:e},{enabled:n}),T=(0,L.useRef)(null);(0,L.useEffect)(()=>{T.current=u?.preview??null},[u]),(0,L.useEffect)(()=>{if(n)return()=>{T.current&&URL.revokeObjectURL(T.current)}},[n]);let E=(0,L.useRef)(i);E.current=i,(0,L.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>E.current(),D4);return()=>clearTimeout(e)},[m]);let D=async e=>{try{let t=await Wm(e),n={png:t,preview:URL.createObjectURL(t)};d(e=>(e&&URL.revokeObjectURL(e.preview),n))}catch(e){s.push(e instanceof Error?e.message:`that image could not be read`)}},O=()=>{d(e=>(e&&URL.revokeObjectURL(e.preview),null)),g.current?.focus()},k=e=>{let t=Um(e.clipboardData);t&&(e.preventDefault(),D(t))},A=async()=>{if(!c.trim()||f)return;let t=_.current,n=()=>_.current===t;p(!0);try{let t=await C.mutateAsync({projectId:e,text:c});if(u)try{await Yy(t.id,u.png)}catch(e){s.push(`the note was saved, but its picture was not: ${e instanceof Error?e.message:String(e)}`)}o.projectNotes.openCount.setData({projectId:e},e=>e===void 0?e:e+1),o.projectNotes.invalidate(),n()&&h(!0)}catch(e){s.push(e instanceof Error?e.message:`the note could not be saved`)}finally{n()&&p(!1)}};return(0,R.jsx)(RO,{open:n,onClose:i,size:`palette`,scrim:m?`none`:`light`,className:`overflow-hidden`,label:`Jot a note`,initialFocusRef:g,children:m?(0,R.jsxs)(`div`,{className:`flex h-13 items-center gap-2.5 px-3.5 text-base`,role:`status`,children:[(0,R.jsx)(`span`,{className:`flex shrink-0 items-center text-ok`,children:(0,R.jsx)(Vh,{size:16})}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-text-2`,children:[`Noted in `,(0,R.jsx)(`span`,{className:`font-medium text-text`,children:t}),w.data!==void 0&&(0,R.jsxs)(R.Fragment,{children:[` · `,w.data,` open`]})]}),(0,R.jsx)(`button`,{className:O4,onClick:()=>{a(),i()},title:`Read the pile on the project workspace`,children:(0,R.jsx)(`span`,{className:`text-sm text-accent-hi hover:underline`,children:`View`})})]}):(0,R.jsxs)(`div`,{onPaste:k,children:[(0,R.jsxs)(`div`,{className:`flex h-13 items-center gap-2.5 px-3.5`,children:[(0,R.jsx)(`span`,{className:`flex shrink-0 items-center text-accent-hi`,children:(0,R.jsx)(Zh,{size:16})}),(0,R.jsx)(`input`,{ref:g,className:`h-full min-w-0 flex-1 border-0 bg-transparent p-0 font-sans text-lg text-text outline-none placeholder:text-text-4`,autoComplete:`off`,"aria-label":`what did you just notice?`,placeholder:`What did you just notice?`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),A())}})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t border-hairline-soft bg-panel-2 px-3.5 py-2 text-sm text-text-3`,children:[u?(0,R.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1.5 rounded-sm border border-hairline-strong bg-panel-3 pr-1 pl-0.5 text-text-2`,children:[(0,R.jsx)(`img`,{src:u.preview,alt:`the picture this note will carry`,className:`h-4.5 w-7 rounded-[3px] bg-black object-cover`}),`Screenshot`,(0,R.jsx)(`button`,{className:`flex size-4.5 cursor-pointer items-center justify-center rounded-[4px] border-0 bg-transparent p-0 hover:bg-hairline`,"aria-label":`remove the picture`,title:`Remove the picture`,onClick:O,children:(0,R.jsx)(`span`,{className:`flex items-center text-text-3`,children:(0,R.jsx)(Hh,{size:10})})})]}):(0,R.jsx)(`span`,{children:`Paste a screenshot`}),(0,R.jsx)(`span`,{className:`flex-1`}),(0,R.jsxs)(`span`,{children:[`to `,(0,R.jsx)(`span`,{className:`font-medium text-text-2`,children:t})]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(BO,{children:`↵`}),` save`]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(BO,{children:`esc`}),` close`]})]})]})})}var A4={"claude-code":{check:`afk-key`,kind:`token`},codex:{check:`auth`,kind:`sign-in`}};function j4(e){return Uu.flatMap(t=>{let{check:n,kind:r}=A4[t],i=e.find(e=>e.runtime===t&&e.check===n);return i?[{runtime:t,kind:r,probe:i}]:[]})}function M4(e){return`${A4[e].check}-${e}`}function N4(e){let t=Lp[e],n=A4[e].kind===`token`;return{field:M4(e),label:n?`${t} token`:t,reason:n?`burns with ${t} need a token`:`sign in to ${t}`,terms:n?[t,`token`,`AFK credential`]:[t,`sign in`,`login`]}}var P4=[{field:`container-runtime`,label:`Container runtime`,reason:`no container runtime on this machine`,terms:[`Container runtime`,`Docker`,`Podman`]},{field:`sandcastle-image`,label:`Sandcastle image`,reason:`the sandcastle image needs building`,terms:[`Sandcastle image`,`build`,`rebuild`]},...Uu.map(N4),{field:`burn-cache`,label:`Burn cache`,terms:[`Burn cache`,`volume`,`clear`]}];function F4(e){let t=e.find(e=>!e.ok);return t?{count:`${e.filter(e=>e.ok).length} of ${e.length}`,text:`ready — ${t.reason}`}:{count:null,text:`Ready for unattended burns`}}var I4=[{page:`general`,label:`General`,Icon:Fh},{page:`models`,label:`Models`,Icon:$h},{page:`burns`,label:`Burns`,Icon:eg},{page:`project`,label:`This project`,Icon:Qh}],L4=`${e1} flex h-8 w-full items-center gap-2.5 rounded-sm px-2 text-left text-sm`,R4=`bg-accent-soft text-text`,z4=`text-text-2 hover:bg-panel-3 hover:text-text`;function B4({page:e,filter:t,filterRef:n,projectName:r,onFilter:i,onSelect:a}){let o=t.query.trim()!==``;return(0,R.jsxs)(`nav`,{className:`flex flex-col gap-1.5 border-r border-hairline bg-panel-2 px-2.5 py-3.5`,children:[(0,R.jsx)(`div`,{className:`mb-1.5 ml-2 text-xs font-semibold tracking-[0.08em] text-text-3 uppercase`,children:`Settings`}),(0,R.jsxs)(`div`,{className:`relative mb-1.5`,children:[(0,R.jsx)(Ph,{size:12,className:`pointer-events-none absolute top-2.5 left-2.5 text-text-3`}),(0,R.jsx)(`input`,{ref:n,"aria-label":`Filter settings`,placeholder:`Filter settings…`,autoComplete:`off`,value:t.query,onChange:e=>i(e.target.value),className:`h-7.5 w-full rounded-sm border border-hairline bg-panel-inset pr-2 pl-7 text-sm text-text placeholder:text-text-3`})]}),I4.map(({page:n,label:r,Icon:i})=>{let s=n===e;return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(n),...s?{"aria-current":`page`}:{},className:`${L4} ${s?R4:z4}`,children:[(0,R.jsx)(i,{size:14,className:`shrink-0 ${s?`text-accent-hi`:`text-text-3`}`}),r,o&&(0,R.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-text-3`,children:t.counts[n]||``})]},n)}),(0,R.jsx)(`div`,{className:`flex-1`}),(0,R.jsxs)(`div`,{className:`border-t border-hairline-soft p-2 text-xs text-text-3`,children:[`Open project`,(0,R.jsx)(`span`,{className:`mt-0.5 block font-mono text-sm text-text-2`,children:r})]})]})}var V4=1500;function H4(e){let t=(0,L.useRef)(null),[n,r]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(!e)return;t.current?.scrollIntoView?.({block:`center`}),r(!0);let n=setTimeout(()=>r(!1),V4);return()=>clearTimeout(n)},[e]),{ref:t,flash:n}}function U4(e,t){return e.query.trim()===``||e.matches.has(t)}var W4=1400;function G4(...e){return e.filter(Boolean).join(` `)}var K4=`inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-pill border px-2 text-xs`,q4=`${e1} cursor-pointer text-xs whitespace-nowrap text-accent-hi underline decoration-accent-line underline-offset-2 hover:decoration-accent-hi`,J4=`h-(--control-h) w-full min-w-0 rounded-sm border border-hairline bg-panel-inset px-2.5 text-text placeholder:text-text-4 hover:border-hairline-strong disabled:cursor-not-allowed disabled:bg-panel-2 disabled:text-text-3`;function Y4({title:e,rows:t,projectId:n,filter:r,highlightField:i,onOpenEvidence:a,evidence:o}){let s=t.filter(e=>U4(r,e.key));return s.length===0?null:(0,R.jsx)(X4,{title:e,children:(0,R.jsx)(`div`,{children:s.map(e=>(0,R.jsx)(Z4,{row:e,projectId:n,highlight:i===e.key,...a&&e.provenanceChip?.evidence?{onOpenEvidence:()=>a(e.key)}:{},...o?{evidence:o(e)}:{}},e.key))})})}function X4({title:e,children:t}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,R.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold tracking-[0.08em] text-text-3 uppercase`,children:[e,(0,R.jsx)(`span`,{className:`h-px flex-1 bg-hairline-soft`})]}),t]})}function Z4({row:e,projectId:t,highlight:n,onOpenEvidence:r,evidence:i}){let a=B.useUtils(),o=e.ghostValue?``:e.value,[s,c]=(0,L.useState)(o),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),{ref:h,flash:g}=H4(n),_=(0,L.useRef)(void 0);(0,L.useEffect)(()=>c(o),[o]),(0,L.useEffect)(()=>()=>clearTimeout(_.current),[]);let v=B.settings.update.useMutation({onSuccess:()=>{u(null),f(!0),clearTimeout(_.current),_.current=setTimeout(()=>f(!1),W4),e.restartRequired&&m(!0),a.settings.get.invalidate(),a.project.prep.invalidate()},onError:e=>{c(o),u(e.message)}}),y=e=>{c(e),l&&u(null)},b=n=>{u(null),v.mutate({...t?{projectId:t}:{},key:e.key,value:n})},x=t=>{if(t.trim()===o.trim())return;let n=nm(e.control,t);if(`error`in n){u(n.error);return}b(n.value)},S=()=>b(null),C=`set-${t?`project`:`global`}-${e.key}`;return(0,R.jsx)(`div`,{ref:h,className:G4(`border-b border-hairline-soft py-2 last:border-b-0`,g&&`rounded-sm outline-2 outline-offset-2 outline-accent`),children:(0,R.jsx)(zO,{htmlFor:C,layout:`grid grid-cols-[210px_1fr] items-start gap-x-4 gap-y-1.5 [&>*+*]:col-start-2`,label:e.label,labelAside:(0,R.jsxs)(R.Fragment,{children:[e.tooltip&&(0,R.jsx)($4,{about:e.label,text:e.tooltip}),d&&(0,R.jsx)(`span`,{className:`text-xs text-ok`,children:`Saved ✓`})]}),help:e.shortHelp,error:l,children:(0,R.jsx)(Q4,{row:e,draft:s,disabled:v.isPending,restart:p,onDraft:y,onCommit:x,onRevert:()=>c(o),onClear:S,onOpenEvidence:r,evidence:i})})})}function Q4({id:e,"aria-describedby":t,row:n,draft:r,disabled:i,restart:a,onDraft:o,onCommit:s,onRevert:c,onClear:l,onOpenEvidence:u,evidence:d}){let f={id:e,"aria-describedby":t,disabled:i},p=n.control===`select`?``:`font-mono text-sm`,m=e=>{e.key===`Escape`&&(c(),e.currentTarget.blur())},h=e=>{e.key===`Enter`&&e.currentTarget.blur(),m(e)};return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[n.readOnly?(0,R.jsx)(`input`,{...f,disabled:!0,readOnly:!0,className:G4(J4,p,n.control===`number`&&`w-24 tabular-nums`),value:n.optionLabels[n.value]??n.value}):n.control===`select`?(0,R.jsxs)(H$,{value:r,onValueChange:e=>{o(e),s(e)},children:[(0,R.jsx)(W$,{...f,className:G4(J4,`max-w-90`),children:(0,R.jsx)(G$,{})}),(0,R.jsxs)(K$,{className:`font-sans text-sm`,children:[n.ghostValue&&(0,R.jsxs)(X$,{value:``,children:[`Use global (`,n.optionLabels[n.ghostValue]??n.ghostValue,`)`]}),n.modelGroups.length>0?n.modelGroups.map(e=>(0,R.jsxs)(q$,{children:[(0,R.jsx)(J$,{children:e.label}),e.entries.map(e=>(0,R.jsx)(X$,{value:e.id,title:e.note,children:e.note?`${e.id} — ${e.note}`:e.id},e.id))]},e.runtime)):n.options.map(e=>(0,R.jsx)(X$,{value:e,children:n.optionLabels[e]??e},e))]})]}):n.control===`textarea`?(0,R.jsx)(`textarea`,{...f,rows:2,className:G4(J4,p,`h-auto min-h-16 resize-y py-2 leading-normal`),placeholder:n.ghostValue??n.placeholder,value:r,onChange:e=>o(e.target.value),onBlur:e=>s(e.target.value),onKeyDown:m}):(0,R.jsx)(`input`,{...f,type:n.control===`number`?`number`:`text`,className:G4(J4,p,n.control===`number`&&`w-24 tabular-nums`),placeholder:n.ghostValue??n.placeholder,value:r,onChange:e=>o(e.target.value),onBlur:e=>s(e.target.value),onKeyDown:h}),n.unit&&(0,R.jsx)(`span`,{className:`text-sm whitespace-nowrap text-text-3`,children:n.unit}),n.sourceChip&&(0,R.jsxs)(`div`,{className:G4(`flex shrink-0 items-center gap-2`,n.control===`textarea`&&`flex-col items-start gap-1.5 self-start pt-1.5`),children:[(0,R.jsx)(t3,{kind:n.sourceChip,envVar:Ip[n.key]}),n.sourceChip===`project`&&(0,R.jsx)(`button`,{type:`button`,onClick:l,className:q4,children:`Use global`})]}),n.clearable&&(0,R.jsx)(`button`,{type:`button`,onClick:l,className:G4(q4,`shrink-0`),children:`Clear`})]}),n.provenanceChip&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsxs)(`div`,{className:`relative flex`,children:[(0,R.jsx)(r3,{chip:n.provenanceChip,onOpenEvidence:u}),d]}),n.stale&&(0,R.jsx)(`span`,{className:G4(K4,`border-warn/45 bg-panel-2 text-warn`),title:`Measured a long time ago — “Re-prepare the project”, at the foot of the features rail, refreshes it`,children:`Stale`})]}),a&&(0,R.jsx)(`div`,{className:`text-sm text-warn`,children:`Restart the server to apply`})]})}function $4({about:e,text:t}){let n=(0,L.useId)();return(0,R.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-label":`About ${e}`,"aria-describedby":n,className:`${$$} peer grid size-4 cursor-default place-items-center rounded-pill border border-hairline-strong text-[10px] text-text-3 hover:border-accent-line hover:text-accent-hi`,children:`i`}),(0,R.jsx)(`span`,{id:n,role:`tooltip`,className:`pointer-events-none invisible absolute top-5.5 left-0 z-10 w-75 rounded-md border border-hairline-strong bg-panel-3 px-2.5 py-2 text-sm leading-normal font-normal text-text-2 shadow-overlay peer-hover:visible peer-focus-visible:visible`,children:t})]})}var e3={global:{text:`Global`,className:`border-hairline bg-panel-2 text-text-2`},project:{text:`This project`,className:`border-accent-line bg-accent-soft text-accent-hi`},env:{text:`Env`,className:`border-hairline bg-panel-2 text-text-3`}};function t3({kind:e,envVar:t}){let n=e3[e];return(0,R.jsxs)(`span`,{className:G4(K4,n.className),...e===`env`&&t?{title:`Set by ${t}`}:{},children:[e===`env`&&(0,R.jsx)(tg,{size:10}),n.text]})}var n3={ok:`bg-ok`,muted:`bg-text-4`,warn:`bg-warn`};function r3({chip:e,onOpenEvidence:t}){let n=e.tone===`warn`?`border-warn/45 text-warn`:`border-hairline text-text-2`,r=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:G4(`size-1.5 shrink-0 rounded-pill`,n3[e.tone])}),e.text]});return t?(0,R.jsx)(`button`,{type:`button`,onClick:t,className:G4($$,K4,`bg-panel-2 hover:border-hairline-strong hover:text-text`,n),children:r}):(0,R.jsx)(`span`,{className:G4(K4,`bg-panel-2`,n),children:r})}function i3({globals:e,filter:t,highlightField:n}){if(e.isLoading)return(0,R.jsx)(NO,{children:`loading…`});if(e.error)return(0,R.jsxs)(NO,{children:[`could not load settings: `,e.error.message]});if(!e.data)return null;let r=fm(e.data,`general`),i=e=>r.filter(t=>t.group===e);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5.5`,children:[(0,R.jsx)(Y4,{title:`Server`,rows:i(`server`),filter:t,highlightField:n}),(0,R.jsx)(Y4,{title:`Sessions`,rows:i(`sessions`),filter:t,highlightField:n})]})}var a3=`grid grid-cols-[168px_86px_minmax(140px,1fr)_118px_92px_24px] items-center gap-2`,o3=e=>`models:${e}`,s3=`models:new`,c3=`h-(--control-h) min-w-0 rounded-sm border border-hairline bg-panel-inset px-2.5 text-sm text-text placeholder:text-text-4 hover:border-hairline-strong`;function l3({rows:e,stepLabels:t,customModels:n,filter:r,writes:i}){let[a,o]=(0,L.useState)(!1),s=r.query.trim()!==``,c=(a||s?e:bm(e)).filter(e=>U4(r,e.id)),l=a||s?0:xm(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-hairline`,children:[(0,R.jsxs)(`div`,{className:`${a3} min-h-7.5 bg-panel-2 px-2.5 text-xs font-semibold tracking-[0.06em] text-text-3 uppercase`,children:[(0,R.jsx)(`span`,{children:`Model`}),(0,R.jsx)(`span`,{children:`Runtime`}),(0,R.jsx)(`span`,{children:`Use-case note`}),(0,R.jsx)(`span`,{children:`Used for`}),(0,R.jsx)(`span`,{children:`Default`}),(0,R.jsx)(`span`,{})]}),c.map(e=>(0,R.jsx)(u3,{row:e,stepLabels:t,customModels:n,writes:i},e.id)),!s&&(0,R.jsx)(p3,{customModels:n,writes:i})]}),l>0&&(0,R.jsxs)(`p`,{className:`text-sm text-text-3`,children:[l,` more `,l===1?`model`:`models`,` not shown:`,` `,(0,R.jsx)(`button`,{type:`button`,className:`${e1} text-accent-hi hover:underline`,onClick:()=>o(!0),children:`show all`})]})]})}function u3({row:e,stepLabels:t,customModels:n,writes:r}){let i=o3(e.id),a=e.usedFor.map(e=>t.get(e)??e).join(`, `);return(0,R.jsxs)(`div`,{className:`group border-t border-hairline-soft`,children:[(0,R.jsxs)(`div`,{className:`${a3} min-h-10 px-2.5 py-1.5 text-sm`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`truncate font-mono ${e.isDefault?`text-accent-hi`:`text-text`}`,title:e.displayName?`${e.displayName} — ${e.id}`:e.id,children:e.id}),e.isNew&&(0,R.jsx)(`span`,{className:`shrink-0 rounded-pill border border-ok/35 bg-ok/10 px-1.5 text-xs font-semibold tracking-[0.06em] text-ok uppercase`,children:`New`})]}),(0,R.jsx)(g3,{runtime:e.runtime}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,R.jsx)(f3,{row:e,onCommit:t=>{let a=t.trim(),o=a===``&&!e.custom?n.filter(t=>t.id!==e.id):Xu(n,[{id:e.id,runtime:e.runtime,...a?{note:a}:{}}]);r.save(i,`models`,o)}}),r.saved===i&&(0,R.jsx)(v3,{})]}),(0,R.jsxs)(`span`,{className:`text-xs leading-tight text-text-3`,children:[e.isDefault&&(0,R.jsx)(`span`,{className:`text-text-2`,children:`Default`}),e.isDefault&&a!==``&&` · `,a===``?e.isDefault?``:`—`:a]}),e.isDefault?(0,R.jsx)(`span`,{className:`justify-self-start rounded-pill border border-accent-line bg-accent-soft px-2 py-0.5 text-xs font-semibold tracking-[0.06em] text-accent-hi uppercase`,children:`Default`}):(0,R.jsx)(`button`,{type:`button`,"aria-label":`Make ${e.id} the default`,onClick:()=>r.save(i,`model`,e.id),className:`${$$} justify-self-start rounded-pill border border-transparent px-2 py-0.5 text-xs whitespace-nowrap text-text-3 opacity-0 group-hover:border-hairline group-hover:opacity-100 hover:border-accent-line hover:text-accent-hi focus-visible:opacity-100`,children:`Make default`}),e.custom&&(0,R.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.id}`,onClick:()=>{if(e.isDefault){r.refuse(i,`${e.id} is the default model — make another model the default first.`);return}if(e.usedFor.length>0){r.refuse(i,`${e.id} runs ${a} — reset those steps first.`);return}r.save(i,`models`,n.filter(t=>t.id!==e.id))},className:`${e1} grid size-6 place-items-center rounded-sm text-text-4 hover:bg-panel-3 hover:text-danger`,children:(0,R.jsx)(Hh,{size:12})})]}),(0,R.jsx)(d3,{row:e}),(0,R.jsx)(m3,{writes:r,cell:i})]})}function d3({row:e}){return!e.noLongerOffered&&!e.retirement?null:(0,R.jsxs)(`p`,{className:`flex flex-wrap gap-x-3 px-2.5 pb-1.5 text-sm text-warn`,children:[e.noLongerOffered&&(0,R.jsxs)(`span`,{children:[`no longer offered by `,gm[e.noLongerOffered]]}),e.retirement&&(0,R.jsxs)(`span`,{children:[`retires `,e.retirement.at,` → `,e.retirement.replacement]})]})}function f3({row:e,onCommit:t}){let[n,r]=(0,L.useState)(e.note);return(0,L.useEffect)(()=>r(e.note),[e.note]),(0,R.jsx)(`input`,{type:`text`,"aria-label":`Note for ${e.id}`,placeholder:e.isDefault?`e.g. UI/UX work, design-heavy tickets`:`Add a note to offer it per ticket`,className:`h-6.5 min-w-0 flex-1 rounded-sm border border-transparent bg-transparent px-2 text-sm text-text placeholder:text-text-4 placeholder:italic hover:border-hairline hover:bg-panel-inset focus:border-accent-line focus:bg-panel-inset`,value:n,onChange:e=>r(e.target.value),onBlur:()=>n.trim()!==e.note.trim()&&t(n),onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})}function p3({customModels:e,writes:t}){let[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),c=()=>{let c=Hp(n,i,o);if(`error`in c){t.refuse(s3,c.error);return}t.save(s3,`models`,Xu(e,[c.entry])),r(``),a(``),s(``)},l=e=>{e.key===`Enter`&&c()};return(0,R.jsxs)(`div`,{className:`border-t border-hairline-soft bg-panel-2`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_150px_minmax(0,1.2fr)_auto] items-center gap-2 px-2.5 py-1.5`,children:[(0,R.jsx)(`input`,{type:`text`,"aria-label":`New model id`,placeholder:`model id, e.g. claude-opus-5[1m]`,className:`${c3} font-mono`,value:n,onChange:e=>r(e.target.value),onKeyDown:l}),(0,R.jsxs)(H$,{value:i,onValueChange:a,children:[(0,R.jsx)(W$,{"aria-label":`Runtime (required)`,className:c3,children:(0,R.jsx)(G$,{})}),(0,R.jsxs)(K$,{className:`font-sans text-sm`,children:[(0,R.jsx)(X$,{value:``,children:`Runs on…`}),Uu.map(e=>(0,R.jsx)(X$,{value:e,children:Lp[e]},e))]})]}),(0,R.jsx)(`input`,{type:`text`,"aria-label":`New model note`,placeholder:`use-case note (optional)`,className:c3,value:o,onChange:e=>s(e.target.value),onKeyDown:l}),(0,R.jsx)(J,{type:`button`,onClick:c,children:`Add model`})]}),(0,R.jsx)(m3,{writes:t,cell:s3})]})}function m3({writes:e,cell:t,className:n=`px-2.5 pb-1.5`}){return e.error?.cell===t?(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-danger ${n}`,children:e.error.message}):null}var h3={"claude-code":`border-accent-line bg-accent-soft text-accent-hi`,codex:`border-ok/35 bg-ok/10 text-ok`};function g3({runtime:e}){return(0,R.jsx)(`span`,{className:`inline-flex h-5 w-fit items-center rounded-pill border px-2 font-mono text-xs whitespace-nowrap ${h3[e]}`,children:Lp[e]})}function _3({groups:e}){return(0,R.jsx)(R.Fragment,{children:e.map(e=>(0,R.jsxs)(q$,{children:[(0,R.jsx)(J$,{children:e.label}),e.entries.map(e=>(0,R.jsx)(X$,{value:e.id,title:e.note,children:e.note?`${e.id} — ${e.note}`:e.id},e.id))]},e.runtime))})}function v3(){return(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-ok`,children:`Saved ✓`})}var y3=[{group:`sessions`,title:`Sessions`,caption:`interactive — you are in the terminal`},{group:`unattended`,title:`Unattended`,caption:`burns and scripted runs`}];function b3({rows:e,groups:t,defaultModel:n,projectModel:r,filter:i,writes:a}){return(0,R.jsxs)(R.Fragment,{children:[r&&(0,R.jsxs)(`p`,{className:`text-sm text-warn`,children:[`This project runs everything on `,(0,R.jsx)(`span`,{className:`font-mono`,children:r}),` — these apply to other projects.`]}),(0,R.jsx)(`div`,{className:`overflow-hidden rounded-md border border-hairline`,children:y3.map(({group:r,title:o,caption:s})=>{let c=e.filter(e=>e.group===r&&U4(i,Jp(e.step)));return c.length===0?null:(0,R.jsxs)(L.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-h-7.5 items-center gap-2 border-t border-hairline-soft bg-panel-2 px-3 text-xs font-semibold tracking-[0.06em] text-text-3 uppercase first:border-t-0`,children:[o,(0,R.jsx)(`span`,{className:`ml-auto text-xs font-medium tracking-normal text-text-4 normal-case`,children:s})]}),c.map(e=>(0,R.jsx)(x3,{row:e,groups:t,defaultModel:n,writes:a},e.step))]},r)})})]})}function x3({row:e,groups:t,defaultModel:n,writes:r}){let i=Jp(e.step),a=e.value!==null;return(0,R.jsxs)(`div`,{className:`border-t border-hairline-soft`,children:[(0,R.jsxs)(`div`,{className:`grid min-h-11 grid-cols-[1fr_250px_84px_24px] items-center gap-3 px-3 py-1.5`,children:[(0,R.jsxs)(`span`,{className:`text-base font-medium text-text`,children:[e.label,(0,R.jsx)(`small`,{className:`block text-xs leading-tight font-normal text-text-3`,children:e.description})]}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,R.jsxs)(H$,{value:e.value??``,onValueChange:e=>r.save(i,i,e===``?null:e),children:[(0,R.jsx)(W$,{"aria-label":`Model for ${e.label}`,className:`h-(--control-h) min-w-0 flex-1 rounded-sm border border-hairline bg-panel-inset px-2.5 text-sm hover:border-hairline-strong ${a?`font-mono text-text`:`text-text-3`}`,children:(0,R.jsx)(G$,{})}),(0,R.jsxs)(K$,{className:`text-sm`,children:[(0,R.jsxs)(X$,{value:``,children:[`Default (`,n,`)`]}),(0,R.jsx)(_3,{groups:t})]})]}),r.saved===i&&(0,R.jsx)(v3,{})]}),(0,R.jsx)(g3,{runtime:e.effectiveRuntime}),a&&(0,R.jsx)(`button`,{type:`button`,"aria-label":`Reset ${e.label} to default`,title:`Use the default`,onClick:()=>r.save(i,i,null),className:`${e1} grid size-6 place-items-center rounded-sm text-text-4 hover:bg-panel-3 hover:text-text`,children:(0,R.jsx)(Hh,{size:12})})]}),(0,R.jsx)(m3,{writes:r,cell:i})]})}var S3=1400,C3=`model`;function w3(){let e=B.useUtils(),[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),a=(0,L.useRef)([]),o=(0,L.useRef)(null),s=(0,L.useRef)(void 0);(0,L.useEffect)(()=>()=>clearTimeout(s.current),[]);let c=()=>{let e=a.current.shift();if(!e){o.current=null;return}o.current=e.cell,l.mutate({key:e.key,value:e.value})},l=B.settings.update.useMutation({onSuccess:()=>{n(o.current),clearTimeout(s.current),s.current=setTimeout(()=>n(null),S3),e.settings.get.invalidate(),c()},onError:e=>{let t=o.current;t&&i({cell:t,message:e.message}),a.current=[],o.current=null}}),u=e=>i(t=>t&&t.cell===e?null:t);return{saved:t,error:r,save:(e,t,n)=>{u(e),a.current.push({cell:e,key:t,value:n}),o.current===null&&c()},refuse:(e,t)=>i({cell:e,message:t})}}function T3({globals:e,scoped:t,filter:n,highlightField:r}){let i=w3();if(e.isLoading)return(0,R.jsx)(NO,{children:`loading…`});if(e.error)return(0,R.jsxs)(NO,{children:[`could not load settings: `,e.error.message]});if(!e.data)return null;let a=e.data,o=ym(a),s=Cm(a),c=Vp(Bp(a)),l=mm(a),u=new Map(s.map(e=>[e.step,e.label]));return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5.5`,children:[U4(n,`model`)&&(0,R.jsx)(O3,{value:l,groups:c,writes:i,highlight:r===`model`}),o.some(e=>U4(n,e.id))&&(0,R.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,R.jsx)(E3,{children:`Roster`}),(0,R.jsxs)(`p`,{className:`text-sm text-text-3`,children:[`A model with a `,(0,R.jsx)(`b`,{className:`font-medium text-text-2`,children:`use-case note`}),` is offered to the tickets agent, which may pick it per ticket; models without a note are never picked automatically.`]}),(0,R.jsx)(D3,{view:a}),(0,R.jsx)(l3,{rows:o,stepLabels:u,customModels:zp(a),filter:n,writes:i})]}),s.some(e=>U4(n,Jp(e.step)))&&(0,R.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,R.jsx)(E3,{children:`Per step`}),(0,R.jsx)(b3,{rows:s,groups:c,defaultModel:l,projectModel:wm(t.data),filter:n,writes:i})]})]})}function E3({children:e}){return(0,R.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold tracking-[0.08em] text-text-3 uppercase`,children:[e,(0,R.jsx)(`span`,{className:`h-px flex-1 bg-hairline-soft`})]})}function D3({view:e}){let t=B.useUtils(),n=B.settings.refreshModels.useMutation({onSuccess:()=>void t.settings.get.invalidate()});return(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`ul`,{"aria-label":`Model discovery`,className:`flex flex-col gap-0.5 text-sm`,children:[Sm(e).map(e=>(0,R.jsx)(`li`,{className:e.failed?`text-warn`:`text-text-3`,children:e.text},e.runtime)),n.error&&(0,R.jsxs)(`li`,{role:`alert`,className:`text-danger`,children:[`Refresh failed: `,n.error.message]})]}),(0,R.jsx)(J,{size:`xs`,className:`shrink-0`,disabled:n.isPending,onClick:()=>n.mutate(),children:n.isPending?`Refreshing…`:`Refresh`})]})}function O3({value:e,groups:t,writes:n,highlight:r}){let i=(0,L.useRef)(null);return(0,L.useEffect)(()=>{r&&i.current?.scrollIntoView?.({block:`center`})},[r]),(0,R.jsxs)(`div`,{ref:i,className:`grid grid-cols-[auto_1fr] items-center gap-x-4.5 gap-y-1 rounded-md border border-accent-line bg-accent-soft p-3 ${r?`outline-2 outline-offset-2 outline-accent`:``}`,children:[(0,R.jsx)(`label`,{htmlFor:`settings-default-model`,className:`text-base font-semibold text-text`,children:`Default model`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(H$,{value:e,onValueChange:e=>n.save(C3,`model`,e),children:[(0,R.jsx)(W$,{id:`settings-default-model`,className:`h-(--control-h) max-w-85 min-w-0 flex-1 rounded-sm border border-accent-line bg-panel-inset px-2.5 font-mono text-sm text-text`,children:(0,R.jsx)(G$,{})}),(0,R.jsx)(K$,{className:`text-sm`,children:(0,R.jsx)(_3,{groups:t})})]}),n.saved===C3&&(0,R.jsx)(v3,{})]}),(0,R.jsx)(`p`,{className:`col-span-2 text-sm text-text-2`,children:`Runs every step that has no model of its own below — and every project that has not set one.`}),(0,R.jsx)(m3,{writes:n,cell:C3,className:`col-span-2`})]})}function k3({projectId:e,filter:t,highlightField:n,onDismiss:r}){let i=B.useUtils(),a=B.setup.doctor.useQuery(e?{projectId:e}:void 0,{refetchOnWindowFocus:!1}),o=a.data,s=e=>o?.results.find(t=>t.id===e),c=s(`container-runtime`),l=s(`sandcastle-image`),u=j4(o?.results??[]),[d,f]=(0,L.useState)(0),p=()=>{f(e=>e+1),i.setup.doctor.cancel().then(()=>a.refetch())},m=P3(a.isLoading,d),h=e=>!t||U4(t,e),g=m?M3:`checking prerequisites…`,_=a.error?.message??(m?N3:null),v=[...c?[{field:`container-runtime`,ok:c.status===`ok`}]:[],...l?[{field:`sandcastle-image`,ok:A3(l)}]:[],...u.map(e=>({field:M4(e.runtime),ok:e.probe.status===`ok`}))],y=F4(v.map(({field:e,ok:t})=>({ok:t,reason:I3[e].reason??I3[e].label}))),b=e=>({field:e,label:I3[e].label,visible:h(e),highlight:n===e});return(0,R.jsxs)(R3,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-hairline-soft bg-panel-2 px-3 py-2.5 text-sm text-text-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0`,children:a.isLoading?g:a.error?`could not run checks`:(0,R.jsxs)(R.Fragment,{children:[y.count&&(0,R.jsxs)(`b`,{className:`font-semibold text-text`,children:[y.count,` `]}),y.text]})}),o&&(0,R.jsx)(`span`,{className:`ml-auto flex shrink-0 gap-1`,"aria-hidden":!0,children:v.map(e=>(0,R.jsx)(`span`,{className:F3(`h-1.5 w-5.5 rounded-pill`,e.ok?`bg-ok`:`bg-hairline-strong`)},e.field))}),r&&(0,R.jsx)(J,{variant:`ghost`,className:`ml-auto`,onClick:r,children:`Set up later`})]}),(0,R.jsxs)(`div`,{children:[_&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`min-w-0 grow text-sm text-warn`,children:_}),(0,R.jsx)(J,{variant:`ghost`,onClick:p,children:`Retry`})]}),o&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(B3,{...b(`container-runtime`),probe:c,onRecheck:p}),(0,R.jsx)(V3,{...b(`sandcastle-image`),probe:l,runtimeOk:c?.status===`ok`,projectId:e,onDone:p}),u.map(e=>e.kind===`token`?(0,R.jsx)(q3,{...b(M4(e.runtime)),probe:e.probe,onDone:p},e.runtime):(0,R.jsx)(J3,{...b(M4(e.runtime)),row:e,onDone:p},e.runtime)),e&&(0,R.jsx)(G3,{...b(`burn-cache`),projectId:e})]})]})]})}function A3(e){return e.status===`ok`||e.severity===`info`}var j3=1e4,M3=`still checking — this is taking longer than usual`,N3=`The container runtime has not answered yet. A runtime that is starting up — or wedged — can leave the checks outstanding for minutes.`;function P3(e,t){let[n,r]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(r(!1),!e)return;let t=setTimeout(()=>r(!0),j3);return()=>clearTimeout(t)},[e,t]),n}function F3(...e){return e.filter(Boolean).join(` `)}var I3=Object.fromEntries(P4.map(e=>[e.field,e]));function L3({field:e,label:t,visible:n=!0,highlight:r=!1,detail:i,ok:a,children:o,below:s}){let{ref:c,flash:l}=H4(r);return n?(0,R.jsxs)(`div`,{ref:c,...e?{"data-field":e}:{},className:F3(`grid grid-cols-[18px_minmax(160px,1fr)_auto] items-center gap-x-2.5 gap-y-2`,`border-t border-hairline-soft px-3 py-2.5 first:border-t-0`,l&&`rounded-sm outline-2 outline-offset-2 outline-accent`),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:F3(`size-2 justify-self-center rounded-pill`,a?`bg-ok`:`bg-warn ring-3 ring-warn/15`)}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium text-text`,children:t}),(0,R.jsx)(`div`,{className:`truncate font-mono text-xs text-text-3`,title:i,children:i})]}),(0,R.jsx)(`div`,{className:`flex max-w-90 flex-wrap items-center justify-end gap-2`,children:o}),s]}):null}function R3({children:e}){return(0,R.jsx)(`div`,{className:`overflow-hidden rounded-md border border-hairline`,children:e})}function z3({sessionId:e,label:t,onDone:n,onEnded:r}){return(0,R.jsxs)(`div`,{className:`col-span-full flex flex-col gap-2`,children:[(0,R.jsx)(`div`,{className:`h-70 overflow-hidden rounded-sm border border-hairline`,children:(0,R.jsx)(MU,{label:t,children:(0,R.jsx)(cQ,{sessionId:e,onEnded:r})})}),n&&(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(J,{variant:`ghost`,onClick:n,children:`Done — re-check`})})]})}function B3({probe:e,onRecheck:t,...n}){let r=B.setup.runtimeGuide.useQuery(void 0,{enabled:e?.status===`missing`,refetchOnWindowFocus:!1}),i=qy();if(!e)return null;let a=e.status===`missing`?r.data:void 0,o=a?.command??e.fix??``,s=e.status===`ok`;return(0,R.jsxs)(L3,{...n,detail:e.detail,ok:s,children:[!s&&o&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`code`,{className:`max-w-full truncate rounded-sm border border-hairline bg-panel-inset px-2 py-1 font-mono text-xs text-accent-hi`,children:o}),(0,R.jsx)(J,{variant:`ghost`,onClick:()=>{navigator.clipboard?.writeText(o),i.push(`copied`,`info`)},children:`Copy`})]}),!s&&a?.note&&(0,R.jsx)(`span`,{className:`basis-full text-right text-xs text-text-3`,children:a.note}),!s&&(0,R.jsx)(J,{variant:`ghost`,onClick:t,children:`Re-check`})]})}function V3({probe:e,runtimeOk:t,projectId:n,onDone:r,...i}){let[a,o]=(0,L.useState)(null),s=qy(),c=B.setup.imageBuildTarget.useQuery(n?{projectId:n}:void 0),l=B.setup.startTerminal.useMutation({onSuccess:({sessionId:e,notices:t})=>{o(e);for(let e of t)s.push(e)},onError:e=>s.push(e.message)});return e?(0,R.jsx)(L3,{...i,detail:e.detail,ok:A3(e),below:a&&(0,R.jsx)(z3,{sessionId:a,label:`build-image`,onEnded:r,onDone:()=>{o(null),r()}}),children:!a&&(0,R.jsx)(U3,{probe:e,target:H3(c),runtimeOk:t,pending:l.isPending,onStart:()=>l.mutate({kind:`build-image`,...n?{projectId:n}:{}})})}):null}function H3(e){let{data:t}=e;return t?t.kind===`refused`?{kind:`refused`,reason:t.reason}:{kind:`ready`,dockerfile:t.dockerfile,tag:t.tag}:e.error?{kind:`error`,message:e.error.message}:{kind:`loading`}}function U3({probe:e,target:t,runtimeOk:n,pending:r,onStart:i}){if(e.status===`custom`)return(0,R.jsx)(`span`,{className:`basis-full text-right text-xs text-text-3`,children:e.fix});if(t.kind===`refused`)return(0,R.jsx)(`span`,{className:`basis-full text-right text-xs text-text-3`,children:t.reason});let a=e.status===`missing`||e.status===`not-built-yet`?`Build`:`Rebuild`,o=r?`Starting…`:t.kind===`ready`?`${a} image · ${t.tag}`:t.kind===`loading`?`${a} image · resolving…`:`${a} image`;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(J,{variant:`ghost`,"aria-label":`${a} image`,disabled:!n||r||t.kind!==`ready`,title:n?t.kind===`ready`?`Dockerfile: ${t.dockerfile}\nImage: ${t.tag}`:void 0:`Install a container runtime first`,onClick:i,children:o}),t.kind===`error`&&(0,R.jsx)(`span`,{className:`basis-full text-right text-xs text-warn`,children:t.message})]})}function W3({status:e,pending:t,refusal:n,onClear:r,...i}){return e?.mode===`volume`?(0,R.jsxs)(L3,{field:I3[`burn-cache`].field,label:I3[`burn-cache`].label,...i,ok:!0,detail:`${e.volumeName} — ${e.sizeBytes===null?`empty`:o_(e.sizeBytes)}`,children:[(0,R.jsx)(J,{variant:`ghost`,disabled:t,onClick:r,children:t?`Clearing…`:`Clear`}),n&&(0,R.jsx)(`span`,{className:`basis-full text-right text-xs text-warn`,children:n})]}):null}function G3({projectId:e,...t}){let n=B.useUtils(),[r,i]=(0,L.useState)(null),a=B.system.burnCache.status.useQuery({projectId:e},{refetchOnWindowFocus:!1}),o=B.system.burnCache.clear.useMutation({onSuccess:()=>{i(null),n.system.burnCache.status.invalidate()},onError:e=>i(e.message)});return(0,R.jsx)(W3,{...t,status:a.data,pending:o.isPending,refusal:r,onClear:()=>o.mutate({projectId:e})})}var K3={"claude-code":{mint:{kind:`setup-token`,label:`Run claude setup-token`},placeholder:`paste sk-ant-oat01-…`}};function q3({probe:e,onDone:t,...n}){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(null),l=qy(),u=B.setup.startTerminal.useMutation({onSuccess:({sessionId:e})=>i(e),onError:e=>l.push(e.message)}),d=B.setup.afkToken.useMutation({onSuccess:e=>{c(e),e.valid&&t()},onError:e=>l.push(e.message)});if(!e?.runtime)return null;let f=e.runtime,p=K3[f];return p?(0,R.jsxs)(L3,{...n,detail:e.detail,ok:e.status===`ok`,below:r&&(0,R.jsx)(z3,{sessionId:r,label:`setup-token`}),children:[p.mint&&!r&&(0,R.jsx)(J,{variant:`ghost`,onClick:()=>p.mint&&u.mutate({kind:p.mint.kind}),disabled:u.isPending,children:u.isPending?`Starting…`:p.mint.label}),(0,R.jsx)(`input`,{"aria-label":n.label,className:`h-7 w-48 min-w-0 rounded-sm border border-hairline bg-panel-inset px-2 font-mono text-xs text-text placeholder:text-text-4`,value:a,onChange:e=>o(e.target.value),placeholder:p.placeholder,spellCheck:!1,autoComplete:`off`}),(0,R.jsx)(J,{variant:`solid`,disabled:a.trim()===``||d.isPending,onClick:()=>d.mutate({token:a,runtime:f}),children:d.isPending?`Verifying…`:`Save & verify`}),s&&(0,R.jsxs)(`span`,{className:F3(`basis-full text-right text-xs`,s.valid?`text-ok`:`text-warn`),children:[s.valid?`✓ `:`⚠ `,s.detail,s.fix&&(0,R.jsx)(`span`,{className:`block text-text-3`,children:s.fix})]})]}):null}function J3({row:e,onDone:t,...n}){let[r,i]=(0,L.useState)(null),a=qy(),o=B.setup.startTerminal.useMutation({onSuccess:({sessionId:e})=>i(e),onError:e=>a.push(e.message)}),s=Fm[e.runtime],c=e.probe.status===`ok`;return(0,R.jsx)(L3,{...n,ok:c,detail:c?`Signed in — ${e.probe.detail}`:e.probe.detail,below:r&&(0,R.jsx)(z3,{sessionId:r,label:s.kind,onDone:()=>{i(null),t()}}),children:c?(0,R.jsxs)(`span`,{className:`inline-flex h-5 items-center gap-1.5 rounded-pill border border-hairline bg-panel-2 px-2 text-xs text-text-2`,children:[(0,R.jsx)(`span`,{className:`size-1.5 rounded-pill bg-ok`,"aria-hidden":!0}),`Ready`]}):!r&&(0,R.jsx)(J,{variant:`ghost`,disabled:o.isPending,onClick:()=>o.mutate({kind:s.kind}),children:o.isPending?`Starting…`:`Sign in`})})}function Y3({globals:e,projectId:t,filter:n,highlightField:r}){return e.isLoading?(0,R.jsx)(NO,{children:`loading…`}):e.error?(0,R.jsxs)(NO,{children:[`could not load settings: `,e.error.message]}):e.data?(0,R.jsxs)(`div`,{className:`flex flex-col gap-5.5`,children:[P4.some(e=>U4(n,e.field))&&(0,R.jsx)(X4,{title:`Prerequisites for unattended burns`,children:(0,R.jsx)(k3,{projectId:t,filter:n,highlightField:r})}),(0,R.jsx)(Y4,{title:`Width & retries`,rows:fm(e.data,`burns`),filter:n,highlightField:r})]}):null}var X3={prep:`established by preparation`,session:`established in a conversation on this machine`,human:`set by you`,build:`built by runcastle from this repo's own Dockerfile`};function Z3({source:e,evidence:t,onClose:n}){let r=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),n())},t=e=>{let t=r.current?.parentElement;e.target instanceof Node&&t?.contains(e.target)||n()};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`mousedown`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`mousedown`,t)}},[n]),(0,R.jsxs)(`div`,{ref:r,className:`absolute top-6.5 left-0 z-10 max-h-65 w-105 overflow-auto rounded-md border border-hairline-strong bg-panel-3 px-3 py-2.5 shadow-overlay`,children:[(0,R.jsxs)(`h4`,{className:`mb-1.5 text-xs font-semibold tracking-[0.06em] text-text-3 uppercase`,children:[`Evidence · `,X3[e]]}),(0,R.jsx)(`pre`,{className:`font-mono text-sm leading-normal whitespace-pre-wrap text-text-2`,children:t})]})}var Q3=[{group:`model`,title:`Model & sandbox`},{group:`commands`,title:`Commands`},{group:`chat`,title:`Project chat`}];function $3({scoped:e,projectId:t,filter:n,highlightField:r}){let i=B.project.prep.useQuery({projectId:t}),[a,o]=(0,L.useState)(null);if(e.isLoading)return(0,R.jsx)(NO,{children:`loading…`});if(e.error)return(0,R.jsxs)(NO,{children:[`could not load settings: `,e.error.message]});if(!e.data)return null;let s=i.data?.findings??[],c=new Map(s.map(e=>[e.key,e])),l=fm(e.data,`project`,s),u=e=>{let t=c.get(e.key);return a!==e.key||!t?.evidence?null:(0,R.jsx)(Z3,{source:t.source,evidence:t.evidence,onClose:()=>o(null)})};return(0,R.jsx)(`div`,{className:`flex flex-col gap-5.5`,children:Q3.map(({group:e,title:i})=>(0,R.jsx)(Y4,{title:i,rows:l.filter(t=>t.group===e),projectId:t,filter:n,highlightField:r,onOpenEvidence:e=>o(t=>t===e?null:e),evidence:u},e))})}var e6={general:`Machine-wide.`,models:`Machine-wide — the roster, the default, and which model runs each step.`,burns:`Machine-wide — unattended runs.`,project:`Global values show as ghost text.`},t6={general:i3,models:T3,burns:Y3,project:$3};function n6({projectId:e,projectName:t,location:n,onClose:r}){let i=B.settings.get.useQuery(),a=B.settings.get.useQuery({projectId:e}),[o,s]=(0,L.useState)(n.page),[c,l]=(0,L.useState)(``),u=(0,L.useRef)(null),d=(0,L.useMemo)(()=>Dm(c,r6(i.data,a.data)),[c,i.data,a.data]),f={query:c,...d},p=c.trim()!==``;(0,L.useEffect)(()=>{if(!p||d.counts[o]>0)return;let e=I4.find(e=>d.counts[e.page]>0);e&&s(e.page)},[p,d,o]);let m=e=>{!(e.metaKey||e.ctrlKey)||e.key.toLowerCase()!==`f`||(e.preventDefault(),u.current?.focus(),u.current?.select())},h=t6[o],g=I4.find(e=>e.page===o)?.label??``,_=p&&d.matches.size===0;return(0,R.jsx)(RO,{open:!0,onClose:r,size:`xl`,label:`Settings`,className:`overflow-hidden`,children:(0,R.jsxs)(`div`,{className:`grid h-[min(700px,80vh)] grid-cols-[184px_1fr]`,onKeyDown:m,children:[(0,R.jsx)(B4,{page:o,filter:f,filterRef:u,projectName:t,onFilter:l,onSelect:s}),(0,R.jsxs)(`section`,{className:`grid min-h-0 min-w-0 grid-rows-[48px_minmax(0,1fr)]`,children:[(0,R.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2.5 border-b border-hairline pr-3 pl-5.5`,children:[(0,R.jsx)(`h2`,{className:`text-lg font-semibold`,children:g}),(0,R.jsx)(`span`,{className:`truncate text-sm text-text-3`,children:e6[o]}),(0,R.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Close (Esc)`,className:`${e1} ml-auto grid size-7 shrink-0 place-items-center rounded-sm text-text-3 hover:bg-panel-3 hover:text-text`,children:(0,R.jsx)(Hh,{size:14})})]}),(0,R.jsxs)(`div`,{className:`min-h-0 overflow-x-hidden overflow-y-auto px-5.5 pt-4.5 pb-7`,children:[(0,R.jsx)(h,{globals:i,scoped:a,projectId:e,filter:f,...o===n.page&&n.field?{highlightField:n.field}:{}}),_&&(0,R.jsx)(`p`,{className:`py-10 text-center text-sm text-text-3`,children:`Nothing matches. Try “model”, “verify” or “image”.`})]})]})]})})}function r6(e,t){let n=I4.flatMap(({page:n})=>{let r=n===`project`?t:e;return r?Em(r,n):[]}),r=P4.map(e=>({id:e.field,page:`burns`,terms:[e.label,...e.terms]}));return[...n,...r]}function i6({projectId:e,nav:t}){let n=Sg(e),{selectedFeatureId:r,projectSelected:i,preparing:a,select:o,selectProject:s,startPreparation:c,setCmdk:l}=n,[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(0),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(0),v=()=>{h(!0),_(e=>e+1)},[y,b]=(0,L.useState)(0),x=()=>{s(),b(e=>e+1)},S=()=>b(0),[C,w]=(0,L.useState)(0),T=()=>{s(),w(e=>e+1)},E=()=>w(0),D=sb(),O=B.feature.list.useQuery({projectId:e},{refetchInterval:$m()}),k=Jy(e),A=B.project.prep.useQuery({projectId:e}),j=A.data?.prepared??!0,M=A.data?.empty??!0,N=B.feature.driveInfo.useQuery(void 0,{refetchInterval:$m()}).data,P=Zy(N,e)?N:null,F=O.data,[ee,te]=(0,L.useState)(!1),[ne]=(0,L.useState)(()=>Sh(Th()));(0,L.useEffect)(()=>{if(ee||!F)return;let t=Ch(ne,e);if(t?.kind===`chat`)s();else if(t?.kind===`prepare`)c();else if(t){let e=F.find(e=>e.slug===t.featureSlug);o(e?.id??v_(F)?.id??null)}else if(!r&&!i&&!a){let e=v_(F);e&&o(e.id)}te(!0)},[ee,F,e,ne,r,i,a,o,s,c]);let I=F?.find(e=>e.id===r),re=I?.slug??null;Oh(ee&&!n.creating?wh({projectId:e,preparing:a,projectSelected:i,featureSlug:re}):null,t=>{if(!t||yh(t)!==e)return;let n=Ch(t,e);if(!n)o(null);else if(n.kind===`chat`)s();else if(n.kind===`prepare`)c();else{let e=F?.find(e=>e.slug===n.featureSlug);o(e?.id??v_(F??[])?.id??null)}});let ie=()=>{s(),k.session?p(e=>e+1):k.start()};(0,L.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`?(e.preventDefault(),l(!0)):Xy(e)&&(e.preventDefault(),v())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]);let ae=Ny({...n,featureCount:F?.length??0,prepared:j,empty:M}),oe=F?.find(e=>e.id===r)?.phase,se=gg(n.inspectorPreference,n.viewedPhase??oe),ce=Py(ae,se),le=(0,R.jsxs)(`div`,{className:`grid h-full grid-rows-[44px_1fr_28px]`,style:{"--sidebar-w":`${D.width}px`},children:[(0,R.jsx)(Xj,{nav:t,view:ae,featureTitle:I?.title??null,onOpenCmdk:()=>n.setCmdk(!0),onOpenNote:v,noteOpen:m,onOpenSettings:()=>n.openSettings(),onGoToProjectHome:()=>n.select(null),onToggleInspector:()=>n.toggleInspector(se),inspectorCollapsed:se,drivingBranch:P?.branch??null,onOpenDrive:T}),(0,R.jsxs)(`div`,{className:`grid min-h-0 ${ce?`grid-cols-[var(--sidebar-w)_1fr_var(--inspector-w)]`:`grid-cols-[var(--sidebar-w)_1fr]`}`,children:[(0,R.jsx)(dM,{projectId:e,selectedFeatureId:n.selectedFeatureId,projectSelected:n.projectSelected,width:D.width,talk:k,onSelect:n.select,onSelectProject:n.selectProject,onNewChat:ie,onDraft:n.startDraft,onOpenPreparation:n.startPreparation,onResize:D.setWidth}),ae===`create`?(0,R.jsx)(`section`,{className:`workspace`,children:(0,R.jsx)(m4,{projectId:e,onCancel:n.cancelCreate,onCreated:n.select})}):ae===`prepare`?(0,R.jsx)(h4,{projectId:e,...n.preparing?{onClose:n.closePreparation}:{}}):ae===`project`?(0,R.jsx)(u4,{projectId:e,talk:k,newChatRequest:f,onConsumeNewChatRequest:()=>p(0),inboxRequest:y,onConsumeInboxRequest:S,empty:M,onOpenPreparation:n.startPreparation,driveRequest:C,onConsumeDriveRequest:E}):ae===`feature`&&r?(0,R.jsx)(MU,{label:`feature view`,fallback:e=>(0,R.jsx)(S2,{featureId:r,error:e}),children:(0,R.jsx)(P2,{featureId:r,viewedPhase:n.viewedPhase,onViewPhase:n.viewPhase,guidance:n.guidance,mapRailCollapsed:n.mapRailCollapsed,onToggleMapRail:n.toggleMapRail,artifactPaneCollapsed:n.artifactPaneCollapsed,onToggleArtifactPane:n.toggleArtifactPane,chatPanelOpen:n.chatPanelOpen,onToggleChatPanel:n.toggleChatPanel,driving:u,onDriveChange:d})},`ws-${r}`):(0,R.jsx)(`section`,{className:`workspace`,children:(0,R.jsx)(a6,{onNewChat:ie,onDraft:n.startDraft})}),ce&&n.selectedFeatureId&&(0,R.jsx)(FH,{featureId:n.selectedFeatureId},`insp-${n.selectedFeatureId}`)]}),(0,R.jsx)(QH,{projectId:e,view:ae,activeFeatureId:n.selectedFeatureId,driving:u,onDriveChange:d}),(0,R.jsx)(E4,{open:n.cmdkOpen,onClose:()=>n.setCmdk(!1),features:F??[],selectedFeatureId:n.selectedFeatureId,onSelect:n.select,onOpenSettings:()=>n.openSettings(),onOpenPreparation:n.startPreparation,onOpenProjectChat:n.selectProject,onOpenNote:v,nav:t}),(0,R.jsx)(k4,{projectId:e,projectName:t.currentProject?.name??``,open:m,openRequest:g,onClose:()=>h(!1),onOpenInbox:x}),n.settings&&(0,R.jsx)(n6,{projectId:e,projectName:t.currentProject?.name??``,location:n.settings,onClose:n.closeSettings})]});return(0,R.jsx)(n1,{open:n.openSettings,children:le})}function a6({onNewChat:e,onDraft:t}){return(0,R.jsx)(`div`,{className:`ws-empty`,children:(0,R.jsxs)(`div`,{className:`ws-empty-inner`,children:[(0,R.jsx)(`div`,{className:`ws-empty-logo`,children:(0,R.jsx)(sg,{size:44,variant:`outline`})}),(0,R.jsx)(`div`,{className:`ws-empty-title`,children:`Select a feature to begin`}),(0,R.jsx)(`div`,{className:`ws-empty-sub`,children:`Or start one — every feature moves through the same guided pipeline.`}),(0,R.jsxs)(`div`,{className:`ws-empty-actions`,children:[(0,R.jsx)(`button`,{className:`btn btn-ghost`,onClick:e,children:`New chat`}),(0,R.jsx)(`button`,{className:`btn btn-ghost`,onClick:t,children:`Draft`})]}),(0,R.jsx)(`div`,{className:`ws-empty-hint`,children:`New is the door for both features and quick changes: a conversation that can read a screenshot, check what already shipped, and emit burn-ready tickets. Draft writes an idea down now, to work out later.`})]})})}var o6={attention:`Needs you`,working:`Agent working`,steady:`Steady`,empty:`No features yet`},s6={attention:`bg-needs`,working:`bg-ph-implementation animate-pulse`,steady:`bg-ok`,empty:`bg-text-4`},c6=`flex flex-1 flex-col gap-1.5 p-4 text-left`,l6=`${c6} cursor-pointer border-0 bg-transparent`,u6=`relative flex flex-col rounded-lg border border-hairline bg-panel transition-[border-color] duration-(--dur-2) ease-app hover:border-hairline-strong`,d6=`h-6 min-w-0 flex-1 rounded-sm border border-accent-line bg-panel-inset px-1.5 text-base text-text focus:outline-none`,f6=`A run is in flight — it has to finish before this project can go.`;function p6({project:e,stats:t,loading:n,onOpen:r}){let i=qy(),a=B.useUtils(),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(e.name),f=B.project.rename.useMutation({onSuccess:async()=>{await a.project.list.invalidate(),s(!1)},onError:e=>i.push(e.message)}),p=B.project.close.useMutation({onSuccess:async()=>{await a.project.list.invalidate(),i.push(`removed ${e.name}`,`info`)},onError:e=>i.push(e.message)});(0,L.useEffect)(()=>{if(!c)return;let e=e=>{e.key===`Escape`&&l(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]);let m=t.activeRuns>0,h=()=>{let t=u.trim();t&&t!==e.name?f.mutate({projectId:e.id,name:t}):s(!1)},g=(0,R.jsx)(m6,{project:e,stats:t,loading:n,name:o?(0,R.jsx)(`input`,{className:d6,value:u,"aria-label":`Project name`,maxLength:80,autoFocus:!0,onChange:e=>d(e.target.value),onKeyDown:t=>{t.stopPropagation(),t.key===`Enter`&&h(),t.key===`Escape`&&(d(e.name),s(!1))},onBlur:h}):(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-lg font-semibold text-text`,children:e.name})});return(0,R.jsxs)(`div`,{className:u6,children:[c?(0,R.jsxs)(`div`,{className:c6,children:[(0,R.jsxs)(`p`,{className:`text-base text-text-2`,children:[`Remove `,(0,R.jsx)(`span`,{className:`font-semibold text-text`,children:e.name}),`? The repo on disk is untouched.`]}),(0,R.jsxs)(`div`,{className:`mt-auto flex gap-2 pt-3`,children:[(0,R.jsx)(J,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,R.jsx)(J,{variant:`danger`,disabled:m||p.isPending,onClick:()=>p.mutate({projectId:e.id}),children:p.isPending?`Removing…`:`Remove`})]}),m&&(0,R.jsx)(`p`,{className:`pt-2 text-sm text-text-3`,children:f6})]}):o?(0,R.jsx)(`div`,{className:c6,children:g}):(0,R.jsx)(`button`,{className:l6,onClick:r,title:`Open ${e.name}`,children:g}),!c&&(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(tM,{label:`${e.name} actions`,actions:[{key:`rename`,label:`Rename`,onSelect:()=>{d(e.name),s(!0)}},{key:`remove`,label:`Remove from list`,danger:!0,onSelect:()=>l(!0)}]})})]})}function m6({project:e,stats:t,loading:n,name:r}){let i=t.activeRuns>0;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-7`,children:[r,(0,R.jsx)(`span`,{className:`size-2 shrink-0 rounded-pill ${s6[t.health]}`,title:o6[t.health]})]}),(0,R.jsx)(`div`,{className:`truncate text-left font-mono text-xs text-text-4`,dir:`rtl`,title:e.repoPath,children:(0,R.jsx)(`bdi`,{children:e.repoPath})}),(0,R.jsxs)(`div`,{className:`mt-2.5 flex gap-4`,children:[(0,R.jsx)(h6,{n:t.total,label:t.total===1?`feature`:`features`}),(0,R.jsx)(h6,{n:t.activeRuns,label:`running`,tone:i?`text-ph-implementation`:void 0,spin:i}),(0,R.jsx)(h6,{n:t.needsYou,label:`needs you`,tone:t.needsYou>0?`text-needs`:void 0})]}),(0,R.jsx)(`div`,{className:`mt-3 text-xs tracking-[0.06em] text-text-4 uppercase`,children:n?`loading…`:o6[t.health]})]})}function h6({n:e,label:t,tone:n,spin:r}){return(0,R.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 text-text-3`,children:[r&&(0,R.jsx)(kO,{className:`self-center`}),(0,R.jsx)(`span`,{className:`font-mono text-lg ${n??`text-text`}`,children:e}),(0,R.jsx)(`span`,{className:`text-xs`,children:t})]})}var g6=`flex min-h-38 cursor-pointer flex-col items-start justify-center gap-1 rounded-lg border border-dashed border-hairline-strong bg-transparent p-4 text-left text-text-3 transition-[color,background-color,border-color] duration-(--dur-2) ease-app hover:border-accent-line hover:bg-accent-soft hover:text-text`;function _6({nav:e}){let t=e.projects??[],n=$m(),r=B.useQueries(e=>t.map(t=>e.feature.list({projectId:t.id},{refetchInterval:n})));return(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsx)(`header`,{className:`flex h-11 flex-none items-center border-b border-hairline bg-panel px-4`,children:(0,R.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,children:(0,R.jsx)(sg,{size:17})}),(0,R.jsx)(cg,{})]})}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-[clamp(20px,6vw,72px)] pt-12 pb-14`,children:(0,R.jsxs)(`div`,{className:`mx-auto max-w-[1100px]`,children:[(0,R.jsxs)(`header`,{className:`mb-7`,children:[(0,R.jsxs)(`h1`,{className:`text-xl font-semibold text-text`,children:[`Projects (`,t.length,`)`]}),(0,R.jsx)(`p`,{className:`mt-2 max-w-[60ch] text-base text-text-2`,children:`Every open project and where it stands — runs keep going in the background while you switch.`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4`,children:[t.map((t,n)=>{let i=r[n]?.data;return(0,R.jsx)(p6,{project:t,stats:lh(i??[]),loading:i===void 0,onOpen:()=>e.enterProject(t.id)},t.id)}),(0,R.jsxs)(`button`,{className:g6,onClick:e.showOpen,children:[(0,R.jsx)(`span`,{className:`mb-0.5 inline-flex text-accent-hi`,children:(0,R.jsx)(Bh,{size:16})}),(0,R.jsx)(`span`,{className:`text-base font-semibold`,children:`Open a project`}),(0,R.jsx)(`span`,{className:`text-xs text-text-4`,children:`Point runcastle at a local git repo`})]})]})]})})]})}var v6=4;function y6({crumbs:e,value:t,onNavigate:n,onEnterPath:r,placeholder:i}){let[a,o]=(0,L.useState)(null),s=a!==null,c=e.length>v6,l=c?e.slice(-3):e;return s?(0,R.jsx)(`input`,{className:`h-8 min-w-0 flex-1 rounded-md border border-hairline bg-panel-inset px-2.5 font-mono text-sm text-text outline-none focus:border-accent`,"aria-label":`Path`,spellCheck:!1,autoComplete:`off`,autoFocus:!0,value:a,placeholder:i,onChange:e=>o(e.target.value),onBlur:()=>o(null),onKeyDown:e=>{e.key===`Enter`&&(r(a.trim()),o(null)),e.key===`Escape`&&(e.stopPropagation(),o(null))}}):(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 cursor-text items-center gap-0.5 truncate`,onClick:()=>o(t),role:`group`,"aria-label":`Current path`,children:[c&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(b6,{crumb:e[0],onNavigate:n}),(0,R.jsx)(Kh,{size:11}),(0,R.jsx)(`span`,{className:`shrink-0 px-1 text-sm text-text-4`,title:e[e.length-1].path,children:`…`})]}),l.map((e,t)=>(0,R.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5`,children:[(t>0||c)&&(0,R.jsx)(Kh,{size:11}),(0,R.jsx)(b6,{crumb:e,onNavigate:n})]},e.path)),(0,R.jsx)(`button`,{type:`button`,className:`${AO} ml-1 shrink-0 rounded-sm px-1 text-sm text-text-4 hover:text-text`,"aria-label":`Edit path`,title:`Edit path`,onClick:()=>o(t),children:`✎`})]})}function b6({crumb:e,onNavigate:t}){return(0,R.jsx)(`button`,{type:`button`,className:`${AO} shrink-0 rounded-sm px-1 py-0.5 font-mono text-sm text-text-2 hover:bg-panel-inset hover:text-text`,onClick:n=>{n.stopPropagation(),t(e.path)},children:e.name})}var x6=`flex items-center gap-2 rounded-md border-0 px-2 py-1.5 text-left text-sm hover:bg-panel-inset hover:text-text`,S6=`${AO} flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-panel-inset hover:text-text`;function C6({initialPath:e,onPick:t,onCancel:n}){let r=e?.trim()||void 0,[i,a]=(0,L.useState)(r),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(r??null),[u,d]=(0,L.useState)(null),f=B.project.roots.useQuery(),p=B.project.browse.useQuery({dir:i,showHidden:o},{placeholderData:e=>e,retry:!1}),m=p.data,h=m?.dir??i,g=e=>{l(null),d(null),a(e)},_=e=>{l(e||null),d(null),a(e||void 0)},v=c!==null&&p.isError?mh(i,p.error.message):null,y=v!==null&&v.dir!==i,b=v?.dir,x=p.error?.message;return(0,L.useEffect)(()=>{y&&(i===c&&x&&d(_h(x)),a(b))},[y,b,i,c,x]),(0,R.jsxs)(RO,{open:!0,onClose:n,size:`lg`,label:`Choose a repository`,className:`flex h-[66vh] flex-col overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-hairline px-4 py-3`,children:[(0,R.jsx)(`span`,{className:`text-base font-semibold text-text`,children:`Choose a repository`}),(0,R.jsx)(`button`,{className:`${AO} rounded-sm p-0.5 text-text-3 hover:text-text`,onClick:n,"aria-label":`Close (Esc)`,children:(0,R.jsx)(Hh,{size:14})})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-hairline px-4 py-2.5`,children:[(0,R.jsx)(J,{variant:`ghost`,className:`shrink-0 px-2.5`,onClick:()=>m?.parent&&g(m.parent),disabled:!m?.parent,"aria-label":`Up one level`,title:`Up one level`,children:`↑`}),(0,R.jsx)(y6,{crumbs:m?.crumbs??[],value:c??h??``,onNavigate:g,onEnterPath:_,placeholder:_b()}),(0,R.jsxs)(`label`,{className:`flex shrink-0 cursor-pointer items-center gap-1.5 text-sm text-text-3 select-none`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`accent-accent`,checked:o,onChange:e=>s(e.target.checked)}),(0,R.jsx)(`span`,{children:`Hidden`})]})]}),u&&(0,R.jsx)(`div`,{className:`shrink-0 border-b border-hairline px-4 py-2.5`,children:(0,R.jsx)(FO,{message:u.message,path:u.path,hint:`Showing the closest folder that could be listed. Edit the path to try again.`})}),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`flex w-40 shrink-0 flex-col gap-px overflow-y-auto border-r border-hairline p-2`,children:(f.data??[]).map(e=>(0,R.jsxs)(`button`,{className:x6+(h===e.path?` bg-accent-soft text-text`:` bg-transparent text-text-3`),onClick:()=>g(e.path),title:e.path,children:[(0,R.jsx)(Qh,{size:13}),(0,R.jsx)(`span`,{className:`truncate font-mono`,children:e.label})]},e.path))}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto p-2`,children:[y||p.isLoading?(0,R.jsx)(NO,{children:`Loading…`}):p.isError?(0,R.jsx)(FO,{..._h(p.error.message)}):(m?.entries.length??0)===0?(0,R.jsxs)(NO,{children:[`No subfolders here`,o?``:` (hidden folders, junctions and node_modules are filtered)`,`.`]}):(m?.entries??[]).map(e=>(0,R.jsxs)(`button`,{className:S6+(e.isRepo?` text-text`:` text-text-2`),onClick:()=>g(e.path),onDoubleClick:()=>e.isRepo&&t(e.path),title:e.path,children:[(0,R.jsx)(Qh,{size:13}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.name}),e.isSymlink&&(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-text-4`,children:`link`}),e.isRepo&&(0,R.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs tracking-[0.04em] text-accent-hi uppercase`,children:[(0,R.jsx)(Lh,{size:11}),` git`]})]},e.path)),m?.truncated&&(0,R.jsx)(NO,{children:`Listing truncated — this folder is very large.`})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-t border-hairline px-4 py-3`,children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-left font-mono text-sm text-text-3`,dir:`rtl`,title:h,children:(0,R.jsx)(`bdi`,{children:h??`—`})}),(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,R.jsx)(J,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,R.jsx)(J,{variant:`solid`,onClick:()=>h&&t(h),disabled:!h||p.isError,children:`Open this folder`})]})]})]})}function w6({firstRun:e,onOpened:t,onCancel:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),d=qy(),f=B.useUtils(),p=B.project.open.useMutation({onSuccess:async e=>{await f.project.list.invalidate(),d.push(`opened ${e.name}`,`info`),t(e.id)},onError:()=>void 0}),m=B.project.initRepo.useMutation({onSuccess:({repoPath:e})=>{c(e),p.mutate({repoPath:e})},onError:()=>void 0}),h=()=>{p.reset(),m.reset(),u(!1)},g=e=>{let t=(e??r).trim();if(t){if(h(),!vb(t)){u(!0);return}c(t),p.mutate({repoPath:t})}},_=()=>{h(),o(!0)},v=p.isPending||m.isPending,y=m.error??p.error,b=l?{message:`Enter an absolute path`,hint:`A path from the root of this machine, like ${_b()}.`,path:null}:y?vh(y.message,s):null,x=e=>{i(e),o(!1),g(e)};return(0,R.jsxs)(`div`,{className:`flex h-full items-center justify-center px-6 py-10`,onKeyDown:t=>{t.key===`Escape`&&!e&&!a&&n()},children:[(0,R.jsxs)(`div`,{className:`w-full max-w-[560px]`,children:[(0,R.jsx)(`div`,{className:`mb-6 flex size-9 items-center justify-center rounded-md bg-accent`,children:(0,R.jsx)(sg,{size:22,variant:`ink`})}),(0,R.jsx)(`div`,{className:`text-xs font-semibold tracking-[0.09em] text-accent-hi uppercase`,children:e?`Welcome to runcastle`:`Your projects`}),(0,R.jsx)(`h1`,{className:`mt-2 text-xl font-semibold text-text`,children:e?`Open your first project`:`Open a project`}),(0,R.jsx)(`p`,{className:`mt-2 text-base text-text-2`,children:`Point runcastle at a local git repository — every feature runs its pipeline against it.`}),(0,R.jsxs)(`div`,{className:`mt-7 flex items-center gap-2`,children:[(0,R.jsx)(`input`,{id:`open-repo-path`,className:`${jO} flex-1`,value:r,onChange:e=>i(e.target.value),placeholder:_b(),"aria-label":`Repository path`,autoFocus:!0,spellCheck:!1,"aria-invalid":!!b,"aria-describedby":b?`open-repo-error`:void 0,onKeyDown:e=>{e.key===`Enter`&&g()}}),(0,R.jsx)(J,{variant:`ghost`,onClick:_,disabled:v,children:`Browse…`}),(0,R.jsx)(J,{variant:`solid`,onClick:()=>g(),disabled:v||r.trim()===``,children:p.isPending?`Opening…`:`Open`})]}),b?(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(FO,{...b,id:`open-repo-error`,action:b.offer===`init-repo`?(0,R.jsx)(J,{size:`xs`,onClick:()=>m.mutate({repoPath:s}),disabled:v,children:m.isPending?`Initializing…`:`Initialize repository`}):void 0})}):(0,R.jsx)(`p`,{className:`mt-3 text-sm text-text-3`,children:`Paste an absolute path, or browse for one. The default branch is detected when the project opens.`}),!e&&(0,R.jsx)(`div`,{className:`mt-8`,children:(0,R.jsx)(J,{variant:`ghost`,onClick:n,disabled:v,children:`Cancel`})})]}),a&&(0,R.jsx)(C6,{initialPath:r,onPick:x,onCancel:()=>o(!1)})]})}function T6({title:e,children:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`text-xs font-semibold tracking-[0.09em] text-accent-hi uppercase`,children:`Welcome to runcastle`}),(0,R.jsx)(`h1`,{className:`mt-2 text-xl font-semibold text-text`,children:e}),(0,R.jsx)(`p`,{className:`mt-2 text-base text-text-2`,children:t})]})}function E6({onBack:e,children:t}){return(0,R.jsxs)(`div`,{className:`mt-7 flex items-center gap-2`,children:[e&&(0,R.jsx)(J,{variant:`ghost`,onClick:e,children:`Back`}),(0,R.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:t})]})}function D6({onBack:e,onNext:t}){let[n,r]=(0,L.useState)(!1);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(T6,{title:`Run burns unattended?`,children:cv}),(0,R.jsx)(E6,{onBack:e,children:!n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(J,{variant:`ghost`,onClick:()=>r(!0),children:`Set up now`}),(0,R.jsx)(J,{variant:`solid`,onClick:t,children:`Skip for now`})]})}),n&&(0,R.jsx)(`div`,{className:`mt-6`,children:(0,R.jsx)(k3,{onDismiss:t})})]})}function O6({onBack:e,onNext:t}){let[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(``),o=qy(),s=B.useUtils(),c=B.setup.gitIdentity.useMutation({onSuccess:async()=>{await s.setup.doctor.invalidate(),t()},onError:e=>o.push(e.message)}),l=n.trim()!==``&&i.includes(`@`),u=()=>l&&c.mutate({name:n.trim(),email:i.trim()}),d=e=>e.key===`Enter`&&u();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(T6,{title:`Set your git identity`,children:[`runcastle commits documentation and merges on your behalf, so it needs a name and email. This writes to `,(0,R.jsx)(`code`,{className:`font-mono text-text`,children:`git config --global`}),`.`]}),(0,R.jsxs)(`div`,{className:`mt-7 flex flex-col gap-4`,children:[(0,R.jsx)(zO,{label:`Name`,children:(0,R.jsx)(`input`,{id:`wiz-name`,className:jO,value:n,onChange:e=>r(e.target.value),placeholder:`Ada Lovelace`,autoFocus:!0,spellCheck:!1,onKeyDown:d})}),(0,R.jsx)(zO,{label:`Email`,children:(0,R.jsx)(`input`,{id:`wiz-email`,className:jO,value:i,onChange:e=>a(e.target.value),placeholder:`ada@example.com`,spellCheck:!1,onKeyDown:d})})]}),(0,R.jsx)(E6,{onBack:e,children:(0,R.jsx)(J,{variant:`solid`,onClick:u,disabled:!l||c.isPending,children:c.isPending?`Saving…`:`Continue`})})]})}function k6({onNext:e}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(T6,{title:`Your coding agent, driven through a pipeline`,children:[`Describe a feature and runcastle runs the agent sessions that carry it from idea to merged —`,` `,(0,R.jsx)(`span`,{className:`font-mono text-text`,children:Ov.map(e=>kv[e]).join(` → `)}),` — keeping the decisions, spec, tickets and commits together on the feature's own branch.`]}),(0,R.jsxs)(`p`,{className:`mt-3 text-base text-text-2`,children:[`You are the one who says go. runcastle stops at gates and waits for you there:`,` `,(0,R.jsx)(`b`,{className:`font-semibold text-text`,children:`Burn`}),` to turn the tickets you have read into commits, `,(0,R.jsx)(`b`,{className:`font-semibold text-text`,children:`Merge`}),` once you have taken the branch for a test drive.`]}),(0,R.jsx)(E6,{children:(0,R.jsx)(J,{variant:`solid`,onClick:e,autoFocus:!0,children:`Set up runcastle →`})})]})}function A6({runtimes:e,onBack:t,onNext:n}){let r=Lm(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(T6,{title:`Connect a coding agent`,children:`runcastle drives whichever agent you have — sign in to one or both. Sessions run on the agent the model you pick belongs to, so the ones you connect here are the ones you can choose from later.`}),(0,R.jsx)(`div`,{className:`mt-7`,children:(0,R.jsx)(R3,{children:e.map(e=>(0,R.jsx)(j6,{runtime:e},e.runtime))})}),(0,R.jsx)(E6,{onBack:t,children:(0,R.jsx)(J,{variant:`solid`,onClick:n,disabled:r.length===0,children:`Continue`})}),r.length===0&&(0,R.jsx)(NO,{children:`Connect at least one agent to continue — runcastle has nothing to run without one.`})]})}function j6({runtime:e}){let[t,n]=(0,L.useState)(null),r=qy(),i=B.useUtils(),a=B.setup.startTerminal.useMutation({onSuccess:({sessionId:e})=>n(e),onError:e=>r.push(e.message)}),o=Fm[e.runtime],s=e.talkReady?`ready`:e.installed?`sign in`:`not installed`;return(0,R.jsxs)(L3,{label:`${e.label} — ${s}`,detail:e.detail,ok:e.talkReady,below:t&&(0,R.jsx)(z3,{sessionId:t,label:o.kind,onDone:()=>{n(null),i.setup.doctor.invalidate()}}),children:[e.installFix&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`code`,{className:`max-w-full truncate rounded-sm border border-hairline bg-panel-inset px-2 py-1 font-mono text-xs text-accent-hi`,children:e.installFix}),(0,R.jsx)(J,{variant:`ghost`,onClick:()=>{navigator.clipboard?.writeText(e.installFix??``),r.push(`copied`,`info`)},children:`Copy`})]}),e.installed&&!e.talkReady&&!t&&(0,R.jsx)(J,{variant:`solid`,disabled:a.isPending,onClick:()=>a.mutate({kind:o.kind}),children:a.isPending?`Starting…`:`Run ${o.command}`}),e.talkReady&&!e.afkReady&&(0,R.jsxs)(`span`,{className:`basis-full text-right text-xs text-text-3`,children:[`Signed in for sessions you watch. Unattended burns on `,e.label,` also need its key — the next step sets that up.`]})]})}var M6={passed:`text-ok`,done:`text-text-2`,current:`text-accent-hi`,todo:`text-text-4`},N6={passed:`bg-ok`,done:`bg-text-3`,current:`bg-accent`,todo:`bg-hairline`};function P6({steps:e}){let t=e.filter(e=>e.state===`passed`);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs`,"aria-label":`Setup progress`,children:e.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-1.5 ${M6[e.state]}`,title:e.detected,children:[e.state===`passed`?(0,R.jsx)(Vh,{size:11}):(0,R.jsx)(`span`,{className:`size-[7px] rounded-pill ${N6[e.state]}`,"aria-hidden":!0}),e.label]},e.key))}),t.map(e=>(0,R.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-sm text-text-3`,children:[(0,R.jsx)(`span`,{className:`flex-none text-ok`,children:(0,R.jsx)(Vh,{size:12})}),(0,R.jsxs)(`span`,{children:[e.label,` — `,e.detected]})]},e.key))]})}function F6({onOpened:e,onCancel:t}){let n=B.setup.doctor.useQuery(void 0,{refetchOnWindowFocus:!1}),r=n.data?.results.find(e=>e.id===`git-identity`),i=Im(n.data?.results??[]),[a,o]=(0,L.useState)(`intro`),s=B.setup.seedModelDefaults.useMutation(),c=()=>{s.mutate({runtimes:Lm(i)}),o(`project`)};if(n.isLoading)return(0,R.jsx)(I6,{children:(0,R.jsx)(NO,{children:`preparing setup…`})});if(a===`project`)return(0,R.jsx)(w6,{firstRun:!0,onOpened:e,onCancel:t});if(a===`intro`)return(0,R.jsx)(I6,{children:(0,R.jsx)(k6,{onNext:()=>o(Mm(r))})});let l=()=>{let e=Nm(a);e===`project`||e===void 0?c():o(e)},u=()=>o(Pm(a,r)??`intro`);return(0,R.jsxs)(I6,{children:[(0,R.jsx)(P6,{steps:Bm(a,r)}),(0,R.jsxs)(`div`,{className:`mt-6`,children:[a===`identity`&&(0,R.jsx)(O6,{onBack:u,onNext:l}),a===`runtimes`&&(0,R.jsx)(A6,{runtimes:i,onBack:u,onNext:l}),a===`afk`&&(0,R.jsx)(D6,{onBack:u,onNext:l})]})]})}function I6({children:e}){return(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 py-10`,children:(0,R.jsxs)(`div`,{className:`w-full max-w-[560px]`,children:[(0,R.jsx)(`div`,{className:`mb-6 flex size-9 items-center justify-center rounded-md bg-accent`,children:(0,R.jsx)(sg,{size:22,variant:`ink`})}),e]})})}var L6=`runcastle.update.dismissed`;function R6(e,t){return e.updateAvailable&&e.latest!==null&&e.latest!==t}function z6(){let e=B.system.checkUpdate.useQuery(void 0,{staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),[t,n]=(0,L.useState)(()=>{try{return localStorage.getItem(L6)}catch{return null}}),r=e.data;return!r||!r.latest||!R6(r,t)?null:(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5 overflow-hidden border-b border-accent-line bg-accent/12 px-3.5 py-1.5 text-sm text-text`,role:`status`,children:[(0,R.jsx)(`span`,{className:`size-1.75 shrink-0 animate-dot-glow rounded-pill bg-accent-hi`,"aria-hidden":`true`}),(0,R.jsxs)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:[`runcastle `,(0,R.jsx)(`strong`,{className:`font-semibold text-accent-hi`,children:r.latest}),` is available`,(0,R.jsx)(`span`,{className:`text-text-4`,children:` · `}),(0,R.jsxs)(`span`,{className:`text-text-3`,children:[`you're on `,r.current]})]}),(0,R.jsx)(`code`,{className:`rounded-sm border border-hairline bg-panel-inset px-1.5 py-0.5 font-mono text-xs whitespace-nowrap text-accent-hi select-all`,children:r.command}),(0,R.jsx)(`button`,{className:`${AO} ml-auto grid size-5.5 shrink-0 cursor-pointer place-items-center rounded-sm text-lg leading-none text-text-3 hover:bg-panel-3 hover:text-text`,onClick:()=>{try{localStorage.setItem(L6,r.latest)}catch{}n(r.latest)},"aria-label":`Dismiss update notice`,title:`Dismiss`,children:`×`})]})}function B6({error:e,onRecheck:t}){return e?(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5 overflow-hidden border-b border-danger/45 bg-danger/8 px-3.5 py-1.5 text-sm text-text`,role:`status`,children:[(0,R.jsx)(`span`,{className:`shrink-0 font-medium text-danger`,children:`Setup checks could not run`}),(0,R.jsx)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-text-3`,children:e}),(0,R.jsx)(`button`,{className:`${AO} ml-auto shrink-0 cursor-pointer rounded-sm px-1.5 py-0.5 text-text-2 underline underline-offset-2 hover:text-text`,onClick:t,children:`Re-run checks`})]}):null}function V6(){let e=Mh(),t;return t=e.loading||e.projects===void 0?(0,R.jsx)(`div`,{className:`app-loading`,children:(0,R.jsx)(NO,{children:`loading projects…`})}):e.view===`setup`?(0,R.jsx)(F6,{onOpened:e.enterProject,onCancel:e.cancelOpen}):e.view===`open`?(0,R.jsx)(w6,{firstRun:e.projects.length===0,onOpened:e.enterProject,onCancel:e.cancelOpen}):e.view===`project`&&e.currentProjectId?(0,R.jsx)(i6,{projectId:e.currentProjectId,nav:e},e.currentProjectId):(0,R.jsx)(_6,{nav:e}),(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsx)(z6,{}),(0,R.jsx)(B6,{error:e.doctorError,onRecheck:e.recheckDoctor}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1`,children:t})]})}function H6(){return rh(),(0,R.jsx)(V6,{})}function U6(e){return e instanceof Error&&e.message?e.message:typeof e==`string`&&e!==``?e:`something went wrong`}function W6(e,t){return typeof t.options.onError==`function`?null:U6(e)}function G6(){let[e]=(0,L.useState)(()=>new Ve({mutationCache:new Pe({onError:(e,t,n,r)=>{let i=W6(e,r);i&&Gy(i)}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}}})),[t]=(0,L.useState)(()=>B.createClient({links:[Bn({url:`/api/trpc`})]}));return(0,R.jsx)(B.Provider,{client:t,queryClient:e,children:(0,R.jsx)(Je,{client:e,children:(0,R.jsx)(Ky,{children:(0,R.jsx)(H6,{})})})})}var K6=document.getElementById(`root`);if(!K6)throw Error(`#root not found`);(0,pr.createRoot)(K6).render((0,R.jsx)(L.StrictMode,{children:(0,R.jsx)(G6,{})}));
|