@tryglen/review 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.mjs +73 -73
- package/dist/ui/assets/{agent-list-query-BgIUfEeT.js → agent-list-query-DqVLNOuo.js} +1 -1
- package/dist/ui/assets/{command-BSg5dFqb.js → command-DCMG8Nuf.js} +1 -1
- package/dist/ui/assets/{diff-viewer-B_49fnUB.js → diff-viewer-CdSOTCI1.js} +4 -4
- package/dist/ui/assets/{explored-file-view-R_xvhDGA.js → explored-file-view-DLx8rzcm.js} +1 -1
- package/dist/ui/assets/{history-nav-buttons-CjkVKgZu.js → history-nav-buttons-CcP8rzqZ.js} +1 -1
- package/dist/ui/assets/{index-DEHXf4PP.js → index-D5VARefi.js} +3 -3
- package/dist/ui/assets/{inline-ask-BADMnkfU.js → inline-ask-C6EV_383.js} +1 -1
- package/dist/ui/assets/{local-side-panel-YozB4kaM.js → local-side-panel-DV7OZQax.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-CKia_GZs.js","assets/rolldown-runtime-XKyaHtl9.js","assets/preload-helper-B0Qg_vqV.js","assets/engine-compile-oEKYtfC2.js","assets/engine-javascript-PyIzzclY.js","assets/diff-viewer-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-CKia_GZs.js","assets/rolldown-runtime-XKyaHtl9.js","assets/preload-helper-B0Qg_vqV.js","assets/engine-compile-oEKYtfC2.js","assets/engine-javascript-PyIzzclY.js","assets/diff-viewer-CdSOTCI1.js","assets/button-DizkG3Et.js","assets/bundle-mjs-IMkwHZOK.js","assets/query-error-DSrxRVZP.js","assets/schemas-D5jfrTNW.js","assets/card-BPb3NZYg.js","assets/reviewer-connection-B1irBiYS.js","assets/chunk-BO2N2NFS-CNHkQg2l.js","assets/command-DCMG8Nuf.js","assets/input-group-apzvTSGh.js","assets/history-nav-buttons-CcP8rzqZ.js","assets/shortcut-label-Do9KpCPN.js","assets/CaretUp.es-C6IDKCMg.js","assets/explored-file-view-DLx8rzcm.js","assets/local-side-panel-DV7OZQax.js","assets/agent-list-query-DqVLNOuo.js","assets/inline-ask-C6EV_383.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{a as n,c as r,d as i,i as a,l as o,o as s,s as c,t as l,u}from"./button-DizkG3Et.js";import{$ as d,A as f,B as p,C as m,E as h,G as g,H as _,J as v,K as y,O as b,Q as x,S,U as C,V as w,W as T,X as ee,Y as te,Z as ne,_ as re,a as ie,at as ae,b as oe,c as E,d as D,et as se,f as O,g as k,h as ce,i as le,it as A,l as ue,m as de,n as j,nt as fe,o as pe,p as me,q as he,r as ge,rt as _e,s as ve,t as ye,tt as be,u as xe,v as Se,w as Ce,x as we,y as M}from"./query-error-DSrxRVZP.js";import{a as Te,i as Ee,o as De}from"./bundle-mjs-IMkwHZOK.js";import{a as Oe,c as ke,d as N,i as Ae,l as je,n as Me,o as Ne,r as Pe,s as Fe,t as Ie,u as Le}from"./schemas-D5jfrTNW.js";import{E as Re,S as ze,T as Be,_ as Ve,a as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,l as Ye,m as Xe,n as Ze,o as Qe,p as $e,r as et,s as tt,t as nt,u as rt,v as it,w as at,y as ot}from"./card-BPb3NZYg.js";import{a as P,i as st,r as ct,t as F}from"./reviewer-connection-B1irBiYS.js";import{r as lt}from"./chunk-BO2N2NFS-CNHkQg2l.js";import{t as ut}from"./preload-helper-B0Qg_vqV.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function dt(e){return e.state.status===`success`}var ft=class extends T{#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||pt(),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=g({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),y.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function pt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var mt=class extends i{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 ft({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=ht(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=ht(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=ht(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ht(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){y.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=>ne(t,e))}findAll(e={}){return this.getAll().filter(t=>ne(e,t))}notify(e){y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return y.batch(()=>Promise.all(e.map(e=>e.continue().catch(d))))}};function ht(e){return e.options.scope?.id}var gt=class extends i{#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),fe(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&te(t.mutationKey)!==te(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??pt();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){y.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)})})}},_t=class extends i{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new C({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(){y.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=>x(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>x(e,t)):t}notify(e){y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){y.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){y.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new _t,this.#t=e.mutationCache||new mt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ae.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=u.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(be(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=v(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return y.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;y.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return y.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=y.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(d).catch(d)}invalidateQueries(e,t={}){return y.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=y.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(d)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(d)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(be(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(d).catch(d)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(d).catch(d)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return u.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(te(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{se(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(te(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{se(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||=ee(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===A&&(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()}},I=e(De(),1);function yt(e,t){let n=_(t),[r]=I.useState(()=>new gt(n,e));I.useEffect(()=>{r.setOptions(e)},[r,e]);let i=I.useSyncExternalStore(I.useCallback(e=>r.subscribe(y.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=I.useCallback((e,t)=>{r.mutate(e,t).catch(d)},[r]);if(i.error&&_e(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var bt=t((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,ne());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function te(){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&&ee());){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&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=te,ne=function(){ie.postMessage(null)}}else ne=function(){_(te,0)};function ae(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,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),xt=t(((e,t)=>{t.exports=bt()})),St=t((e=>{var t=xt(),n=De(),r=Ee();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`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var ie=Symbol.for(`react.client.reference`);function ae(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ie?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 ee: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?ae(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}var oe=Array.isArray,E=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},O=[],k=-1;function ce(e){return{current:e}}function le(e){0>k||(e.current=O[k],O[k]=null,k--)}function A(e,t){k++,O[k]=e.current,e.current=t}var ue=ce(null),de=ce(null),j=ce(null),fe=ce(null);function pe(e,t){switch(A(j,t),A(de,e),A(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}le(ue),A(ue,e)}function me(){le(ue),le(de),le(j)}function he(e){e.memoizedState!==null&&A(fe,e);var t=ue.current,n=Hd(t,e.type);t!==n&&(A(de,e),A(ue,n))}function ge(e){de.current===e&&(le(ue),le(de)),fe.current===e&&(le(fe),Qf._currentValue=se)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!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(`
|
|
@@ -59,7 +59,7 @@ Alternatively, you can use your own component as a description by assigning it a
|
|
|
59
59
|
|
|
60
60
|
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return I.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},nc=Fs,rc=zs,ic=Vs,ac=Ks,oc=Qs,sc=ec,cc=Js,lc=Xs,uc=t((e=>{var t=De();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),dc=t(((e,t)=>{t.exports=uc()}))();function fc(){return(0,dc.useSyncExternalStore)(pc,()=>!0,()=>!1)}function pc(){return()=>{}}var mc=`Avatar`,[hc,gc]=Se(mc),[_c,vc]=hc(mc),yc=I.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=I.useState(`idle`);return(0,L.jsx)(_c,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,L.jsx)(M.span,{...r,ref:t})})});yc.displayName=mc;var bc=`AvatarImage`,xc=I.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=vc(bc,n),s=Tc(r,a),c=D(e=>{i(e),o.onImageLoadingStatusChange(e)});return ce(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,L.jsx)(M.img,{...a,ref:t,src:r}):null});xc.displayName=bc;var Sc=`AvatarFallback`,Cc=I.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=vc(Sc,n),[o,s]=I.useState(r===void 0);return I.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,L.jsx)(M.span,{...i,ref:t}):null});Cc.displayName=Sc;function wc(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function Tc(e,{referrerPolicy:t,crossOrigin:n}){let r=fc(),i=I.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=I.useState(()=>wc(a,e));return ce(()=>{s(wc(a,e))},[a,e]),ce(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var Ec=yc,Dc=xc,Oc=Cc;function kc(e){let t=I.useRef({value:e,previous:e});return I.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ac=`Checkbox`,[jc,Mc]=Se(Ac),[Nc,Pc]=jc(Ac);function Fc(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=de({prop:n,defaultProp:i??!1,onChange:c,caller:Ac}),[m,h]=I.useState(null),[g,_]=I.useState(null),v=I.useRef(!1),y=!m||!!o||!!m.closest(`form`),b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:!Uc(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,L.jsx)(Nc,{scope:t,...b,children:Hc(d)?d(b):r})}var Ic=`CheckboxTrigger`,Lc=I.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:l,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:m,bubbleInput:h}=Pc(Ic,e),g=c(i,d),_=I.useRef(l);return I.useEffect(()=>{let e=a?.form;if(e){let t=()=>f(_.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,L.jsx)(M.button,{type:`button`,role:`checkbox`,"aria-checked":Uc(l)?`mixed`:l,"aria-required":u,"data-state":Wc(l),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:k(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:k(n,e=>{f(e=>Uc(e)?!0:!e),h&&m&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})})});Lc.displayName=Ic;var Rc=I.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,L.jsx)(Fc,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Lc,{...d,ref:t,__scopeCheckbox:n}),e&&(0,L.jsx)(Vc,{__scopeCheckbox:n})]})})});Rc.displayName=Ac;var U=`CheckboxIndicator`,zc=I.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Pc(U,n);return(0,L.jsx)(me,{present:r||Uc(a.checked)||a.checked===!0,children:(0,L.jsx)(M.span,{"data-state":Wc(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});zc.displayName=U;var Bc=`CheckboxBubbleInput`,Vc=I.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:m}=Pc(Bc,e),h=c(n,m),g=kc(a),_=E(r);I.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Uc(a),n.call(e,!Uc(a)&&a),e.dispatchEvent(t)}},[p,g,a,i]);let v=I.useRef(!Uc(a)&&a);return(0,L.jsx)(M.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:l,name:u,value:d,form:f,...t,tabIndex:-1,ref:h,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Vc.displayName=Bc;function Hc(e){return typeof e==`function`}function Uc(e){return e===`indeterminate`}function Wc(e){return Uc(e)?`indeterminate`:e?`checked`:`unchecked`}var Gc=[`Enter`,` `],Kc=[`ArrowDown`,`PageUp`,`Home`],qc=[`ArrowUp`,`PageDown`,`End`],Jc=[...Kc,...qc],Yc={ltr:[...Gc,`ArrowRight`],rtl:[...Gc,`ArrowLeft`]},Xc={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Zc=`Menu`,[Qc,$c,el]=qe(Zc),[tl,nl]=Se(Zc,[el,ve,$e]),rl=ve(),il=$e(),[al,ol]=tl(Zc),[sl,cl]=tl(Zc),W=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=rl(t),[c,l]=I.useState(null),u=I.useRef(!1),d=D(a),f=Xe(i);return I.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;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})}},[]),(0,L.jsx)(pe,{...s,children:(0,L.jsx)(al,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,L.jsx)(sl,{scope:t,onClose:I.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};W.displayName=Zc;var ll=`MenuAnchor`,ul=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=rl(n);return(0,L.jsx)(ge,{...i,...r,ref:t})});ul.displayName=ll;var dl=`MenuPortal`,[fl,pl]=tl(dl,{forceMount:void 0}),ml=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ol(dl,t);return(0,L.jsx)(fl,{scope:t,forceMount:n,children:(0,L.jsx)(me,{present:n||a.open,children:(0,L.jsx)(ue,{asChild:!0,container:i,children:r})})})};ml.displayName=dl;var hl=`MenuContent`,[gl,_l]=tl(hl),vl=I.forwardRef((e,t)=>{let n=pl(hl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ol(hl,e.__scopeMenu),o=cl(hl,e.__scopeMenu);return(0,L.jsx)(Qc.Provider,{scope:e.__scopeMenu,children:(0,L.jsx)(me,{present:r||a.open,children:(0,L.jsx)(Qc.Slot,{scope:e.__scopeMenu,children:o.modal?(0,L.jsx)(yl,{...i,ref:t}):(0,L.jsx)(bl,{...i,ref:t})})})})}),yl=I.forwardRef((e,t)=>{let n=ol(hl,e.__scopeMenu),r=I.useRef(null),i=c(t,r);return I.useEffect(()=>{let e=r.current;if(e)return Ho(e)},[]),(0,L.jsx)(Sl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:k(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bl=I.forwardRef((e,t)=>{let n=ol(hl,e.__scopeMenu);return(0,L.jsx)(Sl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xl=a(`MenuContent.ScrollLock`),Sl=I.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=ol(hl,n),v=cl(hl,n),y=rl(n),b=il(n),x=$c(n),[S,C]=I.useState(null),w=I.useRef(null),T=c(t,w,_.onContentChange),ee=I.useRef(0),te=I.useRef(``),ne=I.useRef(0),re=I.useRef(null),ae=I.useRef(`right`),oe=I.useRef(0),E=h?No:I.Fragment,D=h?{as:xl,allowPinchZoom:!0}:void 0,se=e=>{let t=te.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=eu(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){te.current=t,window.clearTimeout(ee.current),t!==``&&(ee.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};I.useEffect(()=>()=>window.clearTimeout(ee.current),[]),Ta();let O=I.useCallback(e=>ae.current===re.current?.side&&nu(e,re.current?.area),[]);return(0,L.jsx)(gl,{scope:n,searchRef:te,onItemEnter:I.useCallback(e=>{O(e)&&e.preventDefault()},[O]),onItemLeave:I.useCallback(e=>{O(e)||(w.current?.focus(),C(null))},[O]),onTriggerLeave:I.useCallback(e=>{O(e)&&e.preventDefault()},[O]),pointerGraceTimerRef:ne,onPointerGraceIntentChange:I.useCallback(e=>{re.current=e},[]),children:(0,L.jsx)(E,{...D,children:(0,L.jsx)(fa,{asChild:!0,trapped:i,onMountAutoFocus:k(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,L.jsx)(xe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,L.jsx)(Ge,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:k(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,L.jsx)(ie,{role:`menu`,"aria-orientation":`vertical`,"data-state":Yl(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:k(g.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&&se(e.key));let i=w.current;if(e.target!==i||!Jc.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);qc.includes(e.key)&&a.reverse(),Ql(a)}),onBlur:k(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(ee.current),te.current=``)}),onPointerMove:k(e.onPointerMove,ru(e=>{let t=e.target,n=oe.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>oe.current?`right`:`left`;ae.current=t,oe.current=e.clientX}}))})})})})})})});vl.displayName=hl;var Cl=`MenuGroup`,wl=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)(M.div,{role:`group`,...r,ref:t})});wl.displayName=Cl;var Tl=`MenuLabel`,El=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)(M.div,{...r,ref:t})});El.displayName=Tl;var Dl=`MenuItem`,Ol=`menu.itemSelect`,kl=I.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=I.useRef(null),o=cl(Dl,e.__scopeMenu),s=_l(Dl,e.__scopeMenu),l=c(t,a),u=I.useRef(!1),d=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ol,{bubbles:!0,cancelable:!0});e.addEventListener(Ol,e=>r?.(e),{once:!0}),oe(e,t),t.defaultPrevented?u.current=!1:o.onClose()}};return(0,L.jsx)(Al,{...i,ref:l,disabled:n,onClick:k(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:k(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:k(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Gc.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kl.displayName=Dl;var Al=I.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=_l(Dl,n),s=il(n),l=I.useRef(null),u=c(t,l),[d,f]=I.useState(!1),[p,m]=I.useState(``);return I.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[a.children]),(0,L.jsx)(Qc.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,L.jsx)(We,{asChild:!0,...s,focusable:!r,children:(0,L.jsx)(M.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:u,onPointerMove:k(e.onPointerMove,ru(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:k(e.onPointerLeave,ru(e=>o.onItemLeave(e))),onFocus:k(e.onFocus,()=>f(!0)),onBlur:k(e.onBlur,()=>f(!1))})})})}),jl=`MenuCheckboxItem`,Ml=I.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,L.jsx)(G,{scope:e.__scopeMenu,checked:n,children:(0,L.jsx)(kl,{role:`menuitemcheckbox`,"aria-checked":Xl(n)?`mixed`:n,...i,ref:t,"data-state":Zl(n),onSelect:k(i.onSelect,()=>r?.(Xl(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ml.displayName=jl;var Nl=`MenuRadioGroup`,[Pl,Fl]=tl(Nl,{value:void 0,onValueChange:()=>{}}),Il=I.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=D(r);return(0,L.jsx)(Pl,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,L.jsx)(wl,{...i,ref:t})})});Il.displayName=Nl;var Ll=`MenuRadioItem`,Rl=I.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fl(Ll,e.__scopeMenu),a=n===i.value;return(0,L.jsx)(G,{scope:e.__scopeMenu,checked:a,children:(0,L.jsx)(kl,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Zl(a),onSelect:k(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rl.displayName=Ll;var zl=`MenuItemIndicator`,[G,K]=tl(zl,{checked:!1}),q=I.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=K(zl,n);return(0,L.jsx)(me,{present:r||Xl(a.checked)||a.checked===!0,children:(0,L.jsx)(M.span,{...i,ref:t,"data-state":Zl(a.checked)})})});q.displayName=zl;var J=`MenuSeparator`,Y=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)(M.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Y.displayName=J;var Bl=`MenuArrow`,Vl=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=rl(n);return(0,L.jsx)(le,{...i,...r,ref:t})});Vl.displayName=Bl;var Hl=`MenuSub`,[Ul,Wl]=tl(Hl),X=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ol(Hl,t),o=rl(t),[s,c]=I.useState(null),[l,u]=I.useState(null),d=D(i);return I.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,L.jsx)(pe,{...o,children:(0,L.jsx)(al,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,L.jsx)(Ul,{scope:t,contentId:O(),triggerId:O(),trigger:s,onTriggerChange:c,children:n})})})};X.displayName=Hl;var Gl=`MenuSubTrigger`,Kl=I.forwardRef((e,t)=>{let n=ol(Gl,e.__scopeMenu),r=cl(Gl,e.__scopeMenu),i=Wl(Gl,e.__scopeMenu),a=_l(Gl,e.__scopeMenu),o=I.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=a,u={__scopeMenu:e.__scopeMenu},d=I.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return I.useEffect(()=>d,[d]),I.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]),(0,L.jsx)(ul,{asChild:!0,...u,children:(0,L.jsx)(Al,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Yl(n.open),...e,ref:s(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:k(e.onPointerMove,ru(t=>{a.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:k(e.onPointerLeave,ru(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:k(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Yc[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Kl.displayName=Gl;var ql=`MenuSubContent`,Jl=I.forwardRef((e,t)=>{let n=pl(hl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ol(hl,e.__scopeMenu),o=cl(hl,e.__scopeMenu),s=Wl(ql,e.__scopeMenu),l=I.useRef(null),u=c(t,l);return(0,L.jsx)(Qc.Provider,{scope:e.__scopeMenu,children:(0,L.jsx)(me,{present:r||a.open,children:(0,L.jsx)(Qc.Slot,{scope:e.__scopeMenu,children:(0,L.jsx)(Sl,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:u,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:k(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:k(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:k(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Xc[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Jl.displayName=ql;function Yl(e){return e?`open`:`closed`}function Xl(e){return e===`indeterminate`}function Zl(e){return Xl(e)?`indeterminate`:e?`checked`:`unchecked`}function Ql(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $l(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function eu(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=$l(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}function tu(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}function nu(e,t){return t?tu({x:e.clientX,y:e.clientY},t):!1}function ru(e){return t=>t.pointerType===`mouse`?e(t):void 0}var iu=W,au=ul,ou=ml,su=vl,cu=wl,lu=El,uu=kl,du=Ml,fu=Il,pu=Rl,mu=q,hu=Y,gu=Vl,_u=X,vu=Kl,yu=Jl,bu=`DropdownMenu`,[xu,Su]=Se(bu,[nl]),Cu=nl(),[wu,Tu]=xu(bu),Eu=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Cu(t),l=I.useRef(null),[u,d]=de({prop:i,defaultProp:a??!1,onChange:o,caller:bu});return(0,L.jsx)(wu,{scope:t,triggerId:O(),triggerRef:l,contentId:O(),open:u,onOpenChange:d,onOpenToggle:I.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,L.jsx)(iu,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Eu.displayName=bu;var Du=`DropdownMenuTrigger`,Ou=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Tu(Du,n),o=Cu(n);return(0,L.jsx)(au,{asChild:!0,...o,children:(0,L.jsx)(M.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(t,a.triggerRef),onPointerDown:k(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:k(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Ou.displayName=Du;var ku=`DropdownMenuPortal`,Au=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Cu(t);return(0,L.jsx)(ou,{...r,...n})};Au.displayName=ku;var ju=`DropdownMenuContent`,Mu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Tu(ju,n),a=Cu(n),o=I.useRef(!1);return(0,L.jsx)(su,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:k(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:k(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)`}})});Mu.displayName=ju;var Nu=`DropdownMenuGroup`,Pu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(cu,{...i,...r,ref:t})});Pu.displayName=Nu;var Fu=`DropdownMenuLabel`,Iu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(lu,{...i,...r,ref:t})});Iu.displayName=Fu;var Lu=`DropdownMenuItem`,Ru=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(uu,{...i,...r,ref:t})});Ru.displayName=Lu;var zu=`DropdownMenuCheckboxItem`,Bu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(du,{...i,...r,ref:t})});Bu.displayName=zu;var Vu=`DropdownMenuRadioGroup`,Hu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(fu,{...i,...r,ref:t})});Hu.displayName=Vu;var Uu=`DropdownMenuRadioItem`,Wu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(pu,{...i,...r,ref:t})});Wu.displayName=Uu;var Z=`DropdownMenuItemIndicator`,Gu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(mu,{...i,...r,ref:t})});Gu.displayName=Z;var Ku=`DropdownMenuSeparator`,qu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(hu,{...i,...r,ref:t})});qu.displayName=Ku;var Ju=`DropdownMenuArrow`,Yu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(gu,{...i,...r,ref:t})});Yu.displayName=Ju;var Xu=`DropdownMenuSubTrigger`,Zu=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(vu,{...i,...r,ref:t})});Zu.displayName=Xu;var Qu=`DropdownMenuSubContent`,$u=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cu(n);return(0,L.jsx)(yu,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});$u.displayName=Qu;var ed=Eu,td=Ou,nd=Au,rd=Mu,id=Iu,ad=Ru,od=Bu,sd=Hu,cd=Wu,ld=Gu,ud=qu;function dd(e,[t,n]){return Math.min(n,Math.max(t,e))}function fd(e,t){return I.useReducer((e,n)=>t[e][n]??e,e)}var pd=`ScrollArea`,[md,hd]=Se(pd),[gd,_d]=md(pd),vd=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,l]=I.useState(null),[u,d]=I.useState(null),[f,p]=I.useState(null),[m,h]=I.useState(null),[g,_]=I.useState(null),[v,y]=I.useState(0),[b,x]=I.useState(0),[S,C]=I.useState(!1),[w,T]=I.useState(!1),ee=c(t,e=>l(e)),te=Xe(i);return(0,L.jsx)(gd,{scope:n,type:r,dir:te,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:f,onContentChange:p,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,L.jsx)(M.div,{dir:te,...o,ref:ee,style:{position:`relative`,"--radix-scroll-area-corner-width":v+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})});vd.displayName=pd;var yd=`ScrollAreaViewport`,Q=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=_d(yd,n),s=I.useRef(null),l=c(t,s,o.onViewportChange);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,L.jsx)(M.div,{"data-radix-scroll-area-viewport":``,...a,ref:l,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,L.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Q.displayName=yd;var bd=`ScrollAreaScrollbar`,xd=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_d(bd,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return I.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,L.jsx)(Sd,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,L.jsx)(Cd,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,L.jsx)(wd,{...r,ref:t,forceMount:n}):i.type===`always`?(0,L.jsx)(Td,{...r,ref:t}):null});xd.displayName=bd;var Sd=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_d(bd,e.__scopeScrollArea),[a,o]=I.useState(!1);return I.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,L.jsx)(me,{present:n||a,children:(0,L.jsx)(wd,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Cd=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_d(bd,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Wd(()=>c(`SCROLL_END`),100),[s,c]=fd(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return I.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),I.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,L.jsx)(me,{present:n||s!==`hidden`,children:(0,L.jsx)(Td,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:k(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:k(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),wd=I.forwardRef((e,t)=>{let n=_d(bd,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=I.useState(!1),s=e.orientation===`horizontal`,c=Wd(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Gd(n.viewport,c),Gd(n.content,c),(0,L.jsx)(me,{present:r||a,children:(0,L.jsx)(Td,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Td=I.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=_d(bd,e.__scopeScrollArea),a=I.useRef(null),o=I.useRef(0),[s,c]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Ld(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return zd(e,o.current,s,t)}return n===`horizontal`?(0,L.jsx)(Ed,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Bd(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,L.jsx)(Dd,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Bd(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),Ed=I.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=_d(bd,e.__scopeScrollArea),[o,s]=I.useState(),l=I.useRef(null),u=c(t,l,a.onScrollbarXChange);return I.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,L.jsx)(Ad,{"data-orientation":`horizontal`,...i,ref:u,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Rd(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Hd(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Id(o.paddingLeft),paddingEnd:Id(o.paddingRight)}})}})}),Dd=I.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=_d(bd,e.__scopeScrollArea),[o,s]=I.useState(),l=I.useRef(null),u=c(t,l,a.onScrollbarYChange);return I.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,L.jsx)(Ad,{"data-orientation":`vertical`,...i,ref:u,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Rd(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Hd(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Id(o.paddingTop),paddingEnd:Id(o.paddingBottom)}})}})}),[Od,kd]=md(bd),Ad=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...p}=e,m=_d(bd,n),[h,g]=I.useState(null),_=c(t,e=>g(e)),v=I.useRef(null),y=I.useRef(``),b=m.viewport,x=r.content-r.viewport,S=D(d),C=D(l),w=Wd(f,10);function T(e){if(v.current){let t=e.clientX-v.current.left,n=e.clientY-v.current.top;u({x:t,y:n})}}return I.useEffect(()=>{let e=e=>{let t=e.target;h?.contains(t)&&S(e,x)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,h,x,S]),I.useEffect(C,[r,C]),Gd(h,w),Gd(m.content,w),(0,L.jsx)(Od,{scope:n,scrollbar:h,hasThumb:i,onThumbChange:D(a),onThumbPointerUp:D(o),onThumbPositionChange:C,onThumbPointerDown:D(s),children:(0,L.jsx)(M.div,{...p,ref:_,style:{position:`absolute`,...p.style},onPointerDown:k(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),v.current=h.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,m.viewport&&(m.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:k(e.onPointerMove,T),onPointerUp:k(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=``),v.current=null})})})}),jd=`ScrollAreaThumb`,Md=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=kd(jd,e.__scopeScrollArea);return(0,L.jsx)(me,{present:n||i.hasThumb,children:(0,L.jsx)($,{ref:t,...r})})}),$=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=_d(jd,n),o=kd(jd,n),{onThumbPositionChange:s}=o,l=c(t,e=>o.onThumbChange(e)),u=I.useRef(void 0),d=Wd(()=>{u.current&&=(u.current(),void 0)},100);return I.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{if(d(),!u.current){let t=Ud(e,s);u.current=t,s()}};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,d,s]),(0,L.jsx)(M.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:l,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:k(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:k(e.onPointerUp,o.onThumbPointerUp)})});Md.displayName=jd;var Nd=`ScrollAreaCorner`,Pd=I.forwardRef((e,t)=>{let n=_d(Nd,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,L.jsx)(Fd,{...e,ref:t}):null});Pd.displayName=Nd;var Fd=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=_d(Nd,n),[a,o]=I.useState(0),[s,c]=I.useState(0),l=!!(a&&s);return Gd(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Gd(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,L.jsx)(M.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function Id(e){return e?parseInt(e,10):0}function Ld(e,t){let n=e/t;return isNaN(n)?0:n}function Rd(e){let t=Ld(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function zd(e,t,n,r=`ltr`){let i=Rd(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Vd([c,l],d)(e)}function Bd(e,t,n=`ltr`){let r=Rd(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=dd(e,n===`ltr`?[0,o]:[o*-1,0]);return Vd([0,o],[0,s])(c)}function Vd(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Hd(e,t){return e>0&&e<t}var Ud=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Wd(e,t){let n=D(e),r=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(r.current),[]),I.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Gd(e,t){let n=D(t);ce(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var Kd=vd,qd=Q,Jd=Pd,Yd=`Separator`,Xd=`horizontal`,Zd=[`horizontal`,`vertical`],Qd=I.forwardRef((e,t)=>{let{decorative:n,orientation:r=Xd,...i}=e,a=$d(r)?r:Xd,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,L.jsx)(M.div,{"data-orientation":a,...o,...i,ref:t})});Qd.displayName=Yd;function $d(e){return Zd.includes(e)}var ef=Qd;function tf({className:e,size:t=`default`,...n}){return(0,L.jsx)(Ec,{"data-slot":`avatar`,"data-size":t,className:o(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-edge after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function nf({className:e,...t}){return(0,L.jsx)(Dc,{"data-slot":`avatar-image`,className:o(`aspect-square size-full rounded-full object-cover`,e),...t})}function rf({className:e,...t}){return(0,L.jsx)(Oc,{"data-slot":`avatar-fallback`,className:o(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function af({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`avatar-group`,className:o(`group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background`,e),...t})}function of({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`avatar-group-count`,className:o(`relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3`,e),...t})}var sf=t(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(n,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof ee||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new ee(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var ee=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),te=ee.prototype;return w.prototype=te,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){te[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,ee,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),cf=t(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(n,(function(){return function(e,t,n){e||={};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],p=f.length,m=0;m<p;m+=1){var h=f[m];h.d&&(c=o?n(t).diff(a,h.d,!0):a.diff(t,h.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=h.r||!h.r){g<=1&&m>0&&(h=f[m-1]);var _=d[h.l];s&&(g=s(``+g)),l=typeof _==`string`?_.replace(`%d`,g):_(g,r,h.l,u);break}}if(r)return l;var v=u?d.future:d.past;return typeof v==`function`?v(l):v.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))})),lf=t(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_updateLocale=r()})(n,(function(){function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.apply(this,arguments)}return function(t,n,r){r.updateLocale=function(t,n){var i=r.Ls[t];if(i)return(n?Object.keys(n):[]).forEach((function(t){i[t]=i[t]&&n[t]&&typeof i[t]==`object`&&typeof n[t]==`object`&&!Array.isArray(i[t])?e({},i[t],n[t]):n[t]})),i}}}))})),uf=e(sf(),1),df=e(cf(),1),ff=e(lf(),1);uf.default.extend(df.default),uf.default.extend(ff.default),uf.default.updateLocale(`en`,{relativeTime:{future:`in %s`,past:`%s`,s:`now`,m:`1m`,mm:`%dm`,h:`1h`,hh:`%dh`,d:`1d`,dd:`%dd`,M:`1mo`,MM:`%dmo`,y:`1y`,yy:`%dy`}});var pf=e=>(0,uf.default)(e).fromNow(!0),mf=e=>{let t=pf(e);return t===`now`?t:`${t} ago`},hf=(e,t)=>`https://github.com/${e}/tree/${encodeURIComponent(t)}`,gf=(e,t,n)=>`https://github.com/${e}/${t}/pull/${n}`;function _f({className:e,viewportClassName:t,children:n,...r}){return(0,L.jsxs)(Kd,{"data-slot":`scroll-area`,className:o(`relative`,e),...r,children:[(0,L.jsx)(qd,{"data-slot":`scroll-area-viewport`,className:o(`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,t),children:n}),(0,L.jsx)(vf,{}),(0,L.jsx)(Jd,{})]})}function vf({className:e,orientation:t=`vertical`,...n}){return(0,L.jsx)(xd,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:o(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,L.jsx)(Md,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function yf({...e}){return(0,L.jsx)(ed,{"data-slot":`dropdown-menu`,...e})}function bf({...e}){return(0,L.jsx)(td,{"data-slot":`dropdown-menu-trigger`,...e})}function xf({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,L.jsx)(nd,{children:(0,L.jsx)(rd,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:o(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-surface glass-overlay p-1 text-popover-foreground shadow-2xl duration-(--duration-fast) data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:ease-(--ease-enter) data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:ease-(--ease-exit) data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:duration-0 low-power:duration-0`,e),...r})})}function Sf({className:e,inset:t,variant:n=`default`,...r}){return(0,L.jsx)(ad,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:o(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-chip px-1.5 py-1 text-sm outline-hidden select-none focus:bg-muted focus:text-foreground not-data-[variant=destructive]:focus:**:text-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Cf({className:e,children:t,checked:n,inset:r,...i}){return(0,L.jsxs)(od,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:o(`relative flex cursor-default items-center gap-1.5 rounded-chip py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-muted focus:text-foreground focus:**:text-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...i,children:[(0,L.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,L.jsx)(ld,{children:(0,L.jsx)(fn,{})})}),t]})}function wf({...e}){return(0,L.jsx)(sd,{"data-slot":`dropdown-menu-radio-group`,...e})}function Tf({className:e,children:t,inset:n,...r}){return(0,L.jsxs)(cd,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:o(`relative flex cursor-default items-center gap-1.5 rounded-chip py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-muted focus:text-foreground focus:**:text-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,L.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,L.jsx)(ld,{children:(0,L.jsx)(fn,{})})}),t]})}function Ef({className:e,inset:t,...n}){return(0,L.jsx)(id,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:o(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function Df({className:e,...t}){return(0,L.jsx)(ud,{"data-slot":`dropdown-menu-separator`,className:o(`-mx-1 my-1 h-px bg-edge`,e),...t})}function Of({className:e,...t}){return(0,L.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:o(`ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-foreground`,e),...t})}var kf=[{method:`merge`,label:`Create a merge commit`},{method:`squash`,label:`Squash and merge`},{method:`rebase`,label:`Rebase and merge`}],Af=({status:e})=>{let t=e.merged?{icon:(0,L.jsx)(jn,{weight:`fill`,className:`text-merged size-4`}),text:`Merged`}:e.mergeable===!1?{icon:(0,L.jsx)(m,{weight:`fill`,className:`text-destructive size-4`}),text:`Merge conflict`}:e.mergeable===!0?{icon:(0,L.jsx)(jn,{className:`text-primary size-4`}),text:`No conflicts, mergeable`}:{icon:(0,L.jsx)(jn,{className:`text-muted-foreground size-4`}),text:`Checking mergeability…`};return(0,L.jsxs)(Ue,{openDelay:80,closeDelay:60,children:[(0,L.jsx)(rt,{asChild:!0,children:(0,L.jsx)(`span`,{className:`hover:bg-muted flex h-7 shrink-0 cursor-default items-center gap-1 rounded-md px-1.5 text-xs transition-colors`,children:t.icon})}),(0,L.jsx)(Ye,{align:`end`,children:(0,L.jsx)(`p`,{className:`text-xs font-medium`,children:t.text})})]})},jf=({status:e,merge:t})=>{let n=yt(N().github.prMerge.mutationOptions({onSuccess:()=>{P.success(`Pull request merged.`),t.onMerged()},onError:e=>{P.error(e.message??`Failed to merge pull request.`)}})),r=kf.filter(({method:e})=>t.allowedMethods?.[e]);return!t.canMerge||!t.methodsLoading&&r.length===0?(0,L.jsx)(Af,{status:e}):(0,L.jsxs)(yf,{children:[(0,L.jsx)(bf,{asChild:!0,children:(0,L.jsxs)(l,{size:`sm`,className:`h-7 shrink-0 gap-1.5`,disabled:n.isPending||t.methodsLoading,children:[n.isPending?(0,L.jsx)(Ke,{className:`size-4`}):(0,L.jsx)(jn,{weight:`fill`,className:`size-4`}),`Merge`,(0,L.jsx)(at,{className:`size-3.5`})]})}),(0,L.jsx)(xf,{align:`end`,children:r.map(({method:e,label:r})=>(0,L.jsx)(Sf,{disabled:n.isPending,onSelect:()=>n.mutate({owner:t.owner,repo:t.repo,pr:t.pr,method:e}),children:r},e))})]})},Mf=e=>e.reduce((e,t)=>t.bucket===`pass`?{...e,passed:e.passed+1}:t.bucket===`pending`?{...e,pending:e.pending+1}:t.bucket===`skipping`?{...e,skipped:e.skipped+1}:t.required?{...e,requiredFailed:e.requiredFailed+1}:{...e,optionalFailed:e.optionalFailed+1},{passed:0,requiredFailed:0,optionalFailed:0,pending:0,skipped:0,total:e.length}),Nf=e=>e.split(/[\s@.]+/).flatMap(e=>{let t=e[0];return t?[t]:[]}).slice(0,2).join(``).toUpperCase()||`?`,Pf={APPROVED:{text:`approved`,icon:(0,L.jsx)(it,{weight:`fill`,className:`text-brand size-4`})},CHANGES_REQUESTED:{text:`requested changes`,icon:(0,L.jsx)(Hn,{weight:`fill`,className:`text-destructive size-4`})},COMMENTED:{text:`commented`,icon:(0,L.jsx)(dn,{className:`text-muted-foreground size-4`})},awaiting:{text:`awaiting review`,icon:(0,L.jsx)(gn,{className:`text-warning size-4`})}},Ff=e=>e.reviewed?e.state===`APPROVED`||e.state===`CHANGES_REQUESTED`||e.state===`COMMENTED`?Pf[e.state]:{...Pf.COMMENTED,text:`reviewed`}:Pf.awaiting,If=({trigger:e,children:t})=>(0,L.jsxs)(Ue,{openDelay:80,closeDelay:60,children:[(0,L.jsx)(rt,{asChild:!0,children:(0,L.jsx)(`span`,{className:`hover:bg-muted flex h-7 shrink-0 cursor-default items-center gap-1 rounded-md px-1.5 text-xs transition-colors`,children:e})}),(0,L.jsx)(Ye,{align:`end`,children:t})]}),Lf=({reviewers:e})=>{if(e.length===0)return(0,L.jsx)(If,{trigger:(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:`No reviewers`}),children:(0,L.jsx)(`p`,{className:`text-xs`,children:`No reviewers requested or active yet.`})});let t=e.slice(0,4),n=Math.max(e.length-t.length,0);return(0,L.jsx)(If,{trigger:(0,L.jsxs)(af,{children:[t.map(e=>(0,L.jsxs)(tf,{size:`sm`,className:o(!e.reviewed&&`opacity-40 grayscale`),children:[e.avatarUrl?(0,L.jsx)(nf,{src:e.avatarUrl,alt:`${e.name} avatar`}):null,(0,L.jsx)(rf,{children:Nf(e.name)})]},e.login)),n>0?(0,L.jsxs)(of,{children:[`+`,n]}):null]}),children:(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsx)(`p`,{className:`text-xs font-medium`,children:`Reviewers`}),e.map(e=>{let t=Ff(e);return(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,L.jsxs)(tf,{size:`sm`,children:[e.avatarUrl?(0,L.jsx)(nf,{src:e.avatarUrl,alt:``}):null,(0,L.jsx)(rf,{children:Nf(e.name)})]}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e.isBot?e.name.replace(/\[bot\]$/,``):e.name}),e.isBot?(0,L.jsx)(je,{variant:`secondary`,children:`bot`}):null,(0,L.jsxs)(`span`,{className:`text-muted-foreground ml-auto flex shrink-0 items-center gap-1`,children:[t.icon,t.text]})]},e.login)})]})})},Rf=({decision:e})=>{let t=e===`approved`?{icon:(0,L.jsx)(it,{weight:`fill`,className:`text-primary size-4`}),text:`Approved`}:e===`changes_requested`?{icon:(0,L.jsx)(Hn,{weight:`fill`,className:`text-destructive size-4`}),text:`Changes requested`}:{icon:(0,L.jsx)(gn,{className:`text-muted-foreground size-4`}),text:`Review required`};return(0,L.jsx)(If,{trigger:t.icon,children:(0,L.jsx)(`p`,{className:`text-xs font-medium`,children:t.text})})},zf=({conversation:e})=>{let t=e.items.filter(e=>e.kind===`thread`).length,n=t-e.unresolvedCount;return(0,L.jsx)(If,{trigger:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(dn,{className:o(`size-4`,t>0&&n===t?`text-primary`:`text-muted-foreground`)}),(0,L.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[n,`/`,t]})]}),children:(0,L.jsx)(`p`,{className:`text-xs`,children:t===0?`No review comment threads.`:`${n} of ${t} comment thread${t===1?``:`s`} resolved`})})},Bf={fail:{rank:0,icon:(0,L.jsx)(Hn,{weight:`fill`,className:`text-destructive size-4`})},cancel:{rank:0,icon:(0,L.jsx)(Hn,{weight:`fill`,className:`text-destructive size-4`})},pending:{rank:1,icon:(0,L.jsx)(gn,{weight:`bold`,className:`text-warning size-4`})},pass:{rank:2,icon:(0,L.jsx)(it,{weight:`fill`,className:`text-brand size-4`})},skipping:{rank:3,icon:(0,L.jsx)(Ln,{className:`text-muted-foreground size-4`})}},Vf=({checks:e})=>{let t=Mf(e.items),n=t.requiredFailed+t.optionalFailed,r=e.unavailable?{icon:(0,L.jsx)(Ln,{className:`text-muted-foreground size-4`})}:t.pending>0&&n===0?{icon:(0,L.jsx)(mn,{className:`text-muted-foreground size-4`})}:t.requiredFailed>0?{icon:(0,L.jsx)(Hn,{weight:`fill`,className:`text-destructive size-4`})}:t.optionalFailed>0?{icon:(0,L.jsx)(Bn,{weight:`fill`,className:`text-warning size-4`})}:{icon:(0,L.jsx)(it,{weight:`fill`,className:`text-primary size-4`})},i=e.items.toSorted((e,t)=>Bf[e.bucket].rank-Bf[t.bucket].rank),a=[{count:n,text:`failing`},{count:t.pending,text:`pending`},{count:t.passed,text:`passed`},{count:t.skipped,text:`skipped`}].flatMap(({count:e,text:t})=>e>0?[`${e} ${t}`]:[]);return(0,L.jsx)(If,{trigger:r.icon,children:e.unavailable||e.items.length===0?(0,L.jsx)(`p`,{className:`text-xs`,children:`No checks found for this commit.`}):(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-xs font-medium`,children:`Checks`}),(0,L.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a.join(` · `)})]}),(0,L.jsx)(_f,{viewportClassName:`max-h-80`,children:(0,L.jsx)(`div`,{className:`space-y-0.5 pr-2`,children:i.map(e=>{let t=(0,L.jsxs)(L.Fragment,{children:[Bf[e.bucket].icon,(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.required?(0,L.jsx)(je,{variant:`outline`,children:`Required`}):null]}),n=`${e.name}-${e.bucket}-${e.url??``}`;return e.url?(0,L.jsx)(Ki,{href:e.url,className:`hover:bg-muted flex h-6 items-center gap-2 rounded-sm px-1 text-xs transition-colors`,children:t},n):(0,L.jsx)(`div`,{className:`flex h-6 items-center gap-2 px-1 text-xs`,children:t},n)})})})]})})},Hf=({labels:e})=>{if(e.length===0)return null;let t=e.slice(0,3),n=Math.max(e.length-t.length,0);return(0,L.jsx)(If,{trigger:(0,L.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t.map(e=>(0,L.jsx)(je,{variant:`secondary`,children:e.name},e.name)),n>0?(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`+`,n]}):null]}),children:(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsx)(`p`,{className:`text-xs font-medium`,children:`Labels`}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.map(e=>(0,L.jsx)(je,{variant:`secondary`,children:e.name},e.name))})]})})},Uf=({metadata:e,conversation:t,isLoading:n,merge:r})=>!n&&!e?null:n||!e?(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(j,{className:`h-7 w-20`}),(0,L.jsx)(j,{className:`h-7 w-12`})]}):(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,L.jsx)(Lf,{reviewers:e.reviewers}),(0,L.jsx)(Rf,{decision:e.reviewDecision}),t?(0,L.jsx)(zf,{conversation:t}):null,(0,L.jsx)(Vf,{checks:e.checks}),(0,L.jsx)(jf,{status:e.merge,merge:r}),(0,L.jsx)(Hf,{labels:e.labels})]}),Wf=()=>null,Gf=e=>e.split(/[\s@.]+/).flatMap(e=>{let t=e[0];return t?[t]:[]}).slice(0,2).join(``).toUpperCase()||`?`,Kf=({owner:e,repo:t,pr:n,title:r,state:i,author:a,headRef:o,baseRef:s,changedFiles:c,additions:u,deletions:d,updatedAt:f,previewUrl:p,baseRepoFullName:m,headRepoFullName:h,metadata:g,conversation:_,metadataLoading:v,storyAvailable:y,viewMode:b,merge:x,onViewModeChange:S,onReviewChanges:C})=>{let w=gf(e,t,n),T=hf(h??m,o),ee=hf(m,s);return(0,L.jsxs)(`div`,{className:`border-edge bg-background flex shrink-0 items-center gap-3 border-b px-4 py-2`,children:[(0,L.jsxs)(tf,{size:`sm`,children:[a.avatarUrl?(0,L.jsx)(nf,{src:a.avatarUrl,alt:`${a.login} avatar`}):null,(0,L.jsx)(rf,{children:Gf(a.login)})]}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(Ki,{href:w,className:`truncate text-sm font-semibold hover:underline`,children:r}),(0,L.jsxs)(Ki,{href:w,className:`text-muted-foreground hidden shrink-0 items-center gap-1 text-xs hover:underline sm:flex`,children:[(0,L.jsx)(Nn,{className:`size-3.5`}),e,`/`,t,`#`,n]}),i===`open`?null:(0,L.jsx)(je,{variant:i===`closed`?`destructive`:`secondary`,className:`shrink-0`,children:i===`merged`?`Merged`:i===`closed`?`Closed`:`Draft`})]}),(0,L.jsxs)(`div`,{className:`text-muted-foreground flex min-w-0 items-center gap-2 text-xs`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,L.jsx)(kn,{className:`size-3.5 shrink-0`}),(0,L.jsx)(Ki,{href:T,className:`truncate font-mono hover:underline`,children:o}),(0,L.jsx)(`span`,{children:`->`}),(0,L.jsx)(Ki,{href:ee,className:`truncate font-mono hover:underline`,children:s})]}),(0,L.jsxs)(`span`,{className:`hidden shrink-0 lg:inline`,children:[c,` files ·`,` `,(0,L.jsxs)(`span`,{className:`text-brand`,children:[`+`,u]}),` `,(0,L.jsxs)(`span`,{className:`text-destructive`,children:[`-`,d]})]}),(0,L.jsxs)(`span`,{className:`hidden shrink-0 md:inline`,children:[`updated `,mf(f)]})]})]}),(0,L.jsx)(Uf,{metadata:g,conversation:_,isLoading:v,merge:x}),y?(0,L.jsx)(Wf,{mode:b,onChange:S}):null,p?(0,L.jsx)(l,{asChild:!0,variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,children:(0,L.jsxs)(Ki,{href:p,children:[(0,L.jsx)(ln,{className:`size-4`}),`Preview`]})}):null,(0,L.jsx)(l,{size:`sm`,className:`shrink-0`,onClick:C,children:`Review changes`})]})},qf=({process:e,schedule:t})=>{let n=[],r=new Set,i=new Set,a=()=>{n.splice(0,1).forEach(t=>{r.delete(t),e(t)}),n.length>0?t(a):i.clear()};return{enqueue:e=>{r.has(e)||(r.add(e),n.push(e),!(i.size>0)&&(i.add(!0),t(a)))}}},Jf=`bash.c.cpp.csharp.css.dockerfile.go.html.java.js.jsx.json.kotlin.md.mdx.php.prisma.python.ruby.rust.scss.sql.ts.tsx.vue.xml.yaml`.split(`.`),Yf=1e3,Xf=e=>e.length<=Yf,Zf=[],Qf=[],$f=({text:e,language:t,theme:n})=>JSON.stringify([t,n,e]),ep=e=>{let t=new Map,n=new Map,r=new Map,i=new Map,a=e=>Jf.includes(e)?e:null,o=({language:t,theme:n})=>{let i=a(t);if(!i)return null;let o=[e.getLoadedLanguages().includes(i)?null:{key:`lang:${i}`,load:()=>e.loadLanguage(i)},e.getLoadedThemes().includes(n)?null:{key:`theme:${n}`,load:()=>e.loadTheme(n)}].filter(e=>e!==null);return o.length===0?null:Promise.all(o.map(({key:e,load:t})=>{let n=r.get(e);if(n)return n;let i=t();return r.set(e,i),i}))},s=n=>{let r=$f(n),i=t.get(r);if(i!==void 0)return i;let o=a(n.language);if(!o||n.text.split(`
|
|
61
61
|
`).some(e=>!Xf(e)))return t.set(r,Zf),Zf;let s=e.codeToTokens(n.text||` `,{lang:o,theme:n.theme}).tokens.map(e=>e.map(e=>e.color?{content:e.content,color:e.color}:{content:e.content}));return t.set(r,s),s},c=e=>{let n=t.get($f(e));if(n!==void 0)return n[e.offset]??Qf},l=e=>s(e)[e.offset]??Qf,u=(e,t)=>{n.delete(e),t.listeners.forEach(e=>e())},d=qf({process:e=>{let r=n.get(e);if(!r)return;let i=o(r.input);i?i.then(()=>d.enqueue(e),()=>{t.set(e,Zf),u(e,r)}):(s(r.input),u(e,r))},schedule:e=>{setTimeout(e,0)}}),f=e=>{if(c(e)!==void 0)return;let t=$f(e);n.has(t)||n.set(t,{input:e,listeners:new Set}),d.enqueue(t)},p=(e,t)=>{if(c(e)!==void 0)return()=>void 0;let r=$f(e),i=n.get(r);return i?i.listeners.add(t):n.set(r,{input:e,listeners:new Set([t])}),f(e),()=>{n.get(r)?.listeners.delete(t)}};return{get:c,getStore:e=>{let t=JSON.stringify([e.language,e.theme,e.offset,e.text]),n=i.get(t);if(n)return n;let r={getSnapshot:()=>c(e),subscribe:t=>p(e,t)};return i.set(t,r),r},highlight:l,request:f}},tp=e=>ep(e),np=({filename:e,keys:t,lines:n,context:r})=>({kind:`selection`,id:`selection:diff:${e}:${t.join(`,`)}`,source:`diff`,label:`${e} (${t.length} line${t.length===1?``:`s`})`,text:r,path:e,startLine:n.length?Math.min(...n):void 0,endLine:n.length?Math.max(...n):void 0}),rp=Ie([`automatic`,`github`,`vscode`]),ip=Ie([`small`,`medium`,`large`]),ap=Fe({theme:rp,size:ip,wrap:Pe(),blame:Pe().default(!0)}),op=(e,t)=>{let n=t===`light`;return e===`github`?n?`github-light`:`github-dark`:e===`vscode`?n?`light-plus`:`dark-plus`:n?`github-light`:`dark-plus`},sp=(e,t)=>`https://github.com/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,cp=()=>(0,L.jsx)(`div`,{className:`flex flex-col gap-1 p-4`,children:Array.from({length:20}).map((e,t)=>(0,L.jsx)(j,{className:`h-5 w-full`},t))}),lp=()=>(0,L.jsx)(cp,{}),up=()=>(0,L.jsx)(`div`,{className:`flex flex-col gap-1 px-3 py-2`,children:Array.from({length:24},(e,t)=>(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(j,{className:`h-3 w-6 shrink-0`}),(0,L.jsx)(j,{className:`h-3`,style:{width:`${30+t*17%55}%`}})]},t))});function dp({...e}){return(0,L.jsx)(Cs,{"data-slot":`dialog`,...e})}function fp({...e}){return(0,L.jsx)(Ts,{"data-slot":`dialog-portal`,...e})}function pp({className:e,...t}){return(0,L.jsx)(Es,{"data-slot":`dialog-overlay`,className:o(`fixed inset-0 isolate z-50 bg-scrim duration-(--duration-fast) supports-backdrop-filter:backdrop-blur-xs low-power:backdrop-filter-none data-open:animate-in data-open:ease-(--ease-enter) data-open:fade-in-0 data-closed:animate-out data-closed:ease-(--ease-exit) data-closed:fade-out-0 motion-reduce:duration-0 low-power:duration-0`,e),...t})}function mp({className:e,children:t,showCloseButton:n=!0,...r}){return(0,L.jsxs)(fp,{children:[(0,L.jsx)(pp,{}),(0,L.jsxs)(Ds,{"data-slot":`dialog-content`,className:o(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-surface border border-edge-overlay bg-card p-4 text-sm text-card-foreground shadow-2xl duration-(--duration-fast) outline-none sm:max-w-sm data-open:animate-in data-open:ease-(--ease-enter) data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:ease-(--ease-exit) data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:duration-0 low-power:duration-0`,e),...r,children:[t,n&&(0,L.jsx)(As,{"data-slot":`dialog-close`,asChild:!0,children:(0,L.jsxs)(l,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,L.jsx)(we,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function hp({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`dialog-header`,className:o(`flex flex-col gap-2`,e),...t})}function gp({className:e,showCloseButton:t=!1,children:n,...r}){return(0,L.jsxs)(`div`,{"data-slot":`dialog-footer`,className:o(`flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,L.jsx)(As,{asChild:!0,children:(0,L.jsx)(l,{variant:`outline`,children:`Close`})})]})}function _p({className:e,...t}){return(0,L.jsx)(Os,{"data-slot":`dialog-title`,className:o(`font-heading text-base leading-none font-medium`,e),...t})}function vp({className:e,...t}){return(0,L.jsx)(ks,{"data-slot":`dialog-description`,className:o(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var yp=65536,bp=({owner:e,repo:t,pr:n,headSha:r,filename:i,open:a,onOpenChange:o,onCommented:s})=>{let c=N(),[u,d]=(0,I.useState)(``),f=u.trim().length-yp,p=yt(c.github.reviewPostComment.mutationOptions({onSuccess:()=>{P.success(`File comment posted.`),d(``),o(!1),s()},onError:e=>{P.error(e.message??`Failed to post file comment.`)}}));return(0,L.jsx)(dp,{open:a,onOpenChange:o,children:(0,L.jsxs)(mp,{className:`sm:max-w-lg`,children:[(0,L.jsxs)(hp,{children:[(0,L.jsx)(_p,{children:`Comment on file`}),(0,L.jsx)(vp,{children:i?`Leave a review comment on ${i}.`:`Leave a review comment on this file.`})]}),(0,L.jsx)(tt,{value:u,onChange:e=>d(e.target.value),placeholder:`Leave a file comment...`,className:`min-h-32`}),f>0?(0,L.jsxs)(`p`,{className:`text-destructive text-xs`,children:[f.toLocaleString(),` characters over GitHub's`,` `,yp.toLocaleString(),` limit.`]}):null,(0,L.jsx)(gp,{children:(0,L.jsxs)(l,{disabled:p.isPending||!i||f>0,onClick:()=>{let a=u.trim();i&&(a?a.length>65536?P.error(`Comment is too long (GitHub allows at most ${yp.toLocaleString()} characters).`):p.mutate({owner:e,repo:t,pr:n,body:a,path:i,commitId:r}):P.error(`Add a comment before posting.`))},children:[p.isPending?(0,L.jsx)(Ke,{}):null,`Post comment`]})})]})})};function xp({children:e}){return(0,L.jsx)(lt,{className:`text-foreground text-sm`,children:e})}var Sp=aa,Cp=oa,wp=sa,Tp=e=>e.split(/[\s@.]+/).flatMap(e=>{let t=e[0];return t?[t]:[]}).slice(0,2).join(``).toUpperCase()||`?`,Ep=e=>{let t=e.startLine&&e.line&&e.startLine!==e.line?`:${e.startLine}-${e.line}`:e.line?`:${e.line}`:``;return`${e.path}${t}`},Dp=({author:e})=>(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsxs)(tf,{size:`sm`,children:[e.avatarUrl?(0,L.jsx)(nf,{src:e.avatarUrl,alt:`${e.login} avatar`}):null,(0,L.jsx)(rf,{children:Tp(e.login)})]}),(0,L.jsx)(`span`,{className:`truncate text-xs font-medium`,children:e.login})]}),Op=({body:e,url:t})=>(0,L.jsxs)(`div`,{className:`space-y-2 px-3 pb-3`,children:[(0,L.jsx)(`div`,{className:`max-w-none`,children:(0,L.jsx)(xp,{children:e||`_No description provided._`})}),(0,L.jsx)(l,{asChild:!0,variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2`,children:(0,L.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,L.jsx)(ln,{className:`size-3.5`}),`Open on GitHub`]})})]}),kp=()=>(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(j,{className:`h-20 w-full`}),(0,L.jsx)(j,{className:`h-12 w-full`}),(0,L.jsx)(j,{className:`h-12 w-full`})]}),Ap=({item:e,resolvingThreadId:t,onResolveThread:n,onSelectFile:r})=>{let i=e.kind===`comment`?e.author:e.comments[0]?.author;return(0,L.jsx)(Sp,{defaultOpen:e.defaultOpen,children:(0,L.jsxs)(`div`,{className:o(`border-edge bg-background overflow-hidden rounded-md border`,e.kind===`thread`&&!e.isResolved&&`border-primary/50`),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-3 py-2`,children:[(0,L.jsx)(Cp,{asChild:!0,children:(0,L.jsx)(l,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,children:(0,L.jsx)(at,{className:`size-3.5`})})}),i?(0,L.jsx)(Dp,{author:i}):null,(0,L.jsx)(`div`,{className:`text-muted-foreground min-w-0 flex-1 truncate text-xs`,children:e.kind===`comment`?(0,L.jsxs)(L.Fragment,{children:[`commented `,mf(new Date(e.createdAt))]}):(0,L.jsxs)(L.Fragment,{children:[`started a thread on`,` `,(0,L.jsx)(l,{variant:`link`,className:`h-auto max-w-full truncate p-0 align-baseline font-mono text-xs font-normal`,onClick:()=>r(e.path,e.diffSide===`RIGHT`?e.startLine??e.line??void 0:void 0),children:Ep(e)})]})}),e.kind===`thread`?(0,L.jsxs)(L.Fragment,{children:[e.isOutdated?(0,L.jsx)(je,{variant:`outline`,children:`Outdated`}):null,(0,L.jsx)(je,{variant:e.isResolved?`secondary`:`default`,children:e.isResolved?`Resolved`:`Unresolved`}),!e.isResolved&&e.viewerCanResolve&&!e.comments.some(e=>e.reviewState===`PENDING`)?(0,L.jsxs)(l,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,disabled:t===e.threadId,onClick:()=>n(e.threadId),children:[(0,L.jsx)(it,{className:`size-3.5`}),t===e.threadId?`Resolving`:`Resolve`]}):null]}):null]}),(0,L.jsx)(wp,{children:e.kind===`comment`?(0,L.jsx)(Op,{body:e.body,url:e.url}):(0,L.jsxs)(`div`,{className:`space-y-3 px-3 pb-3`,children:[(0,L.jsx)(`pre`,{className:`bg-muted/50 text-muted-foreground overflow-x-auto rounded-md px-3 py-2 text-xs`,children:e.comments[0]?.diffHunk??``}),e.comments.map(e=>(0,L.jsxs)(`div`,{className:`border-edge border-t pt-3`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex min-w-0 items-center justify-between gap-2`,children:[(0,L.jsx)(Dp,{author:e.author}),(0,L.jsx)(`span`,{className:`text-muted-foreground shrink-0 text-xs`,children:mf(new Date(e.createdAt))})]}),(0,L.jsx)(Op,{body:e.body,url:e.url})]},e.id))]})})]})})},jp=({body:e,conversation:t,isLoading:n,isError:r,resolvingThreadId:i,onRetry:a,onResolveThread:o,onSelectFile:s})=>(0,L.jsx)(`div`,{className:`border-edge bg-background border-b p-4`,children:(0,L.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-4`,children:[(0,L.jsx)(`section`,{className:`space-y-2`,children:(0,L.jsx)(`div`,{className:`border-edge rounded-md border p-3`,children:(0,L.jsx)(xp,{children:e??`_No description provided._`})})}),(0,L.jsxs)(`section`,{className:`space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-xs font-medium`,children:[(0,L.jsx)(ot,{className:`size-4`}),`Conversation`]}),t?(0,L.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[t.items.length,` items · `,t.unresolvedCount,` `,`unresolved`]}):null]}),n?(0,L.jsx)(kp,{}):null,r?(0,L.jsx)(ye,{message:`We couldn't load the pull request conversation.`,refetch:a,support:!1}):null,!n&&!r&&t?.items.length===0?(0,L.jsx)(`div`,{className:`border-edge text-muted-foreground rounded-md border p-3 text-sm`,children:`No comments or review threads yet.`}):null,(0,L.jsx)(`div`,{className:`space-y-2`,children:t?.items.map(e=>(0,L.jsx)(Ap,{item:e,resolvingThreadId:i,onResolveThread:o,onSelectFile:s},e.id))})]})]})}),Mp={ts:{grammar:`typescript`,queries:`typescript`},mts:{grammar:`typescript`,queries:`typescript`},cts:{grammar:`typescript`,queries:`typescript`},tsx:{grammar:`tsx`,queries:`typescript`},js:{grammar:`javascript`,queries:`javascript`},mjs:{grammar:`javascript`,queries:`javascript`},cjs:{grammar:`javascript`,queries:`javascript`},jsx:{grammar:`javascript`,queries:`javascript`}},Np=e=>{let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return null;let r=t.slice(n+1).toLowerCase();return Object.hasOwn(Mp,r)?Mp[r]:null},Pp=e=>!!e&&e.status!==`removed`&&!!Np(e.filename),Fp=e=>!!e.selectedFile&&e.requested&&!e.isFetching&&(e.isError||e.dataPath===e.selectedFile&&e.lineCount===0),Ip=(e,t)=>e.github.reviewGetBlame.queryOptions(t,{staleTime:1/0}),Lp=(e,t)=>e.github.reviewGetFileLines.queryOptions(t,{staleTime:1/0}),Rp=()=>null,zp=async()=>{let[{createHighlighter:e},{createJavaScriptRegexEngine:t}]=await Promise.all([ut(()=>import(`./dist-CKia_GZs.js`),__vite__mapDeps([0,1,2,3])),ut(()=>import(`./engine-javascript-PyIzzclY.js`),__vite__mapDeps([4,3]))]);return e({themes:[],langs:[],engine:t()})},Bp={Dockerfile:`dockerfile`,"docker-compose.yml":`yaml`,"docker-compose.yaml":`yaml`,"package.json":`json`,"tsconfig.json":`json`,"README.md":`md`},Vp={c:`c`,cc:`cpp`,cpp:`cpp`,cs:`csharp`,css:`css`,go:`go`,html:`html`,java:`java`,js:`js`,jsx:`jsx`,json:`json`,kt:`kotlin`,md:`md`,mdx:`mdx`,php:`php`,prisma:`prisma`,py:`python`,rb:`ruby`,rs:`rust`,scss:`scss`,sh:`bash`,sql:`sql`,ts:`ts`,tsx:`tsx`,vue:`vue`,xml:`xml`,yaml:`yaml`,yml:`yaml`},Hp=e=>{let t=e.split(`/`).pop()??e,n=Bp[t];if(n)return n;let r=t.includes(`.`)?t.split(`.`).pop():void 0;return r?Vp[r.toLowerCase()]??`text`:`text`},Up=e=>[...new Set(e.map(Hp))].filter(e=>Jf.includes(e)).sort(),Wp=({filenames:e,theme:t})=>{let n=p({queryKey:[`review-diff-shiki`],queryFn:zp,staleTime:1/0}),r=Up(e);return p({queryKey:[`review-diff-shiki`,`preload`,r,t],queryFn:async()=>n.data?(await Promise.all([n.data.loadLanguage(...r),n.data.loadTheme(t)]),!0):!1,enabled:n.data!==void 0&&r.length>0,staleTime:1/0}),n},Gp=e=>Array.from({length:e.endLine-e.startLine+1},(t,n)=>e.startLine+n),Kp=({blocks:e,files:t})=>{let n=new Map(t.map(e=>[e.filename,e.previousFilename]));return e.reduce((e,t)=>{let r=n.get(t.from.filename)??t.from.filename,i=t.from.filename!==t.to.filename;return Gp(t.from).forEach(n=>e.set(`${t.from.filename}:old:${n}`,{label:i?`Moved to ${t.to.filename}`:null,target:{filename:t.to.filename,line:t.to.startLine}})),Gp(t.to).forEach(n=>e.set(`${t.to.filename}:new:${n}`,{label:i?`Moved from ${r}`:null,target:{filename:t.from.filename,line:null}})),e},new Map)},qp=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,Jp=e=>e?Number(e):1,Yp=(e,t)=>{let n=qp.exec(e);return n?{rowIndex:t,header:e,oldStart:Number(n[1]),oldLines:Jp(n[2]),newStart:Number(n[3]),newLines:Jp(n[4])}:null},Xp=e=>{let t=(e.additions??0)+(e.deletions??0);return e.status===`renamed`&&t===0?e.previousFilename?`Renamed from ${e.previousFilename} with no content changes.`:`Renamed with no content changes.`:t===0?`Binary file not shown.`:`Large diff not shown (+${e.additions??0} -${e.deletions??0}). Open the file on GitHub to read it.`},Zp=e=>{if(!e.patch)return{rows:[{kind:`meta`,oldLine:null,newLine:null,content:Xp(e)}],hunks:[]};let t={oldLine:0,newLine:0},n=[],r=[];return e.patch.split(`
|
|
62
|
-
`).forEach(e=>{let i=Yp(e,n.length);i?(t.oldLine=i.oldStart,t.newLine=i.newStart,r.push(i),n.push({kind:`hunk`,oldLine:null,newLine:null,content:i.header})):e.startsWith(`\`)?n.push({kind:`meta`,oldLine:null,newLine:null,content:e}):r.length!==0&&(e.startsWith(`+`)?(n.push({kind:`add`,oldLine:null,newLine:t.newLine,content:e.slice(1)}),t.newLine+=1):e.startsWith(`-`)?(n.push({kind:`delete`,oldLine:t.oldLine,newLine:null,content:e.slice(1)}),t.oldLine+=1):e.startsWith(` `)&&(n.push({kind:`context`,oldLine:t.oldLine,newLine:t.newLine,content:e.slice(1)}),t.oldLine+=1,t.newLine+=1))}),{rows:n,hunks:r}},Qp=20,$p=2,em=2e4,tm=20,nm=e=>e.reduce((e,t)=>(Zp(t).rows.forEach(n=>{let r=n.content.trim();n.kind===`delete`&&n.oldLine!==null&&e.removed.push({filename:t.filename,line:n.oldLine,content:r}),n.kind===`add`&&n.newLine!==null&&e.added.push({filename:t.filename,line:n.newLine,content:r})}),e),{added:[],removed:[]}),rm=e=>e.reduce((e,t,n)=>{if(t.content.length<Qp)return e;let r=e.get(t.content);return r?r.push(n):e.set(t.content,[n]),e},new Map),im=({added:e,removed:t,addedIndex:n,removedIndex:r,claimedAdded:i,claimedRemoved:a})=>{let o=o=>{let s=e[n+o],c=e[n+o-1],l=t[r+o],u=t[r+o-1];return!s||!c||!l||!u?!1:s.content===l.content&&s.filename===c.filename&&l.filename===u.filename&&s.line===c.line+1&&l.line===u.line+1&&!i.has(n+o)&&!a.has(r+o)},s={offset:1};for(;o(s.offset);)s.offset+=1;return s.offset},am=({files:e})=>{let t=[];if(e.reduce((e,t)=>t.patch?e+t.additions+t.deletions:e,0)>em)return{skipped:!0,blocks:t};let{added:n,removed:r}=nm(e),i=rm(r),a=new Set,o=new Set;return n.forEach((e,s)=>{if(a.has(s)||e.content.length<Qp)return;let c=i.get(e.content);if(!c||c.length>tm)return;let l=c.reduce((e,t)=>{if(o.has(t))return e;let i=im({added:n,removed:r,addedIndex:s,removedIndex:t,claimedAdded:a,claimedRemoved:o});return e&&e.length>=i?e:{index:t,length:i}},null);if(!l||l.length<$p)return;let u=r[l.index],d=r[l.index+l.length-1],f=n[s+l.length-1];u&&d&&f&&(Array.from({length:l.length}).forEach((e,t)=>{a.add(s+t),o.add(l.index+t)}),t.push({from:{filename:u.filename,startLine:u.line,endLine:d.line},to:{filename:e.filename,startLine:e.line,endLine:f.line}}))}),{skipped:!1,blocks:t}},om=({files:e})=>{let t=(0,I.useRef)(null);if(t.current?.files!==e){let n=am({files:e});t.current={files:e,skipped:n.skipped,markers:Kp({blocks:n.blocks,files:e})}}return{skipped:t.current.skipped,markers:t.current.markers}},sm=`glen.review.code-appearance.v1`,cm=`glen-review-code-appearance`,lm=ap.parse({theme:`automatic`,size:`medium`,wrap:!1,blame:!0}),um=e=>{if(!e)return lm;let[t,n,r,i]=e.split(`:`),a=ap.safeParse({theme:t,size:n,wrap:r===`1`,...i===`0`||i===`1`?{blame:i===`1`}:{}});return a.success?a.data:lm},dm=e=>[e.theme,e.size,e.wrap?`1`:`0`,e.blame?`1`:`0`].join(`:`),fm=dm(lm),pm=()=>localStorage.getItem(sm)??fm,mm=e=>{let t=t=>{t.key===sm&&e()};return window.addEventListener(`storage`,t),window.addEventListener(cm,e),()=>{window.removeEventListener(`storage`,t),window.removeEventListener(cm,e)}},hm=()=>{let e=um((0,I.useSyncExternalStore)(mm,pm,()=>fm)),t=e=>{localStorage.setItem(sm,dm(e)),window.dispatchEvent(new Event(cm))};return{appearance:e,setTheme:n=>t({...e,theme:n}),setSize:n=>t({...e,size:n}),setWrap:n=>t({...e,wrap:n}),setBlame:n=>t({...e,blame:n})}},gm=Fe({id:ke().min(1).max(256),label:ke().min(1).max(256).optional()}),_m=gm.extend({kind:Oe(`selection`),source:Ie([`diff`,`pr-description`,`comment`]),text:ke().min(1),path:ke().max(512).optional(),startLine:Ne().int().positive().optional(),endLine:Ne().int().positive().optional(),commentId:Ne().int().positive().optional()}),vm=gm.extend({kind:Oe(`file`),path:ke().min(1).max(512),status:ke().max(64).optional()}),ym=gm.extend({kind:Oe(`symbol`),path:ke().min(1).max(512),name:ke().min(1).max(256),symbolKind:Ie([`function`,`class`,`method`,`component`,`type`]),line:Ne().int().positive().optional(),signature:ke().max(512).optional()}),bm=gm.extend({kind:Oe(`pr-description`),prNumber:Ne().int().positive(),title:ke().min(1).max(512),body:ke().nullable().optional()}),xm=gm.extend({kind:Ie([`issue-comment`,`review-comment`]),commentId:Ne().int().positive(),author:ke().min(1).max(256),body:ke().min(1),path:ke().max(512).optional(),line:Ne().int().positive().optional()}),Sm=gm.extend({kind:Oe(`check`),checkId:Ne().int().positive().optional(),name:ke().min(1).max(256),status:ke().min(1).max(64),conclusion:ke().max(64).nullable().optional(),url:ke().url().max(1024).optional()}),Cm=Ae(`kind`,[_m,vm,ym,bm,xm,Sm]);Me(Cm).max(50);var wm=[],Tm=(0,I.lazy)(()=>ut(()=>import(`./diff-viewer-B_49fnUB.js`).then(e=>({default:e.DiffViewer})),__vite__mapDeps([5,1,6,7,8,9,10,11,12,2,13,14,15,16,17]))),Em=(0,I.lazy)(()=>ut(()=>import(`./explored-file-view-R_xvhDGA.js`).then(e=>({default:e.ExploredFileView})),__vite__mapDeps([18,6,1,7,8,9,15,16]))),Dm=({owner:e,repo:t,pr:n,headSha:r,prBody:i,prLoading:a,prError:o,files:s,activeFile:c,exploredFiles:l,onCloseExplored:u,scrollNonce:d,lineTarget:f,expandedStoryFile:m,prewarmFile:h,githubPrUrl:g,conversation:_,conversationLoading:v,conversationError:y,resolvingThreadId:b,viewMode:x,story:S,storyPending:C,storyError:w,storyGenerating:T,onRetryStory:ee,onActiveBeatChange:te,onAddContextItem:ne,onRetryPr:re,onRetryConversation:ie,onResolveThread:ae,onSelectFile:oe,onExpandStoryFile:E,onFileCommented:D,blockMarks:se,history:O,viewportRef:k})=>{let ce=N(),{resolvedTheme:le}=At(),A=hm(),ue=op(A.appearance.theme,le),de=Wp({filenames:(s??wm).map(e=>e.filename),theme:ue}),j=(0,I.useRef)(null);de.data&&j.current?.highlighter!==de.data&&(j.current={highlighter:de.data,cache:tp(de.data)});let fe=de.data?j.current?.cache:null,[pe,me]=(0,I.useReducer)((e,t)=>t,null),he=yt(ce.github.reviewAddInlineComment.mutationOptions({onSuccess:e=>{P.success(e.type===`pending_inline`?`Review comment added.`:`Inline comment posted.`),D()},onError:e=>{P.error(e.message??`Failed to add inline comment.`)}})),ge=yt(ce.github.reviewReplyToThread.mutationOptions({onSuccess:()=>{P.success(`Reply posted.`),D()},onError:e=>{P.error(e.message??`Failed to post reply.`)}})),_e=c&&l.includes(c)?c:null,ve=_e?null:c??s?.[0]?.filename??null,be=s?.find(e=>e.filename===ve)??null,[xe,Se]=(0,I.useReducer)((e,t)=>e.has(t)?e:new Set(e).add(t),new Set);ve&&!xe.has(ve)&&(f?.filename===ve||Pp(be))&&Se(ve);let Ce=p({...Lp(ce,{owner:e,repo:t,pr:n,headSha:r,path:ve??``}),enabled:!!ve&&xe.has(ve)}),we=Ce.data?.path===ve?Ce.data?.lines??null:null,M=Fp({selectedFile:ve,requested:!!ve&&xe.has(ve),isFetching:Ce.isFetching,isError:Ce.isError,dataPath:Ce.data?.path,lineCount:Ce.data?.lines.length??0}),Te=()=>{Ce.refetch()},[Ee,De]=(0,I.useState)(`unified`),Oe=A.appearance.blame&&!!r,ke=e=>!!e&&e.status!==`removed`,Ae=p({...Ip(ce,{owner:e,repo:t,pr:n,headSha:r,paths:ve?[ve]:[]}),enabled:Oe&&!!ve&&ke(be)}),je=s?.find(e=>e.filename===h)??null;p({...Ip(ce,{owner:e,repo:t,pr:n,headSha:r,paths:h?[h]:[]}),enabled:Oe&&!!h&&h!==ve&&ke(je),retry:!1});let Me=Ae.data?.files.find(e=>e.path===ve)??null,Ne=Me?.ok?Me.ranges:null,Pe=Ae.isError?`Couldn't load blame.`:Me&&!Me.ok?Me.reason:null,Fe=()=>{Ae.refetch()},Ie=om({files:s??wm}),Le=c===null,Re=_?.items.flatMap(e=>e.kind===`thread`&&e.path&&e.line?[e]:[])??[],ze=_?.items.flatMap(e=>e.kind===`thread`&&e.path&&!e.line?[e]:[])??[],Be={resolvingThreadId:b,replyPending:ge.isPending,inlineCommentPending:he.isPending,onResolveThread:ae,onReply:(r,i)=>ge.mutate({owner:e,repo:t,pr:n,threadId:r,body:i}),onAddInlineComment:i=>he.mutate({owner:e,repo:t,pr:n,body:i.body,path:i.path,line:i.line,side:i.side,commitId:r,mode:i.mode})};return x===`story`?(0,L.jsx)(Rp,{story:S,isPending:C,isError:w,generating:T,onRetry:ee,prBody:i,conversation:_,conversationLoading:v,conversationError:y,onRetryConversation:ie,onSelectFile:oe,handlers:Be,onActiveBeatChange:te,tokenCache:fe,shikiTheme:ue,codeAppearance:A,onAddContextItem:ne,onExpandFile:E}):_e?(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(up,{}),children:(0,L.jsx)(Em,{owner:e,repo:t,pr:n,headSha:r,path:_e,lineTarget:f,tokenCache:fe,shikiTheme:ue,codeAppearance:A,history:O,viewportRef:k,onClose:()=>u(_e)})}):(0,L.jsxs)(`div`,{className:`flex h-full flex-col overflow-y-auto`,children:[Le?(0,L.jsx)(jp,{body:i,conversation:_,isLoading:v,isError:y,resolvingThreadId:b,onRetry:ie,onResolveThread:ae,onSelectFile:oe}):null,!Le&&a?(0,L.jsx)(lp,{}):null,!Le&&o?(0,L.jsx)(ye,{refetch:re}):null,!Le&&!a&&!o&&s?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(cp,{}),children:(0,L.jsx)(Tm,{files:s,activeFile:c,owner:e,repo:t,pr:n,headSha:r,scrollNonce:d,lineTarget:f,expandedStoryFile:m,onAddSelection:e=>ne(np(e)),prewarmFile:h,githubPrUrl:g,commitUrlBase:sp(e,t),inlineThreads:Re,fileThreads:ze,inlineCommentPending:he.isPending,resolvingThreadId:b,replyPending:ge.isPending,onResolveThread:ae,onReply:(r,i)=>ge.mutate({owner:e,repo:t,pr:n,threadId:r,body:i}),onCommentFile:me,onInlineCommented:i=>he.mutate({owner:e,repo:t,pr:n,body:i.body,path:i.target.filename,line:i.target.line,side:i.target.side,commitId:r,mode:i.mode}),tokenCache:fe,shikiTheme:ue,codeAppearance:A,fileLines:we,fileLinesLoading:Ce.isFetching,fileLinesError:M,onRetryFileLines:Te,onPrefetchFileLines:Se,blame:Ne,blameEnabled:A.appearance.blame,blameLoading:Ae.isFetching,blameError:Pe,onRetryBlame:Fe,layout:Ee,onLayoutChange:De,onSelectFile:oe,history:O,viewportRef:k,moves:Ie,blocksByFile:se.blocksByFile,blockMarks:se})})}):null,(0,L.jsx)(bp,{owner:e,repo:t,pr:n,headSha:r,filename:pe,open:pe!==null,onOpenChange:e=>me(e?pe:null),onCommented:D})]})};function Om({className:e,...t}){return(0,L.jsx)(Rc,{"data-slot":`checkbox`,className:o(`peer size-4 shrink-0 rounded-control border border-edge-strong transition-shadow dark:bg-input/30 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary`,e),...t,children:(0,L.jsx)(zc,{className:`flex items-center justify-center text-current`,children:(0,L.jsx)(fn,{className:`size-3`,weight:`bold`})})})}var km=e=>e.map(e=>e.kind===`folder`?{...e,children:km(e.children)}:e).sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`folder`?-1:1),Am=e=>{if(e.kind===`file`)return e;let t=e.children.map(Am),n={...e,children:t},[r]=n.children;return n.children.length!==1||r?.kind!==`folder`?n:{...r,name:`${n.name}/${r.name}`}},jm=(e,t,n,r)=>{let[i,...a]=n;if(!i)return e;if(a.length===0)return e.push({kind:`file`,name:i,path:t.filename,file:t}),e;let o=r?`${r}/${i}`:i,s=e.find(e=>e.kind===`folder`&&e.path===o),c=s?.kind===`folder`?s:{kind:`folder`,name:i,path:o,children:[]};return s||e.push(c),jm(c.children,t,a,o),e},Mm=e=>km(e.reduce((e,t)=>jm(e,t,t.filename.split(`/`),``),[])).map(Am),Nm=e=>{switch(e){case`added`:return(0,L.jsx)(xn,{size:14,className:`text-chart-1 shrink-0`});case`removed`:return(0,L.jsx)(Cn,{size:14,className:`text-destructive shrink-0`});case`renamed`:return(0,L.jsx)(sn,{size:14,className:`text-muted-foreground shrink-0`});default:return null}},Pm=100,Fm=e=>e*.75+.5,Im=({node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c})=>{let u=(0,I.useRef)(void 0),d=()=>{clearTimeout(u.current),u.current=setTimeout(()=>i(e.file.filename),Pm)},f=()=>clearTimeout(u.current),p=s?.get(e.file.filename);return(0,I.useEffect)(()=>()=>clearTimeout(u.current),[]),(0,L.jsxs)(l,{variant:a===e.file.filename?`secondary`:`ghost`,onClick:()=>r(e.file.filename),onFocus:d,onBlur:f,onMouseEnter:d,onMouseLeave:f,className:`h-6 w-full justify-start gap-1.5 px-2 py-0 text-xs font-normal`,style:{paddingLeft:`${Fm(c)}rem`},children:[(0,L.jsx)(Om,{checked:t.has(e.file.filename),disabled:!o,onCheckedChange:t=>n(e.file.filename,!!t),onClick:e=>e.stopPropagation()}),Nm(e.file.status),(0,L.jsx)(`span`,{title:e.file.filename,className:`min-w-0 truncate text-left font-mono`,children:e.name}),(0,L.jsxs)(`span`,{className:`flex h-4 min-w-0 flex-1 basis-0 flex-row-reverse flex-wrap gap-x-1.5 overflow-hidden tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-destructive/80`,children:[`-`,e.file.deletions]}),(0,L.jsxs)(`span`,{className:`text-brand/80`,children:[`+`,e.file.additions]}),p&&p.reviewed>0?(0,L.jsxs)(`span`,{className:`text-muted-foreground`,title:`${p.reviewed} of ${p.total} change blocks reviewed`,children:[p.reviewed,`/`,p.total]}):null]})]})},Lm=({node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c})=>(0,L.jsxs)(Sp,{defaultOpen:!0,children:[(0,L.jsx)(Cp,{asChild:!0,children:(0,L.jsxs)(l,{variant:`ghost`,className:`group h-6 w-full justify-start gap-1.5 px-2 py-0 text-xs font-medium`,style:{paddingLeft:`${Fm(c)}rem`},children:[(0,L.jsx)(ze,{size:12,className:`shrink-0 transition-transform group-data-[state=open]:rotate-90`}),(0,L.jsx)(Tn,{size:14,className:`shrink-0 group-data-[state=open]:hidden`}),(0,L.jsx)(Dn,{size:14,className:`hidden shrink-0 group-data-[state=open]:block`}),(0,L.jsx)(`span`,{title:e.path,className:`truncate font-mono`,children:e.name})]})}),(0,L.jsxs)(wp,{className:`relative`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`bg-edge pointer-events-none absolute inset-y-0 w-px`,style:{left:`calc(${Fm(c)}rem + 6px)`}}),e.children.map(e=>(0,L.jsx)(Rm,{node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c+1},e.path))]})]}),Rm=({node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c})=>e.kind===`folder`?(0,L.jsx)(Lm,{node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c}):(0,L.jsx)(Im,{node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c}),zm=({paths:e,activeFile:t,onSelectFile:n,onCloseExplored:r})=>e.length===0?null:(0,L.jsxs)(`div`,{className:`border-edge mt-2 flex flex-col gap-0.5 border-t border-dashed pt-2`,children:[(0,L.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 px-2 py-1 text-xs font-medium`,children:[(0,L.jsx)(vn,{size:13,className:`shrink-0`}),`Explored · reference only`]}),e.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,L.jsx)(l,{variant:t===e?`secondary`:`ghost`,onClick:()=>n(e),className:`h-auto min-w-0 flex-1 justify-start gap-2 px-2 py-1.5 text-xs font-normal`,children:(0,L.jsx)(`span`,{title:e,className:`text-muted-foreground truncate font-mono`,children:e.split(`/`).slice(-2).join(`/`)})}),(0,L.jsx)(l,{variant:`ghost`,size:`icon-xs`,"aria-label":`Close ${e}`,onClick:()=>r(e),children:(0,L.jsx)(S,{size:12})})]},e))]}),Bm=({files:e,exploredFiles:t,viewedFiles:n,viewedReady:r,blockProgress:i,onToggleViewed:a,onSelectDescription:o,onSelectFile:s,onCloseExplored:c,onPrewarmFile:u,activeFile:d})=>{let f=new Set(n),p=Mm(e);return(0,L.jsxs)(`div`,{className:`flex h-full flex-col overflow-y-auto p-2`,children:[(0,L.jsxs)(`div`,{className:`text-muted-foreground shrink-0 px-2 py-1 text-xs font-medium`,children:[e.length,` files changed · `,f.size,` viewed`]}),(0,L.jsxs)(l,{variant:d===null?`secondary`:`ghost`,onClick:o,className:`h-6 w-full justify-start gap-2 px-2 py-0 text-xs font-normal`,children:[(0,L.jsx)(Nn,{size:14,className:`text-muted-foreground shrink-0`}),(0,L.jsx)(`span`,{className:`flex-1 truncate text-left`,children:`PR description`})]}),p.map(e=>(0,L.jsx)(Rm,{node:e,viewedSet:f,onToggleViewed:a,onSelectFile:s,onPrewarmFile:u,activeFile:d,viewedReady:r,blockProgress:i,depth:0},e.path)),(0,L.jsx)(zm,{paths:t,activeFile:d,onSelectFile:s,onCloseExplored:c})]})},Vm=()=>(0,L.jsx)(`div`,{className:`flex flex-col gap-2 p-3`,children:Array.from({length:8}).map((e,t)=>(0,L.jsx)(j,{className:`h-6 w-full`},t))}),Hm=class extends I.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,{componentStack:t}){this.props.onError?.(e,t??null)}render(){return this.state.hasError?this.props.fallback===void 0?(0,L.jsx)(ye,{message:this.props.message??`This section failed to load.`,refetch:()=>this.setState({hasError:!1})}):this.props.fallback:this.props.children}},Um=(...e)=>void 0,Wm={start:Um,identify:Um,group:Um,reset:Um,events:e=>({definitions:e,capture:Um}),captureException:(e,t)=>void Qe.local.clientError.mutate({message:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack??null:null,properties:t}).catch(()=>void 0),sessionReplayUrl:()=>void 0},Gm=({name:e,children:t,...n})=>(0,L.jsx)(zi,{...n,children:(0,L.jsx)(Hm,{message:`Only this panel failed. The rest of the review still works.`,onError:(t,n)=>Wm.captureException(t instanceof Error?t:Error(String(t)),{boundary:`review-panel`,panel:e,componentStack:n}),children:t})});function Km({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,L.jsx)(ef,{"data-slot":`separator`,decorative:n,orientation:t,className:o(`shrink-0 bg-edge data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}var qm=()=>(0,L.jsx)(Hi,{className:`group/handle flex w-1.5 cursor-col-resize`,children:(0,L.jsx)(`div`,{className:`group-hover/handle:bg-primary/30 flex w-full justify-center transition-colors`,children:(0,L.jsx)(Km,{orientation:`vertical`})})}),Jm=({prData:e,...t})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Gm,{name:`file-tree`,defaultSize:15,minSize:10,collapsible:!0,children:e.isPending?(0,L.jsx)(Vm,{}):e.isError||!e.data?(0,L.jsx)(ye,{refetch:()=>void e.refetch(),support:!1}):(0,L.jsx)(Bm,{files:e.data.files,...t})}),(0,L.jsx)(qm,{})]}),Ym=(e,t)=>e.github.reviewGetConversation.queryOptions(t,{staleTime:6e4,refetchOnWindowFocus:!1}),Xm=(e,t)=>e.github.reviewGetMetadata.queryOptions(t,{staleTime:6e4,refetchOnWindowFocus:!1}),Zm=(e,t)=>e.github.reviewGetPrMeta.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),Qm=(e,t)=>e.github.reviewGetPr.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),$m=(e,t)=>e.github.reviewGetSession.queryOptions(t),eh=(e,t)=>e.github.reviewGetSources.queryOptions(t),th=({owner:e,repo:t,pr:n,open:r,onOpenChange:i,onSubmitted:a,canApprove:o})=>{let s=N(),[c,u]=(0,I.useState)(``),d=c.trim().length-yp,f=yt(s.github.reviewSubmit.mutationOptions({onSuccess:()=>{P.success(`Review submitted.`),u(``),i(!1),a()},onError:e=>{P.error(e.message??`Failed to submit review.`)}})),p=r=>{let i=c.trim();r!==`APPROVE`&&!i?P.error(`Add a review summary before submitting.`):i.length>65536?P.error(`Review is too long (GitHub allows at most ${yp.toLocaleString()} characters).`):f.mutate({owner:e,repo:t,pr:n,event:r,body:i.length>0?i:void 0})};return(0,L.jsx)(dp,{open:r,onOpenChange:i,children:(0,L.jsxs)(mp,{className:`sm:max-w-lg`,children:[(0,L.jsxs)(hp,{children:[(0,L.jsx)(_p,{children:`Review changes`}),(0,L.jsx)(vp,{children:o?`Submit a summary review for this pull request.`:`You can't approve or request changes on your own pull request, but you can leave a comment.`})]}),(0,L.jsx)(tt,{value:c,onChange:e=>u(e.target.value),placeholder:`Leave a review summary...`,className:`min-h-32`}),d>0?(0,L.jsxs)(`p`,{className:`text-destructive text-xs`,children:[d.toLocaleString(),` characters over GitHub's`,` `,yp.toLocaleString(),` limit.`]}):null,(0,L.jsxs)(gp,{className:`gap-2`,children:[(0,L.jsxs)(l,{variant:`outline`,disabled:f.isPending||d>0,onClick:()=>p(`COMMENT`),children:[f.isPending?(0,L.jsx)(Ke,{}):null,`Comment`]}),o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(l,{disabled:f.isPending||d>0,onClick:()=>p(`APPROVE`),children:`Approve`}),(0,L.jsx)(l,{variant:`destructive`,disabled:f.isPending||d>0,onClick:()=>p(`REQUEST_CHANGES`),children:`Request changes`})]}):null]})]})})};function nh({...e}){return(0,L.jsx)(nc,{"data-slot":`alert-dialog`,...e})}function rh({...e}){return(0,L.jsx)(rc,{"data-slot":`alert-dialog-portal`,...e})}function ih({className:e,...t}){return(0,L.jsx)(ic,{"data-slot":`alert-dialog-overlay`,className:o(`fixed inset-0 z-50 bg-scrim duration-(--duration-fast) supports-backdrop-filter:backdrop-blur-xs low-power:backdrop-filter-none data-open:animate-in data-open:ease-(--ease-enter) data-open:fade-in-0 data-closed:animate-out data-closed:ease-(--ease-exit) data-closed:fade-out-0 motion-reduce:animate-none low-power:animate-none`,e),...t})}function ah({className:e,size:t=`default`,...n}){return(0,L.jsxs)(rh,{children:[(0,L.jsx)(ih,{}),(0,L.jsx)(ac,{"data-slot":`alert-dialog-content`,"data-size":t,className:o(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-surface border border-edge-overlay bg-card p-4 text-card-foreground shadow-2xl duration-(--duration-fast) outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:ease-(--ease-enter) data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:ease-(--ease-exit) data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none low-power:animate-none`,e),...n})]})}function oh({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:o(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function sh({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:o(`flex flex-col-reverse gap-2 pt-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function ch({className:e,...t}){return(0,L.jsx)(cc,{"data-slot":`alert-dialog-title`,className:o(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function lh({className:e,...t}){return(0,L.jsx)(lc,{"data-slot":`alert-dialog-description`,className:o(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function uh({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,L.jsx)(l,{variant:t,size:n,asChild:!0,children:(0,L.jsx)(oc,{"data-slot":`alert-dialog-action`,className:o(e),...r})})}function dh({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,L.jsx)(l,{variant:t,size:n,asChild:!0,children:(0,L.jsx)(sc,{"data-slot":`alert-dialog-cancel`,className:o(e),...r})})}var fh=({active:e,onNavigate:t})=>{let[n,r]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!e)return;let t=e=>{e.preventDefault(),e.returnValue=``},n=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target?.closest(`a`);t&&(!t.getAttribute(`href`)||t.target===`_blank`||t.hasAttribute(`download`)||t.origin!==window.location.origin||t.pathname===window.location.pathname&&t.search===window.location.search||(e.preventDefault(),e.stopPropagation(),r(t.pathname+t.search)))};return window.addEventListener(`beforeunload`,t),document.addEventListener(`click`,n,!0),()=>{window.removeEventListener(`beforeunload`,t),document.removeEventListener(`click`,n,!0)}},[e]),(0,L.jsx)(nh,{open:n!==null,onOpenChange:e=>{e||r(null)},children:(0,L.jsxs)(ah,{children:[(0,L.jsxs)(oh,{children:[(0,L.jsx)(ch,{children:`Submit your review?`}),(0,L.jsx)(lh,{children:`You have review comments that you haven't submitted yet. They stay as a draft on GitHub, but the author won't see them until you submit your review.`})]}),(0,L.jsxs)(sh,{children:[(0,L.jsx)(dh,{children:`Keep reviewing`}),(0,L.jsx)(uh,{onClick:()=>{let e=n;r(null),e&&t(e)},children:`Leave without submitting`})]})]})})},ph=({blockKeys:e,marked:t,viewed:n,changes:r})=>{let i=new Set(r.map(e=>e.key)),a=r.some(e=>!e.reviewed),o=n&&a?e.flatMap(e=>t.has(e)||i.has(e)?[]:[{key:e,reviewed:!0}]):[],s=[...r,...o].filter((e,n,r)=>t.has(e.key)!==e.reviewed&&r.findIndex(t=>t.key===e.key)===n),c=new Set(t);s.forEach(e=>e.reviewed?c.add(e.key):c.delete(e.key));let l=e.length>0&&e.every(e=>c.has(e));return{marks:s,file:n&&a?`unview`:!n&&l&&s.length>0?`view`:null}},mh=(e,t)=>{let[n,r]=Array.from(e).reduce(([e,t],n)=>{let r=n.codePointAt(0)??0;return[Math.imul(e^r,2654435761),Math.imul(t^r,1597334677)]},[3735928559^t,1103547991^t]),i=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909);return(4294967296*(2097151&(Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909)))+(i>>>0)).toString(36)},hh=({path:e,removed:t,added:n})=>{let r=[e,t.map(e=>e.trimEnd()).join(`
|
|
62
|
+
`).forEach(e=>{let i=Yp(e,n.length);i?(t.oldLine=i.oldStart,t.newLine=i.newStart,r.push(i),n.push({kind:`hunk`,oldLine:null,newLine:null,content:i.header})):e.startsWith(`\`)?n.push({kind:`meta`,oldLine:null,newLine:null,content:e}):r.length!==0&&(e.startsWith(`+`)?(n.push({kind:`add`,oldLine:null,newLine:t.newLine,content:e.slice(1)}),t.newLine+=1):e.startsWith(`-`)?(n.push({kind:`delete`,oldLine:t.oldLine,newLine:null,content:e.slice(1)}),t.oldLine+=1):e.startsWith(` `)&&(n.push({kind:`context`,oldLine:t.oldLine,newLine:t.newLine,content:e.slice(1)}),t.oldLine+=1,t.newLine+=1))}),{rows:n,hunks:r}},Qp=20,$p=2,em=2e4,tm=20,nm=e=>e.reduce((e,t)=>(Zp(t).rows.forEach(n=>{let r=n.content.trim();n.kind===`delete`&&n.oldLine!==null&&e.removed.push({filename:t.filename,line:n.oldLine,content:r}),n.kind===`add`&&n.newLine!==null&&e.added.push({filename:t.filename,line:n.newLine,content:r})}),e),{added:[],removed:[]}),rm=e=>e.reduce((e,t,n)=>{if(t.content.length<Qp)return e;let r=e.get(t.content);return r?r.push(n):e.set(t.content,[n]),e},new Map),im=({added:e,removed:t,addedIndex:n,removedIndex:r,claimedAdded:i,claimedRemoved:a})=>{let o=o=>{let s=e[n+o],c=e[n+o-1],l=t[r+o],u=t[r+o-1];return!s||!c||!l||!u?!1:s.content===l.content&&s.filename===c.filename&&l.filename===u.filename&&s.line===c.line+1&&l.line===u.line+1&&!i.has(n+o)&&!a.has(r+o)},s={offset:1};for(;o(s.offset);)s.offset+=1;return s.offset},am=({files:e})=>{let t=[];if(e.reduce((e,t)=>t.patch?e+t.additions+t.deletions:e,0)>em)return{skipped:!0,blocks:t};let{added:n,removed:r}=nm(e),i=rm(r),a=new Set,o=new Set;return n.forEach((e,s)=>{if(a.has(s)||e.content.length<Qp)return;let c=i.get(e.content);if(!c||c.length>tm)return;let l=c.reduce((e,t)=>{if(o.has(t))return e;let i=im({added:n,removed:r,addedIndex:s,removedIndex:t,claimedAdded:a,claimedRemoved:o});return e&&e.length>=i?e:{index:t,length:i}},null);if(!l||l.length<$p)return;let u=r[l.index],d=r[l.index+l.length-1],f=n[s+l.length-1];u&&d&&f&&(Array.from({length:l.length}).forEach((e,t)=>{a.add(s+t),o.add(l.index+t)}),t.push({from:{filename:u.filename,startLine:u.line,endLine:d.line},to:{filename:e.filename,startLine:e.line,endLine:f.line}}))}),{skipped:!1,blocks:t}},om=({files:e})=>{let t=(0,I.useRef)(null);if(t.current?.files!==e){let n=am({files:e});t.current={files:e,skipped:n.skipped,markers:Kp({blocks:n.blocks,files:e})}}return{skipped:t.current.skipped,markers:t.current.markers}},sm=`glen.review.code-appearance.v1`,cm=`glen-review-code-appearance`,lm=ap.parse({theme:`automatic`,size:`medium`,wrap:!1,blame:!0}),um=e=>{if(!e)return lm;let[t,n,r,i]=e.split(`:`),a=ap.safeParse({theme:t,size:n,wrap:r===`1`,...i===`0`||i===`1`?{blame:i===`1`}:{}});return a.success?a.data:lm},dm=e=>[e.theme,e.size,e.wrap?`1`:`0`,e.blame?`1`:`0`].join(`:`),fm=dm(lm),pm=()=>localStorage.getItem(sm)??fm,mm=e=>{let t=t=>{t.key===sm&&e()};return window.addEventListener(`storage`,t),window.addEventListener(cm,e),()=>{window.removeEventListener(`storage`,t),window.removeEventListener(cm,e)}},hm=()=>{let e=um((0,I.useSyncExternalStore)(mm,pm,()=>fm)),t=e=>{localStorage.setItem(sm,dm(e)),window.dispatchEvent(new Event(cm))};return{appearance:e,setTheme:n=>t({...e,theme:n}),setSize:n=>t({...e,size:n}),setWrap:n=>t({...e,wrap:n}),setBlame:n=>t({...e,blame:n})}},gm=Fe({id:ke().min(1).max(256),label:ke().min(1).max(256).optional()}),_m=gm.extend({kind:Oe(`selection`),source:Ie([`diff`,`pr-description`,`comment`]),text:ke().min(1),path:ke().max(512).optional(),startLine:Ne().int().positive().optional(),endLine:Ne().int().positive().optional(),commentId:Ne().int().positive().optional()}),vm=gm.extend({kind:Oe(`file`),path:ke().min(1).max(512),status:ke().max(64).optional()}),ym=gm.extend({kind:Oe(`symbol`),path:ke().min(1).max(512),name:ke().min(1).max(256),symbolKind:Ie([`function`,`class`,`method`,`component`,`type`]),line:Ne().int().positive().optional(),signature:ke().max(512).optional()}),bm=gm.extend({kind:Oe(`pr-description`),prNumber:Ne().int().positive(),title:ke().min(1).max(512),body:ke().nullable().optional()}),xm=gm.extend({kind:Ie([`issue-comment`,`review-comment`]),commentId:Ne().int().positive(),author:ke().min(1).max(256),body:ke().min(1),path:ke().max(512).optional(),line:Ne().int().positive().optional()}),Sm=gm.extend({kind:Oe(`check`),checkId:Ne().int().positive().optional(),name:ke().min(1).max(256),status:ke().min(1).max(64),conclusion:ke().max(64).nullable().optional(),url:ke().url().max(1024).optional()}),Cm=Ae(`kind`,[_m,vm,ym,bm,xm,Sm]);Me(Cm).max(50);var wm=[],Tm=(0,I.lazy)(()=>ut(()=>import(`./diff-viewer-CdSOTCI1.js`).then(e=>({default:e.DiffViewer})),__vite__mapDeps([5,1,6,7,8,9,10,11,12,2,13,14,15,16,17]))),Em=(0,I.lazy)(()=>ut(()=>import(`./explored-file-view-DLx8rzcm.js`).then(e=>({default:e.ExploredFileView})),__vite__mapDeps([18,6,1,7,8,9,15,16]))),Dm=({owner:e,repo:t,pr:n,headSha:r,prBody:i,prLoading:a,prError:o,files:s,activeFile:c,exploredFiles:l,onCloseExplored:u,scrollNonce:d,lineTarget:f,expandedStoryFile:m,prewarmFile:h,githubPrUrl:g,conversation:_,conversationLoading:v,conversationError:y,resolvingThreadId:b,viewMode:x,story:S,storyPending:C,storyError:w,storyGenerating:T,onRetryStory:ee,onActiveBeatChange:te,onAddContextItem:ne,onRetryPr:re,onRetryConversation:ie,onResolveThread:ae,onSelectFile:oe,onExpandStoryFile:E,onFileCommented:D,blockMarks:se,history:O,viewportRef:k})=>{let ce=N(),{resolvedTheme:le}=At(),A=hm(),ue=op(A.appearance.theme,le),de=Wp({filenames:(s??wm).map(e=>e.filename),theme:ue}),j=(0,I.useRef)(null);de.data&&j.current?.highlighter!==de.data&&(j.current={highlighter:de.data,cache:tp(de.data)});let fe=de.data?j.current?.cache:null,[pe,me]=(0,I.useReducer)((e,t)=>t,null),he=yt(ce.github.reviewAddInlineComment.mutationOptions({onSuccess:e=>{P.success(e.type===`pending_inline`?`Review comment added.`:`Inline comment posted.`),D()},onError:e=>{P.error(e.message??`Failed to add inline comment.`)}})),ge=yt(ce.github.reviewReplyToThread.mutationOptions({onSuccess:()=>{P.success(`Reply posted.`),D()},onError:e=>{P.error(e.message??`Failed to post reply.`)}})),_e=c&&l.includes(c)?c:null,ve=_e?null:c??s?.[0]?.filename??null,be=s?.find(e=>e.filename===ve)??null,[xe,Se]=(0,I.useReducer)((e,t)=>e.has(t)?e:new Set(e).add(t),new Set),[Ce,we]=(0,I.useReducer)(()=>!0,!1);ve&&!xe.has(ve)&&(Ce||f?.filename===ve||Pp(be))&&Se(ve);let M=p({...Lp(ce,{owner:e,repo:t,pr:n,headSha:r,path:ve??``}),enabled:!!ve&&xe.has(ve)}),Te=M.data?.path===ve?M.data?.lines??null:null,Ee=Fp({selectedFile:ve,requested:!!ve&&xe.has(ve),isFetching:M.isFetching,isError:M.isError,dataPath:M.data?.path,lineCount:M.data?.lines.length??0}),De=()=>{M.refetch()},[Oe,ke]=(0,I.useState)(`unified`),Ae=A.appearance.blame&&!!r,je=e=>!!e&&e.status!==`removed`,Me=p({...Ip(ce,{owner:e,repo:t,pr:n,headSha:r,paths:ve?[ve]:[]}),enabled:Ae&&!!ve&&je(be)}),Ne=s?.find(e=>e.filename===h)??null;p({...Ip(ce,{owner:e,repo:t,pr:n,headSha:r,paths:h?[h]:[]}),enabled:Ae&&!!h&&h!==ve&&je(Ne),retry:!1});let Pe=Me.data?.files.find(e=>e.path===ve)??null,Fe=Pe?.ok?Pe.ranges:null,Ie=Me.isError?`Couldn't load blame.`:Pe&&!Pe.ok?Pe.reason:null,Le=()=>{Me.refetch()},Re=om({files:s??wm}),ze=c===null,Be=_?.items.flatMap(e=>e.kind===`thread`&&e.path&&e.line?[e]:[])??[],Ve=_?.items.flatMap(e=>e.kind===`thread`&&e.path&&!e.line?[e]:[])??[],He={resolvingThreadId:b,replyPending:ge.isPending,inlineCommentPending:he.isPending,onResolveThread:ae,onReply:(r,i)=>ge.mutate({owner:e,repo:t,pr:n,threadId:r,body:i}),onAddInlineComment:i=>he.mutate({owner:e,repo:t,pr:n,body:i.body,path:i.path,line:i.line,side:i.side,commitId:r,mode:i.mode})};return x===`story`?(0,L.jsx)(Rp,{story:S,isPending:C,isError:w,generating:T,onRetry:ee,prBody:i,conversation:_,conversationLoading:v,conversationError:y,onRetryConversation:ie,onSelectFile:oe,handlers:He,onActiveBeatChange:te,tokenCache:fe,shikiTheme:ue,codeAppearance:A,onAddContextItem:ne,onExpandFile:E}):_e?(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(up,{}),children:(0,L.jsx)(Em,{owner:e,repo:t,pr:n,headSha:r,path:_e,lineTarget:f,tokenCache:fe,shikiTheme:ue,codeAppearance:A,history:O,viewportRef:k,onClose:()=>u(_e)})}):(0,L.jsxs)(`div`,{className:`flex h-full flex-col overflow-y-auto`,children:[ze?(0,L.jsx)(jp,{body:i,conversation:_,isLoading:v,isError:y,resolvingThreadId:b,onRetry:ie,onResolveThread:ae,onSelectFile:oe}):null,!ze&&a?(0,L.jsx)(lp,{}):null,!ze&&o?(0,L.jsx)(ye,{refetch:re}):null,!ze&&!a&&!o&&s?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(cp,{}),children:(0,L.jsx)(Tm,{files:s,activeFile:c,owner:e,repo:t,pr:n,headSha:r,scrollNonce:d,lineTarget:f,expandedStoryFile:m,onAddSelection:e=>ne(np(e)),prewarmFile:h,githubPrUrl:g,commitUrlBase:sp(e,t),inlineThreads:Be,fileThreads:Ve,inlineCommentPending:he.isPending,resolvingThreadId:b,replyPending:ge.isPending,onResolveThread:ae,onReply:(r,i)=>ge.mutate({owner:e,repo:t,pr:n,threadId:r,body:i}),onCommentFile:me,onInlineCommented:i=>he.mutate({owner:e,repo:t,pr:n,body:i.body,path:i.target.filename,line:i.target.line,side:i.target.side,commitId:r,mode:i.mode}),tokenCache:fe,shikiTheme:ue,codeAppearance:A,fileLines:Te,fileLinesLoading:M.isFetching,fileLinesError:Ee,onRetryFileLines:De,onPrefetchFileLines:Se,onFindUsed:we,blame:Fe,blameEnabled:A.appearance.blame,blameLoading:Me.isFetching,blameError:Ie,onRetryBlame:Le,layout:Oe,onLayoutChange:ke,onSelectFile:oe,history:O,viewportRef:k,moves:Re,blocksByFile:se.blocksByFile,blockMarks:se})})}):null,(0,L.jsx)(bp,{owner:e,repo:t,pr:n,headSha:r,filename:pe,open:pe!==null,onOpenChange:e=>me(e?pe:null),onCommented:D})]})};function Om({className:e,...t}){return(0,L.jsx)(Rc,{"data-slot":`checkbox`,className:o(`peer size-4 shrink-0 rounded-control border border-edge-strong transition-shadow dark:bg-input/30 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary`,e),...t,children:(0,L.jsx)(zc,{className:`flex items-center justify-center text-current`,children:(0,L.jsx)(fn,{className:`size-3`,weight:`bold`})})})}var km=e=>e.map(e=>e.kind===`folder`?{...e,children:km(e.children)}:e).sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`folder`?-1:1),Am=e=>{if(e.kind===`file`)return e;let t=e.children.map(Am),n={...e,children:t},[r]=n.children;return n.children.length!==1||r?.kind!==`folder`?n:{...r,name:`${n.name}/${r.name}`}},jm=(e,t,n,r)=>{let[i,...a]=n;if(!i)return e;if(a.length===0)return e.push({kind:`file`,name:i,path:t.filename,file:t}),e;let o=r?`${r}/${i}`:i,s=e.find(e=>e.kind===`folder`&&e.path===o),c=s?.kind===`folder`?s:{kind:`folder`,name:i,path:o,children:[]};return s||e.push(c),jm(c.children,t,a,o),e},Mm=e=>km(e.reduce((e,t)=>jm(e,t,t.filename.split(`/`),``),[])).map(Am),Nm=e=>{switch(e){case`added`:return(0,L.jsx)(xn,{size:14,className:`text-chart-1 shrink-0`});case`removed`:return(0,L.jsx)(Cn,{size:14,className:`text-destructive shrink-0`});case`renamed`:return(0,L.jsx)(sn,{size:14,className:`text-muted-foreground shrink-0`});default:return null}},Pm=100,Fm=e=>e*.75+.5,Im=({node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c})=>{let u=(0,I.useRef)(void 0),d=()=>{clearTimeout(u.current),u.current=setTimeout(()=>i(e.file.filename),Pm)},f=()=>clearTimeout(u.current),p=s?.get(e.file.filename);return(0,I.useEffect)(()=>()=>clearTimeout(u.current),[]),(0,L.jsxs)(l,{variant:a===e.file.filename?`secondary`:`ghost`,onClick:()=>r(e.file.filename),onFocus:d,onBlur:f,onMouseEnter:d,onMouseLeave:f,className:`h-6 w-full justify-start gap-1.5 px-2 py-0 text-xs font-normal`,style:{paddingLeft:`${Fm(c)}rem`},children:[(0,L.jsx)(Om,{checked:t.has(e.file.filename),disabled:!o,onCheckedChange:t=>n(e.file.filename,!!t),onClick:e=>e.stopPropagation()}),Nm(e.file.status),(0,L.jsx)(`span`,{title:e.file.filename,className:`min-w-0 truncate text-left font-mono`,children:e.name}),(0,L.jsxs)(`span`,{className:`flex h-4 min-w-0 flex-1 basis-0 flex-row-reverse flex-wrap gap-x-1.5 overflow-hidden tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-destructive/80`,children:[`-`,e.file.deletions]}),(0,L.jsxs)(`span`,{className:`text-brand/80`,children:[`+`,e.file.additions]}),p&&p.reviewed>0?(0,L.jsxs)(`span`,{className:`text-muted-foreground`,title:`${p.reviewed} of ${p.total} change blocks reviewed`,children:[p.reviewed,`/`,p.total]}):null]})]})},Lm=({node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c})=>(0,L.jsxs)(Sp,{defaultOpen:!0,children:[(0,L.jsx)(Cp,{asChild:!0,children:(0,L.jsxs)(l,{variant:`ghost`,className:`group h-6 w-full justify-start gap-1.5 px-2 py-0 text-xs font-medium`,style:{paddingLeft:`${Fm(c)}rem`},children:[(0,L.jsx)(ze,{size:12,className:`shrink-0 transition-transform group-data-[state=open]:rotate-90`}),(0,L.jsx)(Tn,{size:14,className:`shrink-0 group-data-[state=open]:hidden`}),(0,L.jsx)(Dn,{size:14,className:`hidden shrink-0 group-data-[state=open]:block`}),(0,L.jsx)(`span`,{title:e.path,className:`truncate font-mono`,children:e.name})]})}),(0,L.jsxs)(wp,{className:`relative`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`bg-edge pointer-events-none absolute inset-y-0 w-px`,style:{left:`calc(${Fm(c)}rem + 6px)`}}),e.children.map(e=>(0,L.jsx)(Rm,{node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c+1},e.path))]})]}),Rm=({node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c})=>e.kind===`folder`?(0,L.jsx)(Lm,{node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c}):(0,L.jsx)(Im,{node:e,viewedSet:t,onToggleViewed:n,onSelectFile:r,onPrewarmFile:i,activeFile:a,viewedReady:o,blockProgress:s,depth:c}),zm=({paths:e,activeFile:t,onSelectFile:n,onCloseExplored:r})=>e.length===0?null:(0,L.jsxs)(`div`,{className:`border-edge mt-2 flex flex-col gap-0.5 border-t border-dashed pt-2`,children:[(0,L.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 px-2 py-1 text-xs font-medium`,children:[(0,L.jsx)(vn,{size:13,className:`shrink-0`}),`Explored · reference only`]}),e.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,L.jsx)(l,{variant:t===e?`secondary`:`ghost`,onClick:()=>n(e),className:`h-auto min-w-0 flex-1 justify-start gap-2 px-2 py-1.5 text-xs font-normal`,children:(0,L.jsx)(`span`,{title:e,className:`text-muted-foreground truncate font-mono`,children:e.split(`/`).slice(-2).join(`/`)})}),(0,L.jsx)(l,{variant:`ghost`,size:`icon-xs`,"aria-label":`Close ${e}`,onClick:()=>r(e),children:(0,L.jsx)(S,{size:12})})]},e))]}),Bm=({files:e,exploredFiles:t,viewedFiles:n,viewedReady:r,blockProgress:i,onToggleViewed:a,onSelectDescription:o,onSelectFile:s,onCloseExplored:c,onPrewarmFile:u,activeFile:d})=>{let f=new Set(n),p=Mm(e);return(0,L.jsxs)(`div`,{className:`flex h-full flex-col overflow-y-auto p-2`,children:[(0,L.jsxs)(`div`,{className:`text-muted-foreground shrink-0 px-2 py-1 text-xs font-medium`,children:[e.length,` files changed · `,f.size,` viewed`]}),(0,L.jsxs)(l,{variant:d===null?`secondary`:`ghost`,onClick:o,className:`h-6 w-full justify-start gap-2 px-2 py-0 text-xs font-normal`,children:[(0,L.jsx)(Nn,{size:14,className:`text-muted-foreground shrink-0`}),(0,L.jsx)(`span`,{className:`flex-1 truncate text-left`,children:`PR description`})]}),p.map(e=>(0,L.jsx)(Rm,{node:e,viewedSet:f,onToggleViewed:a,onSelectFile:s,onPrewarmFile:u,activeFile:d,viewedReady:r,blockProgress:i,depth:0},e.path)),(0,L.jsx)(zm,{paths:t,activeFile:d,onSelectFile:s,onCloseExplored:c})]})},Vm=()=>(0,L.jsx)(`div`,{className:`flex flex-col gap-2 p-3`,children:Array.from({length:8}).map((e,t)=>(0,L.jsx)(j,{className:`h-6 w-full`},t))}),Hm=class extends I.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,{componentStack:t}){this.props.onError?.(e,t??null)}render(){return this.state.hasError?this.props.fallback===void 0?(0,L.jsx)(ye,{message:this.props.message??`This section failed to load.`,refetch:()=>this.setState({hasError:!1})}):this.props.fallback:this.props.children}},Um=(...e)=>void 0,Wm={start:Um,identify:Um,group:Um,reset:Um,events:e=>({definitions:e,capture:Um}),captureException:(e,t)=>void Qe.local.clientError.mutate({message:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack??null:null,properties:t}).catch(()=>void 0),sessionReplayUrl:()=>void 0},Gm=({name:e,children:t,...n})=>(0,L.jsx)(zi,{...n,children:(0,L.jsx)(Hm,{message:`Only this panel failed. The rest of the review still works.`,onError:(t,n)=>Wm.captureException(t instanceof Error?t:Error(String(t)),{boundary:`review-panel`,panel:e,componentStack:n}),children:t})});function Km({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,L.jsx)(ef,{"data-slot":`separator`,decorative:n,orientation:t,className:o(`shrink-0 bg-edge data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}var qm=()=>(0,L.jsx)(Hi,{className:`group/handle flex w-1.5 cursor-col-resize`,children:(0,L.jsx)(`div`,{className:`group-hover/handle:bg-primary/30 flex w-full justify-center transition-colors`,children:(0,L.jsx)(Km,{orientation:`vertical`})})}),Jm=({prData:e,...t})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Gm,{name:`file-tree`,defaultSize:15,minSize:10,collapsible:!0,children:e.isPending?(0,L.jsx)(Vm,{}):e.isError||!e.data?(0,L.jsx)(ye,{refetch:()=>void e.refetch(),support:!1}):(0,L.jsx)(Bm,{files:e.data.files,...t})}),(0,L.jsx)(qm,{})]}),Ym=(e,t)=>e.github.reviewGetConversation.queryOptions(t,{staleTime:6e4,refetchOnWindowFocus:!1}),Xm=(e,t)=>e.github.reviewGetMetadata.queryOptions(t,{staleTime:6e4,refetchOnWindowFocus:!1}),Zm=(e,t)=>e.github.reviewGetPrMeta.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),Qm=(e,t)=>e.github.reviewGetPr.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),$m=(e,t)=>e.github.reviewGetSession.queryOptions(t),eh=(e,t)=>e.github.reviewGetSources.queryOptions(t),th=({owner:e,repo:t,pr:n,open:r,onOpenChange:i,onSubmitted:a,canApprove:o})=>{let s=N(),[c,u]=(0,I.useState)(``),d=c.trim().length-yp,f=yt(s.github.reviewSubmit.mutationOptions({onSuccess:()=>{P.success(`Review submitted.`),u(``),i(!1),a()},onError:e=>{P.error(e.message??`Failed to submit review.`)}})),p=r=>{let i=c.trim();r!==`APPROVE`&&!i?P.error(`Add a review summary before submitting.`):i.length>65536?P.error(`Review is too long (GitHub allows at most ${yp.toLocaleString()} characters).`):f.mutate({owner:e,repo:t,pr:n,event:r,body:i.length>0?i:void 0})};return(0,L.jsx)(dp,{open:r,onOpenChange:i,children:(0,L.jsxs)(mp,{className:`sm:max-w-lg`,children:[(0,L.jsxs)(hp,{children:[(0,L.jsx)(_p,{children:`Review changes`}),(0,L.jsx)(vp,{children:o?`Submit a summary review for this pull request.`:`You can't approve or request changes on your own pull request, but you can leave a comment.`})]}),(0,L.jsx)(tt,{value:c,onChange:e=>u(e.target.value),placeholder:`Leave a review summary...`,className:`min-h-32`}),d>0?(0,L.jsxs)(`p`,{className:`text-destructive text-xs`,children:[d.toLocaleString(),` characters over GitHub's`,` `,yp.toLocaleString(),` limit.`]}):null,(0,L.jsxs)(gp,{className:`gap-2`,children:[(0,L.jsxs)(l,{variant:`outline`,disabled:f.isPending||d>0,onClick:()=>p(`COMMENT`),children:[f.isPending?(0,L.jsx)(Ke,{}):null,`Comment`]}),o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(l,{disabled:f.isPending||d>0,onClick:()=>p(`APPROVE`),children:`Approve`}),(0,L.jsx)(l,{variant:`destructive`,disabled:f.isPending||d>0,onClick:()=>p(`REQUEST_CHANGES`),children:`Request changes`})]}):null]})]})})};function nh({...e}){return(0,L.jsx)(nc,{"data-slot":`alert-dialog`,...e})}function rh({...e}){return(0,L.jsx)(rc,{"data-slot":`alert-dialog-portal`,...e})}function ih({className:e,...t}){return(0,L.jsx)(ic,{"data-slot":`alert-dialog-overlay`,className:o(`fixed inset-0 z-50 bg-scrim duration-(--duration-fast) supports-backdrop-filter:backdrop-blur-xs low-power:backdrop-filter-none data-open:animate-in data-open:ease-(--ease-enter) data-open:fade-in-0 data-closed:animate-out data-closed:ease-(--ease-exit) data-closed:fade-out-0 motion-reduce:animate-none low-power:animate-none`,e),...t})}function ah({className:e,size:t=`default`,...n}){return(0,L.jsxs)(rh,{children:[(0,L.jsx)(ih,{}),(0,L.jsx)(ac,{"data-slot":`alert-dialog-content`,"data-size":t,className:o(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-surface border border-edge-overlay bg-card p-4 text-card-foreground shadow-2xl duration-(--duration-fast) outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:ease-(--ease-enter) data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:ease-(--ease-exit) data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none low-power:animate-none`,e),...n})]})}function oh({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:o(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function sh({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:o(`flex flex-col-reverse gap-2 pt-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function ch({className:e,...t}){return(0,L.jsx)(cc,{"data-slot":`alert-dialog-title`,className:o(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function lh({className:e,...t}){return(0,L.jsx)(lc,{"data-slot":`alert-dialog-description`,className:o(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function uh({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,L.jsx)(l,{variant:t,size:n,asChild:!0,children:(0,L.jsx)(oc,{"data-slot":`alert-dialog-action`,className:o(e),...r})})}function dh({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,L.jsx)(l,{variant:t,size:n,asChild:!0,children:(0,L.jsx)(sc,{"data-slot":`alert-dialog-cancel`,className:o(e),...r})})}var fh=({active:e,onNavigate:t})=>{let[n,r]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!e)return;let t=e=>{e.preventDefault(),e.returnValue=``},n=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target?.closest(`a`);t&&(!t.getAttribute(`href`)||t.target===`_blank`||t.hasAttribute(`download`)||t.origin!==window.location.origin||t.pathname===window.location.pathname&&t.search===window.location.search||(e.preventDefault(),e.stopPropagation(),r(t.pathname+t.search)))};return window.addEventListener(`beforeunload`,t),document.addEventListener(`click`,n,!0),()=>{window.removeEventListener(`beforeunload`,t),document.removeEventListener(`click`,n,!0)}},[e]),(0,L.jsx)(nh,{open:n!==null,onOpenChange:e=>{e||r(null)},children:(0,L.jsxs)(ah,{children:[(0,L.jsxs)(oh,{children:[(0,L.jsx)(ch,{children:`Submit your review?`}),(0,L.jsx)(lh,{children:`You have review comments that you haven't submitted yet. They stay as a draft on GitHub, but the author won't see them until you submit your review.`})]}),(0,L.jsxs)(sh,{children:[(0,L.jsx)(dh,{children:`Keep reviewing`}),(0,L.jsx)(uh,{onClick:()=>{let e=n;r(null),e&&t(e)},children:`Leave without submitting`})]})]})})},ph=({blockKeys:e,marked:t,viewed:n,changes:r})=>{let i=new Set(r.map(e=>e.key)),a=r.some(e=>!e.reviewed),o=n&&a?e.flatMap(e=>t.has(e)||i.has(e)?[]:[{key:e,reviewed:!0}]):[],s=[...r,...o].filter((e,n,r)=>t.has(e.key)!==e.reviewed&&r.findIndex(t=>t.key===e.key)===n),c=new Set(t);s.forEach(e=>e.reviewed?c.add(e.key):c.delete(e.key));let l=e.length>0&&e.every(e=>c.has(e));return{marks:s,file:n&&a?`unview`:!n&&l&&s.length>0?`view`:null}},mh=(e,t)=>{let[n,r]=Array.from(e).reduce(([e,t],n)=>{let r=n.codePointAt(0)??0;return[Math.imul(e^r,2654435761),Math.imul(t^r,1597334677)]},[3735928559^t,1103547991^t]),i=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909);return(4294967296*(2097151&(Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909)))+(i>>>0)).toString(36)},hh=({path:e,removed:t,added:n})=>{let r=[e,t.map(e=>e.trimEnd()).join(`
|
|
63
63
|
`),n.map(e=>e.trimEnd()).join(`
|
|
64
64
|
`)].join(`\0`);return`v1-${mh(r,0)}${mh(r,1)}`},gh=` `,_h=new Set([`{`,`}`,`;`,`,`,`>`,`)`]),vh=new Set([`+`,`~`]),yh=/\/\/[^\n]*/y,bh=/\/\*[\s\S]*?\*\//y,xh=(e,t,n)=>(e.lastIndex=n,e.exec(t)?.[0]??null),Sh=e=>/[\w\-.#%@!$&*\u0080-\uffff]/.test(e),Ch=(e,t,n)=>{let r={at:t+1};for(;r.at<e.length;){let t=e[r.at];if(t===`\\`)r.at+=2;else if(t===n)break;else if(t===`
|
|
65
65
|
`)return null;else r.at+=1}if(r.at>=e.length)return null;let i=e.slice(t+1,r.at).replace(/\\(.)/gsu,(e,t)=>t===`'`||t===`"`?t:e);return{end:r.at+1,token:`s:${i}`}},wh=(e,t)=>{let n=[],r={at:0};for(;r.at<e.length;){let i=e[r.at]??``,a=e[r.at+1]??``;if(/\s/.test(i))n.length>0&&n[n.length-1]!==gh&&n.push(gh),r.at+=1;else if(i===`/`&&a===`*`){let t=xh(bh,e,r.at);if(t===null)return null;n.push(`c:${t.replace(/\s+/g,` `)}`),r.at+=t.length}else if(t&&i===`/`&&a===`/`){let t=xh(yh,e,r.at)??``;n.push(`c:${t.trimEnd()}`),r.at+=t.length}else if(i===`'`||i===`"`){let t=Ch(e,r.at,i);if(!t)return null;n.push(t.token),r.at=t.end}else if(Sh(i)){let t=r.at;for(;r.at<e.length&&Sh(e[r.at]??``);)r.at+=1;n.push(`w:${e.slice(t,r.at)}`)}else n.push(i),r.at+=1}return n},Th=e=>e===`;`||e===`{`||e===`}`,Eh=e=>e.reduceRight((e,t,n)=>(e[n]=Th(t)?t:e[n+1],e),[]),Dh=(e,t)=>e.reduce((e,n,r)=>(Th(n)&&(e.seen=!1),n===`:`&&!e.seen&&t[r]!==`{`&&(e.seen=!0,e.colons.add(r)),e),{seen:!1,colons:new Set}).colons,Oh=e=>{let t=Eh(e),n=Dh(e,t),r={parens:0};return e.filter((i,a)=>{if(i===`(`&&(r.parens+=1),i===`)`&&(r.parens=Math.max(0,r.parens-1)),i!==gh)return!0;let o=e[a-1],s=e[a+1];return o===void 0||s===void 0||_h.has(o)||_h.has(s)||o===`(`||n.has(a-1)||n.has(a+1)?!1:!vh.has(o)&&!vh.has(s)||t[a]!==`{`||r.parens!==0})},kh=(e,t)=>{let n=wh(e,t);if(!n)return null;let r=Oh(n);return r.filter((e,t)=>e!==`;`||r[t+1]!==`}`)},Ah=/>>>=|\.\.\.|===|!==|\*\*=|<<=|>>=|>>>|\&\&=|\|\|=|\?\?=|=>|==|!=|<=|>=|\&\&|\|\||\?\?|\?\.|\+\+|\-\-|\+=|\-=|\*=|\/=|%=|\&=|\|=|\^=|\*\*|<<|>>/y,jh=/\/\/[^\n]*/y,Mh=/\/\*[\s\S]*?\*\//y,Nh=(e,t,n)=>(e.lastIndex=n,e.exec(t)?.[0]??null),Ph=new Set([`return`,`typeof`,`instanceof`,`in`,`of`,`new`,`delete`,`void`,`throw`,`case`,`do`,`else`,`yield`,`await`]),Fh=new Set([`if`,`for`,`while`,`with`]),Ih=new Set([`in`,`instanceof`,`of`,`as`,`satisfies`]),Lh=new Set([`}`]),Rh=e=>/[\w$\u0080-\uffff]/.test(e),zh=e=>e>=`0`&&e<=`9`,Bh=e=>e.split(`
|
|
@@ -72,4 +72,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
72
72
|
`))===null||i(r.new.join(`
|
|
73
73
|
`))===null)?!1:cg(i(t.join(`
|
|
74
74
|
`)),i(n.join(`
|
|
75
|
-
`)))},ug=/\+(\d+)/,dg=({path:e,rows:t})=>{let n=[],r={open:null,hunk:{old:[],new:[]},lastNewLine:0},i=()=>{let t=r.open;t&&(r.open=null,n.push({key:hh({path:e,removed:t.removed,added:t.added}),path:e,index:n.length,startRow:t.startRow,endRow:t.endRow,oldStart:t.oldStart,newStart:t.newStart,anchorLine:t.newStart??r.lastNewLine+1,removed:t.removed.length,added:t.added.length,formatOnly:lg({path:e,removed:t.removed,added:t.added,before:t.before})}),r.hunk.old.push(...t.removed),r.hunk.new.push(...t.added))};return t.forEach((e,t)=>{if(e.kind===`add`||e.kind===`delete`){let n=r.open??{startRow:t,endRow:t,oldStart:null,newStart:null,removed:[],added:[],before:{old:[...r.hunk.old],new:[...r.hunk.new]}};r.open=n,n.endRow=t,e.kind===`delete`?(n.oldStart??=e.oldLine,n.removed.push(e.content)):(n.newStart??=e.newLine,n.added.push(e.content),r.lastNewLine=e.newLine??r.lastNewLine)}else e.kind===`meta`&&r.open?r.open.endRow=t:(i(),e.kind===`hunk`&&(r.hunk={old:[],new:[]},r.lastNewLine=Number(ug.exec(e.content)?.[1]??1)-1),e.kind===`context`&&(r.hunk.old.push(e.content),r.hunk.new.push(e.content),r.lastNewLine=e.newLine??r.lastNewLine))}),i(),n},fg=({files:e})=>{let t=(0,I.useRef)(null);return t.current?.files!==e&&(t.current={files:e,byFile:new Map(e.map(e=>[e.filename,dg({path:e.filename,rows:Zp(e).rows})]))}),t.current.byFile},pg=[`review`,`block-marks`],mg=[],hg=({provider:e,files:t,session:n,onToggleViewed:r})=>{let i=fg({files:t}),a=_(),o=p({queryKey:pg,queryFn:()=>e?e.list():Promise.resolve(mg),enabled:!!e}),s=yt({mutationFn:t=>e?e.set(t):Promise.resolve(mg),onMutate:async e=>{await a.cancelQueries({queryKey:pg});let t=a.getQueryData(pg),n=new Date().toISOString();return a.setQueryData(pg,(t=mg)=>{let r=new Set(e.map(e=>e.key));return[...t.filter(e=>!r.has(e.key)),...e.flatMap(e=>e.reviewed?[{key:e.key,path:e.path,markedAt:n,headSha:``}]:[])]}),{previous:t}},onError:(e,t,n)=>{n?.previous&&a.setQueryData(pg,n.previous),P.error(e.message||`Couldn't save the reviewed mark.`)},onSuccess:e=>a.setQueryData(pg,e)}),c=new Set((o.data??mg).map(e=>e.key)),l=new Set(n?.viewedFiles),u=!!e,d=u&&o.isSuccess&&!!n?.id,f=e=>c.has(e.key)?`reviewed`:l.has(e.path)?`covered`:`unreviewed`,m=u?new Map([...i].map(([e,t])=>[e,{reviewed:t.filter(e=>f(e)!==`unreviewed`).length,total:t.length}])):null;return{blocksByFile:i,enabled:u,ready:d,loadError:o.isError,retry:()=>void o.refetch(),statusOf:f,progress:m,setReviewed:(e,t)=>{if(!d)return;let n=ph({blockKeys:(i.get(e)??[]).map(e=>e.key),marked:c,viewed:l.has(e),changes:t});n.marks.length>0&&s.mutate(n.marks.map(t=>({...t,path:e}))),n.file&&r(e,n.file===`view`)}}},gg=({owner:e,repo:t,pr:n,headSha:r,sessionId:i})=>{let a=N(),o=_(),s=$m(a,{repoFullName:`${e}/${t}`,prNumber:n,headSha:r}).queryKey,c=yt(a.github.reviewMarkFileViewed.mutationOptions({onMutate:async e=>{await o.cancelQueries({queryKey:s});let t=o.getQueryData(s);return o.setQueryData(s,t=>{if(!t)return t;let n=e.viewed?[...new Set([...t.viewedFiles,e.filename])]:t.viewedFiles.filter(t=>t!==e.filename);return{...t,viewedFiles:n}}),{previous:t}},onError:(e,t,n)=>{n?.previous&&o.setQueryData(s,n.previous),P.error(e.message??`Failed to mark file as viewed.`)},onSettled:()=>{o.invalidateQueries({queryKey:s})}}));return(e,t)=>{i&&c.mutate({sessionId:i,filename:e,viewed:t})}},_g=(e,t)=>{let n=e.items.find(e=>e.kind===`thread`&&e.threadId===t);return n?.kind!==`thread`||n.isResolved?e:{...e,unresolvedCount:Math.max(0,e.unresolvedCount-1),items:e.items.map(e=>e.kind===`thread`&&e.threadId===t?{...e,isResolved:!0}:e)}},vg=({owner:e,repo:t,pr:n})=>{let r=N(),i=_(),a=Ym(r,{owner:e,repo:t,pr:n}).queryKey,[o,s]=(0,I.useReducer)((e,t)=>t,null),c=yt(r.github.reviewResolveThread.mutationOptions({onMutate:async e=>{s(e.threadId),await i.cancelQueries({queryKey:a});let t=i.getQueryData(a);return i.setQueryData(a,t=>t&&_g(t,e.threadId)),{previous:t}},onError:(e,t,n)=>{n?.previous&&i.setQueryData(a,n.previous),P.error(e.message??`Failed to resolve review thread.`)},onSuccess:()=>{P.success(`Review thread resolved.`)},onSettled:()=>{s(null),i.invalidateQueries({queryKey:a})}}));return{resolvingThreadId:o,resolveThread:e=>c.mutate({threadId:e})}},yg=e=>{let t=new Set;return e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))},bg=e=>({group:`PR`,label:`PR #${e.prNumber}`,searchText:`${e.title} ${e.body??``}`,item:{kind:`pr-description`,id:`pr-description:${e.prNumber}`,prNumber:e.prNumber,title:e.title,body:e.body??null}}),xg=e=>({group:`Files`,label:e.filename,detail:e.status??`modified`,searchText:[e.filename,e.status].filter(Boolean).join(` `),item:{kind:`file`,id:`file:${e.filename}`,path:e.filename,status:e.status}}),Sg=e=>({group:`Comments`,label:`${e.kind}: ${e.commentId}`,searchText:`${e.author} ${e.body} ${e.path??``} ${e.line??``}`,item:{kind:e.kind,id:`${e.kind}:${e.commentId}`,commentId:e.commentId,author:e.author,body:e.body,path:e.path,line:e.line}}),Cg=e=>({group:`Checks`,label:e.name,detail:e.conclusion??e.status,searchText:`${e.name} ${e.status} ${e.conclusion??``} ${e.url??``}`,item:{kind:`check`,id:`check:${e.id}`,checkId:e.id,name:e.name,status:e.status,conclusion:e.conclusion,url:e.url}}),wg=e=>({group:`Symbols`,label:e.name,searchText:`${e.path} ${e.name} ${e.symbolKind} ${e.signature}`,item:{kind:`symbol`,id:`symbol:${e.path}:${e.name}:${e.line}`,path:e.path,name:e.name,symbolKind:e.symbolKind,line:e.line,signature:e.signature}}),Tg=e=>{let{pr:t,comments:n,checks:r,symbols:i}=e;return[bg(t),...t.files.map(xg),...(n??[]).map(Sg),...(r??[]).map(Cg),...(i??[]).map(wg)]},Eg=(e,t)=>e.github.reviewGetChangedFileSymbols.queryOptions(t,{staleTime:1/0}),Dg=(e,t)=>e.github.reviewGetChecks.queryOptions(t),Og=(e,t)=>e.github.reviewGetComments.queryOptions(t),kg=(e,t)=>e?t.isPending?`pending`:t.isError?`error`:`success`:`idle`,Ag=({owner:e,repo:t,pr:n,prMeta:r,prData:i})=>{let a=N(),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)([]),u=p({...Og(a,{owner:e,repo:t,pr:n}),enabled:o&&!!i}),d=p({...Dg(a,{owner:e,repo:t,headSha:r?.headSha??``}),enabled:o&&!!r?.headSha}),f=p({...Eg(a,{owner:e,repo:t,pr:n,headSha:r?.headSha??``}),enabled:o&&!!r?.headSha});return{contextItems:c,contextCandidates:i&&r?Tg({pr:{prNumber:n,title:r.title,body:r.body,files:i.files},comments:u.data??[],checks:d.data??[],symbols:f.data??[]}):[],contextGroups:{comments:kg(o,u),checks:kg(o,d),symbols:kg(o,f)},addContextItem:e=>l(t=>yg([...t,e])),removeContextItem:e=>l(t=>t.filter(t=>t.id!==e)),clearContextItems:()=>l([]),onContextIntent:()=>s(!0)}},jg=new Set([`clean`,`unstable`,`has_hooks`]),Mg=(e,t)=>!t||e.merged||e.state!==`open`||e.draft||e.mergeable!==!0?!1:jg.has(e.mergeableState),Ng=(e,t)=>e.github.repoMergeMethods.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),Pg=(e,t)=>e.github.reviewGetViewerPermissions.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),Fg=({owner:e,repo:t,pr:n,prMeta:r,enabled:i})=>{let a=N(),o=_(),s=p({...Ng(a,{owner:e,repo:t}),enabled:i}),c=p({...Pg(a,{owner:e,repo:t,pr:n}),enabled:i}),l=c.data?.canPush??!1,u=c.data?!c.data.didAuthor:!1;return{merge:{owner:e,repo:t,pr:n,canMerge:r?Mg(r,l):!1,allowedMethods:s.data,methodsLoading:s.isPending,onMerged:()=>{o.invalidateQueries({queryKey:Zm(a,{owner:e,repo:t,pr:n}).queryKey}),r&&o.invalidateQueries({queryKey:Xm(a,{owner:e,repo:t,pr:n,headSha:r.headSha,baseRef:r.baseRef}).queryKey})}},canApprove:u}},Ig=({sidePanel:e})=>(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 grow basis-0 flex-col`,children:[(0,L.jsx)(`div`,{className:`border-edge bg-background flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:(0,L.jsx)(j,{className:`h-4 w-48`})}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`border-edge w-3/20 border-r`,children:(0,L.jsx)(Vm,{})}),(0,L.jsx)(`div`,{className:`flex-1`,children:(0,L.jsx)(cp,{})}),(0,L.jsx)(`div`,{className:`border-edge w-3/10 border-l`,children:e})]})]}),Lg=({owner:e,repo:t,ref:n,path:r,line:i})=>`${sp(e,t)}/blob/${encodeURIComponent(n)}/${r.split(`/`).map(encodeURIComponent).join(`/`)}${i===null?``:`#L${i}`}`,Rg={empty:{entries:[],index:-1},record:(e,t,n)=>{let r=e.entries.slice(0,e.index+1),i=r.at(-1),a=t?i?.filename===t.filename?[...r.slice(0,-1),t]:[...r,t]:r,o=a.at(-1),s=(o?.filename===n.filename&&o.line===n.line?a:[...a,n]).slice(-50);return{entries:s,index:s.length-1}},step:(e,t,n)=>{let r=e.index+(t===`back`?-1:1),i=e.entries[r];if(!i)return null;let a=e.entries[e.index];return{history:{entries:n&&a?.filename===n.filename?e.entries.map((t,r)=>r===e.index?n:t):e.entries,index:r},target:i}}},zg=(e,t,n,r)=>({...e,...r?{exploredFiles:[...e.exploredFiles.filter(e=>e!==t),t].slice(-8),userMode:`classic`}:{},activeFile:t,prewarmFile:t,navigation:{nonce:e.navigation.nonce+1,line:n===null?null:{filename:t,line:n}}}),Bg=(e,t)=>{switch(t.type){case`selectFile`:return{...zg(e,t.filename,t.line,t.explore),history:Rg.record(e.history,e.activeFile?{filename:e.activeFile,line:t.fromLine}:null,{filename:t.filename,line:t.line})};case`stepHistory`:{let n=t.history.entries[t.history.index];return n?{...zg(e,n.filename,n.line,t.explore),history:t.history}:e}case`changeViewMode`:return{...e,userMode:t.mode,navigation:{...e.navigation,line:null}};case`selectDescription`:return{...e,activeFile:null,prewarmFile:null};case`prewarmFile`:return{...e,prewarmFile:t.filename};case`closeExplored`:return{...e,exploredFiles:e.exploredFiles.filter(e=>e!==t.filename),...e.activeFile===t.filename?{activeFile:null,prewarmFile:null}:{}};case`setActiveBeat`:return{...e,activeBeatId:t.beatId};case`expandStoryFile`:return{...e,expandedStoryFile:t.filename,activeBeatId:null};case`showClassic`:return{...e,userMode:`classic`}}},Vg=(e,t)=>{if(e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){if(e.key===`ArrowLeft`)return`back`;if(e.key===`ArrowRight`)return`forward`}return t&&e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.code===`Minus`||e.key===`-`||e.key===`_`)?e.shiftKey?`forward`:`back`:null},Hg=[`INPUT`,`TEXTAREA`,`SELECT`],Ug=e=>{let t=(0,I.useRef)(e);(0,I.useEffect)(()=>{t.current=e}),(0,I.useEffect)(()=>{let e=e=>{if(e.target instanceof HTMLElement&&(e.target.isContentEditable||Hg.includes(e.target.tagName)))return;let n=Vg(e,/Mac|iPhone|iPad/.test(navigator.userAgent));n&&t.current(n)&&e.preventDefault()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])},Wg=({owner:e,repo:t,pr:n,prMeta:r,prData:i})=>{let a=N(),o=_(),[s,c]=(0,I.useReducer)(Bg,{activeFile:null,exploredFiles:[],navigation:{nonce:0,line:null},prewarmFile:null,userMode:null,activeBeatId:null,expandedStoryFile:null,history:Rg.empty}),u=(0,I.useRef)(null),d=e=>!i||i.files.some(t=>t.filename===e),f=(n,i,a)=>{let o=d(n);!o&&!r?P.error(`${n} isn't part of this pull request.`,{action:(0,L.jsx)(l,{asChild:!0,size:`sm`,variant:`secondary`,children:(0,L.jsx)(Ki,{href:Lg({owner:e,repo:t,ref:`HEAD`,path:n,line:i??null}),children:`Open on GitHub`})})}):c({type:`selectFile`,filename:n,line:i??null,fromLine:a??u.current?.centerLine()??null,explore:!o})},p=e=>{let t=Rg.step(s.history,e,s.activeFile?{filename:s.activeFile,line:u.current?.centerLine()??null}:null);return t?(c({type:`stepHistory`,history:t.history,explore:!d(t.target.filename)}),!0):!1};return Ug(p),{state:s,viewport:u,history:{canGoBack:s.history.index>0,canGoForward:s.history.index<s.history.entries.length-1,onBack:()=>p(`back`),onForward:()=>p(`forward`)},handlers:{selectFile:f,prewarmFile:s=>{c({type:`prewarmFile`,filename:s});let l=r?.headSha,u=i?.files.find(e=>e.filename===s);l&&Pp(u??null)&&o.prefetchQuery(Lp(a,{owner:e,repo:t,pr:n,headSha:l,path:s}))},changeViewMode:e=>c({type:`changeViewMode`,mode:e}),selectDescription:()=>c({type:`selectDescription`}),closeExplored:e=>c({type:`closeExplored`,filename:e}),expandStoryFile:e=>{c({type:`expandStoryFile`,filename:e}),f(e),c({type:`showClassic`})},setActiveBeat:e=>c({type:`setActiveBeat`,beatId:e})}}},Gg=()=>({storyQuery:{data:null,isPending:!1,isError:!1},storyGenerating:!1,storyOutline:[],retryStory:()=>void 0}),Kg=[],qg=({owner:e,repo:t,pr:n,isError:r})=>(0,L.jsx)(`div`,{className:`border-edge bg-background flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,L.jsx)(`h1`,{className:`truncate text-sm font-semibold`,children:r?`Couldn't load pull request`:`Loading...`}),(0,L.jsxs)(`span`,{className:`text-muted-foreground shrink-0 text-xs`,children:[e,`/`,t,`#`,n]})]})}),Jg=({owner:e,repo:t,pr:n,prMeta:r,metadata:i,conversation:a,previewUrl:o,metadataLoading:s,storyAvailable:c,viewMode:l,merge:u,onViewModeChange:d,onReviewChanges:f})=>r?(0,L.jsx)(Kf,{owner:e,repo:t,pr:n,title:r.title,state:r.merged?`merged`:r.state===`closed`?`closed`:r.draft?`draft`:`open`,author:r.author,headRef:r.headRef,baseRef:r.baseRef,changedFiles:r.changedFiles,additions:r.additions,deletions:r.deletions,updatedAt:r.updatedAt,previewUrl:o,baseRepoFullName:r.baseRepoFullName,headRepoFullName:r.headRepoFullName,metadata:i,conversation:a,metadataLoading:s,storyAvailable:c,viewMode:l,merge:u,onViewModeChange:d,onReviewChanges:f}):(0,L.jsx)(qg,{owner:e,repo:t,pr:n,isError:!1}),Yg=({owner:e,repo:t,pr:n,orgId:r,renderSidePanel:i,onNavigate:a,codeIntel:o=null,blockMarks:s=null,inlineAsk:c=null})=>{let l=N(),u=_(),[d,f]=(0,I.useReducer)((e,t)=>t,!1),m=p(Zm(l,{owner:e,repo:t,pr:n})),h=p({...Qm(l,{owner:e,repo:t,pr:n}),enabled:!!m.data}),{state:{activeFile:g,exploredFiles:v,navigation:y,prewarmFile:b,userMode:x,activeBeatId:S,expandedStoryFile:C},handlers:w,history:T,viewport:ee}=Wg({owner:e,repo:t,pr:n,prMeta:m.data,prData:h.data}),te=p({...$m(l,{repoFullName:`${e}/${t}`,prNumber:n,headSha:m.data?.headSha??``}),enabled:!!m.data?.headSha}),ne=p({...eh(l,{repoFullName:`${e}/${t}`,headRef:m.data?.headRef??``}),enabled:!!m.data?.headRef}),re=(ne.data?.length??0)>0,ie=x??(re?`story`:`classic`),{storyQuery:ae,storyGenerating:oe,storyOutline:E,retryStory:D}=Gg({owner:e,repo:t,pr:n,orgId:r,prMeta:m.data,viewMode:ie}),se=p({...Xm(l,{owner:e,repo:t,pr:n,headSha:m.data?.headSha??``,baseRef:m.data?.baseRef??``}),enabled:!!m.data?.headSha&&!!m.data?.baseRef}),O=p({...Ym(l,{owner:e,repo:t,pr:n}),enabled:!!m.data}),{merge:k,canApprove:ce}=Fg({owner:e,repo:t,pr:n,prMeta:m.data,enabled:!!m.data}),le=Ym(l,{owner:e,repo:t,pr:n}).queryKey,A=gg({owner:e,repo:t,pr:n,headSha:m.data?.headSha??``,sessionId:te.data?.id}),ue=hg({provider:s,files:h.data?.files??Kg,session:te.data,onToggleViewed:A}),{resolvingThreadId:de,resolveThread:j}=vg({owner:e,repo:t,pr:n}),fe=Ag({owner:e,repo:t,pr:n,prMeta:m.data,prData:h.data}),pe=`https://github.com/${e}/${t}/pull/${n}`,me=Ui(O.data),he=i({prMeta:m,prAuthorEmail:h.data?.author.email??null,linkedConversations:ne.data??[],sourcesLoading:ne.isPending,context:fe,storyOutline:E,activeBeatId:S});return m.isPending?(0,L.jsx)(Ig,{sidePanel:he}):(0,L.jsx)(Gi,{value:o,children:(0,L.jsx)(Wi,{value:c,children:(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 grow basis-0 flex-col`,children:[m.isError?(0,L.jsx)(qg,{owner:e,repo:t,pr:n,isError:m.isError}):(0,L.jsx)(Jg,{owner:e,repo:t,pr:n,prMeta:m.data,metadata:se.data,conversation:O.data,previewUrl:se.data?.previewUrl??null,metadataLoading:se.isPending,storyAvailable:re,viewMode:ie,merge:k,onViewModeChange:w.changeViewMode,onReviewChanges:()=>f(!0)}),(0,L.jsxs)(Ii,{orientation:`horizontal`,id:`glen-review-layout`,className:`min-h-0 flex-1`,children:[ie===`classic`?(0,L.jsx)(Jm,{prData:h,exploredFiles:v,viewedFiles:te.data?.viewedFiles??[],viewedReady:!!te.data?.id,onToggleViewed:A,blockProgress:ue.progress,onSelectDescription:w.selectDescription,onSelectFile:w.selectFile,onCloseExplored:w.closeExplored,onPrewarmFile:w.prewarmFile,activeFile:g}):null,(0,L.jsx)(Gm,{name:`center`,defaultSize:55,minSize:30,children:(0,L.jsx)(Dm,{owner:e,repo:t,pr:n,headSha:m.data?.headSha??``,prBody:m.data?.body??null,prLoading:h.isPending,prError:h.isError,files:h.data?.files,activeFile:g,exploredFiles:v,onCloseExplored:w.closeExplored,scrollNonce:y.nonce,lineTarget:y.line?{...y.line,nonce:y.nonce}:null,expandedStoryFile:C,prewarmFile:b,githubPrUrl:pe,conversation:O.data,conversationLoading:O.isPending,conversationError:O.isError,resolvingThreadId:de,viewMode:ie,story:ae.data,storyPending:ae.isPending,storyError:ae.isError,storyGenerating:oe,onRetryStory:D,onActiveBeatChange:w.setActiveBeat,onAddContextItem:fe.addContextItem,onRetryPr:()=>void h.refetch(),onRetryConversation:()=>void O.refetch(),onResolveThread:j,onSelectFile:w.selectFile,onExpandStoryFile:w.expandStoryFile,blockMarks:ue,history:T,viewportRef:ee,onFileCommented:()=>void u.invalidateQueries({queryKey:le})})}),(0,L.jsx)(qm,{}),(0,L.jsx)(Gm,{name:`side`,defaultSize:30,minSize:20,collapsible:!0,children:he})]}),(0,L.jsx)(th,{owner:e,repo:t,pr:n,open:d,onOpenChange:f,onSubmitted:()=>void u.invalidateQueries({queryKey:le}),canApprove:ce}),(0,L.jsx)(fh,{active:me,onNavigate:a})]})})})},Xg={list:()=>Qe.local.blockMarks.list.query(),set:e=>Qe.local.blockMarks.set.mutate(e)},Zg={chats:null,lines:[],focus:null,collapsed:new Set,connection:null,listeners:new Set,epoch:F.getSnapshot().epoch},Qg=()=>Zg.listeners.forEach(e=>e()),$g=e=>e.flatMap(e=>e.placement.kind===`line`?[{id:e.id,path:e.placement.path,line:e.placement.line,side:e.placement.side}]:[]),e_=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.path===t[n].path&&e.line===t[n].line&&e.side===t[n].side),t_=()=>Qe.local.agent.chats.subscribe(void 0,{onData:e=>{let t=$g(e).reverse();Zg.chats=e,e_(Zg.lines,t)||(Zg.lines=t),Qg()},onConnectionStateChange:e=>{e.state===`connecting`&&e.error&&F.check()},onError:e=>void F.check().then(t=>{t&&P.error(e.message)})});F.subscribe(()=>{let{epoch:e}=F.getSnapshot();e!==Zg.epoch&&(Zg.epoch=e,Zg.connection&&(Zg.connection.unsubscribe(),Zg.chats=null,Zg.lines=[],Zg.connection=t_(),Qg()))});var n_={getSnapshot:()=>Zg.chats,getLineChats:()=>Zg.lines,getFocus:()=>Zg.focus,focus:e=>{Zg.focus=e,Qg()},getCollapsed:()=>Zg.collapsed,toggleCollapsed:e=>{let t=new Set(Zg.collapsed);t.delete(e)||t.add(e),Zg.collapsed=t,Qg()},subscribe:e=>(Zg.listeners.add(e),Zg.connection??=t_(),()=>{Zg.listeners.delete(e)})},r_=(e,t)=>e.find(e=>e.id===t)??e.find(e=>e.available)??e[0],i_={view:{tab:`agent`,chatId:null,terminalOpened:!1,signIn:null},listeners:new Set},a_=e=>{i_.view={...i_.view,...e,terminalOpened:i_.view.terminalOpened||e.tab===`terminal`},i_.listeners.forEach(e=>e())},o_={getSnapshot:()=>i_.view,subscribe:e=>(i_.listeners.add(e),()=>i_.listeners.delete(e)),showTab:e=>a_({tab:e}),showChat:e=>a_({tab:`agent`,chatId:e}),signIn:(e,t,n)=>a_({tab:`terminal`,signIn:{agent:e,label:t,chatId:n,run:(i_.view.signIn?.run??0)+1}}),clearSignIn:()=>a_({signIn:null})},s_=e=>void Qe.local.agent.list.query().then(t=>{let n=n_.getSnapshot()?.find(e=>e.id===o_.getSnapshot().chatId),r=r_(t,n?.agent??null);if(r)return Qe.local.agent.create.mutate({agent:r.id,placement:{kind:`line`,...e}}).then(e=>n_.focus(e.id))}).catch(e=>P.error(e.message)),c_=e=>/^[\w./~-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,l_=(e,t,n)=>e===null?`glen review ${t}`:n?`cd '${e.replaceAll(`'`,`''`)}'; glen review ${t}`:`cd ${c_(e)} && glen review ${t}`,u_=({command:e})=>{let[t,n]=(0,I.useState)(!1);return(0,L.jsxs)(`div`,{className:`bg-muted flex items-center gap-2 rounded-md py-1 pr-1 pl-3`,children:[(0,L.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-sm break-all`,children:e}),(0,L.jsxs)(l,{size:`sm`,variant:`ghost`,"aria-label":`Copy the restart command`,onClick:()=>void navigator.clipboard.writeText(e).then(()=>n(!0),()=>P.error(`Couldn't copy. Select the command instead.`)),children:[t?(0,L.jsx)(fn,{}):(0,L.jsx)(yn,{}),t?`Copied`:`Copy`]})]})},d_=({newHead:e})=>{let t=yt({mutationFn:async()=>{e.needsReload&&await Qe.local.pr.reload.mutate()},onSuccess:()=>location.reload(),onError:e=>P.error(e.message)});return(0,L.jsx)(`div`,{className:`fixed inset-x-0 top-3 z-50 flex justify-center px-4`,children:(0,L.jsxs)(nt,{className:`flex-row items-center gap-3 px-4 py-2 shadow-lg`,children:[(0,L.jsxs)(`span`,{className:`text-sm`,children:[`New commits on this PR. Reload to review`,` `,(0,L.jsx)(`code`,{className:`font-mono`,children:e.sha.slice(0,7)}),`.`]}),(0,L.jsxs)(l,{size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(),children:[t.isPending?(0,L.jsx)(Ke,{}):(0,L.jsx)(ct,{}),`Reload`]})]})})},f_=({pr:e})=>{let t=(0,I.useSyncExternalStore)(F.subscribe,F.getSnapshot);if(t.status===`connected`)return t.newHead?(0,L.jsx)(d_,{newHead:t.newHead}):null;let n=l_(t.info?.repoRoot??null,e,navigator.userAgent.includes(`Windows`));return(0,L.jsx)(`div`,{className:`bg-background/70 fixed inset-0 z-50 flex items-start justify-center px-4 pt-24`,children:(0,L.jsxs)(nt,{className:`w-full max-w-lg shadow-lg`,children:[(0,L.jsxs)(Je,{children:[(0,L.jsxs)(He,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Rn,{}),`The reviewer for #`,e,` stopped`]}),(0,L.jsx)(et,{children:t.status===`signed-out`?`It's back, but it didn't accept this browser. Open the sign-in link it printed in your terminal.`:`Start it again from the repo:`})]}),t.status===`disconnected`?(0,L.jsxs)(Ze,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(u_,{command:n}),(0,L.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,L.jsx)(Ke,{}),`Reconnecting automatically when it's back.`]})]}):null]})})},p_={status:()=>Qe.local.codeIntel.status.query(),hover:e=>Qe.local.codeIntel.hover.query(e),definition:e=>Qe.local.codeIntel.definition.query(e),references:e=>Qe.local.codeIntel.references.query(e)},m_=()=>(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`border-edge flex items-center gap-2 border-b p-2`,children:[(0,L.jsx)(j,{className:`h-7 w-40`}),(0,L.jsx)(j,{className:`ml-auto h-7 w-24`})]}),(0,L.jsx)(`div`,{className:`flex-1`}),(0,L.jsx)(`div`,{className:`border-edge border-t p-2`,children:(0,L.jsx)(j,{className:`h-16 w-full`})})]}),h_=()=>(0,L.jsx)(`div`,{className:`border-edge bg-background border-b p-3`,children:(0,L.jsxs)(`div`,{className:`border-edge max-w-3xl rounded-md border`,children:[(0,L.jsx)(`div`,{className:`border-edge flex items-center gap-2 border-b px-3 py-1.5`,children:(0,L.jsx)(j,{className:`h-4 w-48`})}),(0,L.jsx)(`div`,{className:`p-2`,children:(0,L.jsx)(j,{className:`h-10 w-full`})})]})}),g_=60,__=e=>{let t=N(),n=p(Zm(t,e));if(!n.data)return null;let r=n.data.title.length>g_?`${n.data.title.slice(0,59).trimEnd()}…`:n.data.title;return(0,L.jsx)(`title`,{children:`#${e.pr} · ${r} · glen review`})},v_=(0,I.lazy)(()=>ut(()=>import(`./local-side-panel-YozB4kaM.js`).then(e=>({default:e.LocalSidePanel})),__vite__mapDeps([19,1,6,7,8,9,10,11,12,2,13,14,20,16]))),y_=(0,I.lazy)(()=>ut(()=>import(`./inline-ask-BADMnkfU.js`).then(e=>({default:e.InlineAsk})),__vite__mapDeps([21,1,6,7,8,10,11,12,2,17,20,14]))),b_=/^\/([^/]+)\/([^/]+)\/pull\/(\d+)/.exec(location.pathname),x_=Qn(),S_=h({links:[b({transformer:Re,url:`${location.origin}/api/trpc`,fetch:F.fetch})]});F.attach({queryClient:x_,readInfo:()=>Qe.local.server.info.query(),readLatestHead:()=>Qe.local.pr.latestHead.query()});var C_=document.getElementById(`root`);C_&&(0,Ct.createRoot)(C_).render((0,L.jsxs)(Rt,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,children:[(0,L.jsx)(w,{client:x_,children:(0,L.jsx)(Le,{trpcClient:S_,queryClient:x_,children:b_?.[1]&&b_[2]&&b_[3]?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(f_,{pr:Number(b_[3])}),(0,L.jsx)(__,{owner:b_[1],repo:b_[2],pr:Number(b_[3])}),(0,L.jsx)(Yg,{owner:b_[1],repo:b_[2],pr:Number(b_[3]),orgId:`local`,onNavigate:e=>location.assign(e),codeIntel:p_,blockMarks:Xg,inlineAsk:{start:s_,subscribe:n_.subscribe,getLineChats:n_.getLineChats,render:e=>(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(h_,{}),children:(0,L.jsx)(y_,{chatId:e})})},renderSidePanel:({context:e})=>(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(m_,{}),children:(0,L.jsx)(v_,{context:e})})})]}):(0,L.jsx)(`div`,{className:`flex w-full items-center justify-center`,children:(0,L.jsx)(Be,{title:`Open the review link`,description:`Use the URL that glen review printed in your terminal: it names the pull request to show.`})})})}),(0,L.jsx)(Un,{richColors:!0,position:`bottom-center`,style:{"--width":`min(32rem, 38vw)`,"--success-bg":`var(--overlay-fill)`,"--success-text":`var(--popover-foreground)`,"--success-border":`var(--edge-overlay)`,"--info-bg":`var(--overlay-fill)`,"--info-text":`var(--popover-foreground)`,"--info-border":`var(--edge-overlay)`,"--warning-bg":`var(--overlay-fill)`,"--warning-text":`var(--popover-foreground)`,"--warning-border":`var(--edge-overlay)`,"--error-bg":`var(--overlay-fill)`,"--error-text":`var(--destructive)`,"--error-border":`var(--destructive)`}})]}));export{mu as $,Xf as A,Of as B,vp as C,hn as Ct,ip as D,cn as Dt,up as E,ln as Et,Sf as F,rf as G,mf as H,Ef as I,gu as J,nf as K,wf as L,yf as M,Cf as N,rp as O,sn as Ot,xf as P,uu as Q,Tf as R,mp as S,vn as St,_p as T,un as Tt,pf as U,bf as V,tf as W,su as X,du as Y,cu as Z,wp as _,Vn as _t,n_ as a,hu as at,yp as b,Mn as bt,Wm as c,vu as ct,Om as d,Es as dt,lu as et,Zp as f,Ts as ft,Sp as g,Wi as gt,Np as h,Gi as ht,r_ as i,iu as it,Jf as j,np as k,yt as kt,Hm as l,nl as lt,Pp as m,Ki as mt,m_ as n,fu as nt,Lg as o,_u as ot,Hp as p,Cs as pt,au as q,o_ as r,pu as rt,Eg as s,yu as st,h_ as t,ou as tt,Mm as u,Ds as ut,Cp as v,zn as vt,hp as w,fn as wt,dp as x,kn as xt,xp as y,Fn as yt,Df as z};
|
|
75
|
+
`)))},ug=/\+(\d+)/,dg=({path:e,rows:t})=>{let n=[],r={open:null,hunk:{old:[],new:[]},lastNewLine:0},i=()=>{let t=r.open;t&&(r.open=null,n.push({key:hh({path:e,removed:t.removed,added:t.added}),path:e,index:n.length,startRow:t.startRow,endRow:t.endRow,oldStart:t.oldStart,newStart:t.newStart,anchorLine:t.newStart??r.lastNewLine+1,removed:t.removed.length,added:t.added.length,formatOnly:lg({path:e,removed:t.removed,added:t.added,before:t.before})}),r.hunk.old.push(...t.removed),r.hunk.new.push(...t.added))};return t.forEach((e,t)=>{if(e.kind===`add`||e.kind===`delete`){let n=r.open??{startRow:t,endRow:t,oldStart:null,newStart:null,removed:[],added:[],before:{old:[...r.hunk.old],new:[...r.hunk.new]}};r.open=n,n.endRow=t,e.kind===`delete`?(n.oldStart??=e.oldLine,n.removed.push(e.content)):(n.newStart??=e.newLine,n.added.push(e.content),r.lastNewLine=e.newLine??r.lastNewLine)}else e.kind===`meta`&&r.open?r.open.endRow=t:(i(),e.kind===`hunk`&&(r.hunk={old:[],new:[]},r.lastNewLine=Number(ug.exec(e.content)?.[1]??1)-1),e.kind===`context`&&(r.hunk.old.push(e.content),r.hunk.new.push(e.content),r.lastNewLine=e.newLine??r.lastNewLine))}),i(),n},fg=({files:e})=>{let t=(0,I.useRef)(null);return t.current?.files!==e&&(t.current={files:e,byFile:new Map(e.map(e=>[e.filename,dg({path:e.filename,rows:Zp(e).rows})]))}),t.current.byFile},pg=[`review`,`block-marks`],mg=[],hg=({provider:e,files:t,session:n,onToggleViewed:r})=>{let i=fg({files:t}),a=_(),o=p({queryKey:pg,queryFn:()=>e?e.list():Promise.resolve(mg),enabled:!!e}),s=yt({mutationFn:t=>e?e.set(t):Promise.resolve(mg),onMutate:async e=>{await a.cancelQueries({queryKey:pg});let t=a.getQueryData(pg),n=new Date().toISOString();return a.setQueryData(pg,(t=mg)=>{let r=new Set(e.map(e=>e.key));return[...t.filter(e=>!r.has(e.key)),...e.flatMap(e=>e.reviewed?[{key:e.key,path:e.path,markedAt:n,headSha:``}]:[])]}),{previous:t}},onError:(e,t,n)=>{n?.previous&&a.setQueryData(pg,n.previous),P.error(e.message||`Couldn't save the reviewed mark.`)},onSuccess:e=>a.setQueryData(pg,e)}),c=new Set((o.data??mg).map(e=>e.key)),l=new Set(n?.viewedFiles),u=!!e,d=u&&o.isSuccess&&!!n?.id,f=e=>c.has(e.key)?`reviewed`:l.has(e.path)?`covered`:`unreviewed`,m=u?new Map([...i].map(([e,t])=>[e,{reviewed:t.filter(e=>f(e)!==`unreviewed`).length,total:t.length}])):null;return{blocksByFile:i,enabled:u,ready:d,loadError:o.isError,retry:()=>void o.refetch(),statusOf:f,progress:m,setReviewed:(e,t)=>{if(!d)return;let n=ph({blockKeys:(i.get(e)??[]).map(e=>e.key),marked:c,viewed:l.has(e),changes:t});n.marks.length>0&&s.mutate(n.marks.map(t=>({...t,path:e}))),n.file&&r(e,n.file===`view`)}}},gg=({owner:e,repo:t,pr:n,headSha:r,sessionId:i})=>{let a=N(),o=_(),s=$m(a,{repoFullName:`${e}/${t}`,prNumber:n,headSha:r}).queryKey,c=yt(a.github.reviewMarkFileViewed.mutationOptions({onMutate:async e=>{await o.cancelQueries({queryKey:s});let t=o.getQueryData(s);return o.setQueryData(s,t=>{if(!t)return t;let n=e.viewed?[...new Set([...t.viewedFiles,e.filename])]:t.viewedFiles.filter(t=>t!==e.filename);return{...t,viewedFiles:n}}),{previous:t}},onError:(e,t,n)=>{n?.previous&&o.setQueryData(s,n.previous),P.error(e.message??`Failed to mark file as viewed.`)},onSettled:()=>{o.invalidateQueries({queryKey:s})}}));return(e,t)=>{i&&c.mutate({sessionId:i,filename:e,viewed:t})}},_g=(e,t)=>{let n=e.items.find(e=>e.kind===`thread`&&e.threadId===t);return n?.kind!==`thread`||n.isResolved?e:{...e,unresolvedCount:Math.max(0,e.unresolvedCount-1),items:e.items.map(e=>e.kind===`thread`&&e.threadId===t?{...e,isResolved:!0}:e)}},vg=({owner:e,repo:t,pr:n})=>{let r=N(),i=_(),a=Ym(r,{owner:e,repo:t,pr:n}).queryKey,[o,s]=(0,I.useReducer)((e,t)=>t,null),c=yt(r.github.reviewResolveThread.mutationOptions({onMutate:async e=>{s(e.threadId),await i.cancelQueries({queryKey:a});let t=i.getQueryData(a);return i.setQueryData(a,t=>t&&_g(t,e.threadId)),{previous:t}},onError:(e,t,n)=>{n?.previous&&i.setQueryData(a,n.previous),P.error(e.message??`Failed to resolve review thread.`)},onSuccess:()=>{P.success(`Review thread resolved.`)},onSettled:()=>{s(null),i.invalidateQueries({queryKey:a})}}));return{resolvingThreadId:o,resolveThread:e=>c.mutate({threadId:e})}},yg=e=>{let t=new Set;return e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))},bg=e=>({group:`PR`,label:`PR #${e.prNumber}`,searchText:`${e.title} ${e.body??``}`,item:{kind:`pr-description`,id:`pr-description:${e.prNumber}`,prNumber:e.prNumber,title:e.title,body:e.body??null}}),xg=e=>({group:`Files`,label:e.filename,detail:e.status??`modified`,searchText:[e.filename,e.status].filter(Boolean).join(` `),item:{kind:`file`,id:`file:${e.filename}`,path:e.filename,status:e.status}}),Sg=e=>({group:`Comments`,label:`${e.kind}: ${e.commentId}`,searchText:`${e.author} ${e.body} ${e.path??``} ${e.line??``}`,item:{kind:e.kind,id:`${e.kind}:${e.commentId}`,commentId:e.commentId,author:e.author,body:e.body,path:e.path,line:e.line}}),Cg=e=>({group:`Checks`,label:e.name,detail:e.conclusion??e.status,searchText:`${e.name} ${e.status} ${e.conclusion??``} ${e.url??``}`,item:{kind:`check`,id:`check:${e.id}`,checkId:e.id,name:e.name,status:e.status,conclusion:e.conclusion,url:e.url}}),wg=e=>({group:`Symbols`,label:e.name,searchText:`${e.path} ${e.name} ${e.symbolKind} ${e.signature}`,item:{kind:`symbol`,id:`symbol:${e.path}:${e.name}:${e.line}`,path:e.path,name:e.name,symbolKind:e.symbolKind,line:e.line,signature:e.signature}}),Tg=e=>{let{pr:t,comments:n,checks:r,symbols:i}=e;return[bg(t),...t.files.map(xg),...(n??[]).map(Sg),...(r??[]).map(Cg),...(i??[]).map(wg)]},Eg=(e,t)=>e.github.reviewGetChangedFileSymbols.queryOptions(t,{staleTime:1/0}),Dg=(e,t)=>e.github.reviewGetChecks.queryOptions(t),Og=(e,t)=>e.github.reviewGetComments.queryOptions(t),kg=(e,t)=>e?t.isPending?`pending`:t.isError?`error`:`success`:`idle`,Ag=({owner:e,repo:t,pr:n,prMeta:r,prData:i})=>{let a=N(),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)([]),u=p({...Og(a,{owner:e,repo:t,pr:n}),enabled:o&&!!i}),d=p({...Dg(a,{owner:e,repo:t,headSha:r?.headSha??``}),enabled:o&&!!r?.headSha}),f=p({...Eg(a,{owner:e,repo:t,pr:n,headSha:r?.headSha??``}),enabled:o&&!!r?.headSha});return{contextItems:c,contextCandidates:i&&r?Tg({pr:{prNumber:n,title:r.title,body:r.body,files:i.files},comments:u.data??[],checks:d.data??[],symbols:f.data??[]}):[],contextGroups:{comments:kg(o,u),checks:kg(o,d),symbols:kg(o,f)},addContextItem:e=>l(t=>yg([...t,e])),removeContextItem:e=>l(t=>t.filter(t=>t.id!==e)),clearContextItems:()=>l([]),onContextIntent:()=>s(!0)}},jg=new Set([`clean`,`unstable`,`has_hooks`]),Mg=(e,t)=>!t||e.merged||e.state!==`open`||e.draft||e.mergeable!==!0?!1:jg.has(e.mergeableState),Ng=(e,t)=>e.github.repoMergeMethods.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),Pg=(e,t)=>e.github.reviewGetViewerPermissions.queryOptions(t,{staleTime:3e5,refetchOnWindowFocus:!1}),Fg=({owner:e,repo:t,pr:n,prMeta:r,enabled:i})=>{let a=N(),o=_(),s=p({...Ng(a,{owner:e,repo:t}),enabled:i}),c=p({...Pg(a,{owner:e,repo:t,pr:n}),enabled:i}),l=c.data?.canPush??!1,u=c.data?!c.data.didAuthor:!1;return{merge:{owner:e,repo:t,pr:n,canMerge:r?Mg(r,l):!1,allowedMethods:s.data,methodsLoading:s.isPending,onMerged:()=>{o.invalidateQueries({queryKey:Zm(a,{owner:e,repo:t,pr:n}).queryKey}),r&&o.invalidateQueries({queryKey:Xm(a,{owner:e,repo:t,pr:n,headSha:r.headSha,baseRef:r.baseRef}).queryKey})}},canApprove:u}},Ig=({sidePanel:e})=>(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 grow basis-0 flex-col`,children:[(0,L.jsx)(`div`,{className:`border-edge bg-background flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:(0,L.jsx)(j,{className:`h-4 w-48`})}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`border-edge w-3/20 border-r`,children:(0,L.jsx)(Vm,{})}),(0,L.jsx)(`div`,{className:`flex-1`,children:(0,L.jsx)(cp,{})}),(0,L.jsx)(`div`,{className:`border-edge w-3/10 border-l`,children:e})]})]}),Lg=({owner:e,repo:t,ref:n,path:r,line:i})=>`${sp(e,t)}/blob/${encodeURIComponent(n)}/${r.split(`/`).map(encodeURIComponent).join(`/`)}${i===null?``:`#L${i}`}`,Rg={empty:{entries:[],index:-1},record:(e,t,n)=>{let r=e.entries.slice(0,e.index+1),i=r.at(-1),a=t?i?.filename===t.filename?[...r.slice(0,-1),t]:[...r,t]:r,o=a.at(-1),s=(o?.filename===n.filename&&o.line===n.line?a:[...a,n]).slice(-50);return{entries:s,index:s.length-1}},step:(e,t,n)=>{let r=e.index+(t===`back`?-1:1),i=e.entries[r];if(!i)return null;let a=e.entries[e.index];return{history:{entries:n&&a?.filename===n.filename?e.entries.map((t,r)=>r===e.index?n:t):e.entries,index:r},target:i}}},zg=(e,t,n,r)=>({...e,...r?{exploredFiles:[...e.exploredFiles.filter(e=>e!==t),t].slice(-8),userMode:`classic`}:{},activeFile:t,prewarmFile:t,navigation:{nonce:e.navigation.nonce+1,line:n===null?null:{filename:t,line:n}}}),Bg=(e,t)=>{switch(t.type){case`selectFile`:return{...zg(e,t.filename,t.line,t.explore),history:Rg.record(e.history,e.activeFile?{filename:e.activeFile,line:t.fromLine}:null,{filename:t.filename,line:t.line})};case`stepHistory`:{let n=t.history.entries[t.history.index];return n?{...zg(e,n.filename,n.line,t.explore),history:t.history}:e}case`changeViewMode`:return{...e,userMode:t.mode,navigation:{...e.navigation,line:null}};case`selectDescription`:return{...e,activeFile:null,prewarmFile:null};case`prewarmFile`:return{...e,prewarmFile:t.filename};case`closeExplored`:return{...e,exploredFiles:e.exploredFiles.filter(e=>e!==t.filename),...e.activeFile===t.filename?{activeFile:null,prewarmFile:null}:{}};case`setActiveBeat`:return{...e,activeBeatId:t.beatId};case`expandStoryFile`:return{...e,expandedStoryFile:t.filename,activeBeatId:null};case`showClassic`:return{...e,userMode:`classic`}}},Vg=(e,t)=>{if(e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){if(e.key===`ArrowLeft`)return`back`;if(e.key===`ArrowRight`)return`forward`}return t&&e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.code===`Minus`||e.key===`-`||e.key===`_`)?e.shiftKey?`forward`:`back`:null},Hg=[`INPUT`,`TEXTAREA`,`SELECT`],Ug=e=>{let t=(0,I.useRef)(e);(0,I.useEffect)(()=>{t.current=e}),(0,I.useEffect)(()=>{let e=e=>{if(e.target instanceof HTMLElement&&(e.target.isContentEditable||Hg.includes(e.target.tagName)))return;let n=Vg(e,/Mac|iPhone|iPad/.test(navigator.userAgent));n&&t.current(n)&&e.preventDefault()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])},Wg=({owner:e,repo:t,pr:n,prMeta:r,prData:i})=>{let a=N(),o=_(),[s,c]=(0,I.useReducer)(Bg,{activeFile:null,exploredFiles:[],navigation:{nonce:0,line:null},prewarmFile:null,userMode:null,activeBeatId:null,expandedStoryFile:null,history:Rg.empty}),u=(0,I.useRef)(null),d=e=>!i||i.files.some(t=>t.filename===e),f=(n,i,a)=>{let o=d(n);!o&&!r?P.error(`${n} isn't part of this pull request.`,{action:(0,L.jsx)(l,{asChild:!0,size:`sm`,variant:`secondary`,children:(0,L.jsx)(Ki,{href:Lg({owner:e,repo:t,ref:`HEAD`,path:n,line:i??null}),children:`Open on GitHub`})})}):c({type:`selectFile`,filename:n,line:i??null,fromLine:a??u.current?.centerLine()??null,explore:!o})},p=e=>{let t=Rg.step(s.history,e,s.activeFile?{filename:s.activeFile,line:u.current?.centerLine()??null}:null);return t?(c({type:`stepHistory`,history:t.history,explore:!d(t.target.filename)}),!0):!1};return Ug(p),{state:s,viewport:u,history:{canGoBack:s.history.index>0,canGoForward:s.history.index<s.history.entries.length-1,onBack:()=>p(`back`),onForward:()=>p(`forward`)},handlers:{selectFile:f,prewarmFile:s=>{c({type:`prewarmFile`,filename:s});let l=r?.headSha,u=i?.files.find(e=>e.filename===s);l&&Pp(u??null)&&o.prefetchQuery(Lp(a,{owner:e,repo:t,pr:n,headSha:l,path:s}))},changeViewMode:e=>c({type:`changeViewMode`,mode:e}),selectDescription:()=>c({type:`selectDescription`}),closeExplored:e=>c({type:`closeExplored`,filename:e}),expandStoryFile:e=>{c({type:`expandStoryFile`,filename:e}),f(e),c({type:`showClassic`})},setActiveBeat:e=>c({type:`setActiveBeat`,beatId:e})}}},Gg=()=>({storyQuery:{data:null,isPending:!1,isError:!1},storyGenerating:!1,storyOutline:[],retryStory:()=>void 0}),Kg=[],qg=({owner:e,repo:t,pr:n,isError:r})=>(0,L.jsx)(`div`,{className:`border-edge bg-background flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,L.jsx)(`h1`,{className:`truncate text-sm font-semibold`,children:r?`Couldn't load pull request`:`Loading...`}),(0,L.jsxs)(`span`,{className:`text-muted-foreground shrink-0 text-xs`,children:[e,`/`,t,`#`,n]})]})}),Jg=({owner:e,repo:t,pr:n,prMeta:r,metadata:i,conversation:a,previewUrl:o,metadataLoading:s,storyAvailable:c,viewMode:l,merge:u,onViewModeChange:d,onReviewChanges:f})=>r?(0,L.jsx)(Kf,{owner:e,repo:t,pr:n,title:r.title,state:r.merged?`merged`:r.state===`closed`?`closed`:r.draft?`draft`:`open`,author:r.author,headRef:r.headRef,baseRef:r.baseRef,changedFiles:r.changedFiles,additions:r.additions,deletions:r.deletions,updatedAt:r.updatedAt,previewUrl:o,baseRepoFullName:r.baseRepoFullName,headRepoFullName:r.headRepoFullName,metadata:i,conversation:a,metadataLoading:s,storyAvailable:c,viewMode:l,merge:u,onViewModeChange:d,onReviewChanges:f}):(0,L.jsx)(qg,{owner:e,repo:t,pr:n,isError:!1}),Yg=({owner:e,repo:t,pr:n,orgId:r,renderSidePanel:i,onNavigate:a,codeIntel:o=null,blockMarks:s=null,inlineAsk:c=null})=>{let l=N(),u=_(),[d,f]=(0,I.useReducer)((e,t)=>t,!1),m=p(Zm(l,{owner:e,repo:t,pr:n})),h=p({...Qm(l,{owner:e,repo:t,pr:n}),enabled:!!m.data}),{state:{activeFile:g,exploredFiles:v,navigation:y,prewarmFile:b,userMode:x,activeBeatId:S,expandedStoryFile:C},handlers:w,history:T,viewport:ee}=Wg({owner:e,repo:t,pr:n,prMeta:m.data,prData:h.data}),te=p({...$m(l,{repoFullName:`${e}/${t}`,prNumber:n,headSha:m.data?.headSha??``}),enabled:!!m.data?.headSha}),ne=p({...eh(l,{repoFullName:`${e}/${t}`,headRef:m.data?.headRef??``}),enabled:!!m.data?.headRef}),re=(ne.data?.length??0)>0,ie=x??(re?`story`:`classic`),{storyQuery:ae,storyGenerating:oe,storyOutline:E,retryStory:D}=Gg({owner:e,repo:t,pr:n,orgId:r,prMeta:m.data,viewMode:ie}),se=p({...Xm(l,{owner:e,repo:t,pr:n,headSha:m.data?.headSha??``,baseRef:m.data?.baseRef??``}),enabled:!!m.data?.headSha&&!!m.data?.baseRef}),O=p({...Ym(l,{owner:e,repo:t,pr:n}),enabled:!!m.data}),{merge:k,canApprove:ce}=Fg({owner:e,repo:t,pr:n,prMeta:m.data,enabled:!!m.data}),le=Ym(l,{owner:e,repo:t,pr:n}).queryKey,A=gg({owner:e,repo:t,pr:n,headSha:m.data?.headSha??``,sessionId:te.data?.id}),ue=hg({provider:s,files:h.data?.files??Kg,session:te.data,onToggleViewed:A}),{resolvingThreadId:de,resolveThread:j}=vg({owner:e,repo:t,pr:n}),fe=Ag({owner:e,repo:t,pr:n,prMeta:m.data,prData:h.data}),pe=`https://github.com/${e}/${t}/pull/${n}`,me=Ui(O.data),he=i({prMeta:m,prAuthorEmail:h.data?.author.email??null,linkedConversations:ne.data??[],sourcesLoading:ne.isPending,context:fe,storyOutline:E,activeBeatId:S});return m.isPending?(0,L.jsx)(Ig,{sidePanel:he}):(0,L.jsx)(Gi,{value:o,children:(0,L.jsx)(Wi,{value:c,children:(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 grow basis-0 flex-col`,children:[m.isError?(0,L.jsx)(qg,{owner:e,repo:t,pr:n,isError:m.isError}):(0,L.jsx)(Jg,{owner:e,repo:t,pr:n,prMeta:m.data,metadata:se.data,conversation:O.data,previewUrl:se.data?.previewUrl??null,metadataLoading:se.isPending,storyAvailable:re,viewMode:ie,merge:k,onViewModeChange:w.changeViewMode,onReviewChanges:()=>f(!0)}),(0,L.jsxs)(Ii,{orientation:`horizontal`,id:`glen-review-layout`,className:`min-h-0 flex-1`,children:[ie===`classic`?(0,L.jsx)(Jm,{prData:h,exploredFiles:v,viewedFiles:te.data?.viewedFiles??[],viewedReady:!!te.data?.id,onToggleViewed:A,blockProgress:ue.progress,onSelectDescription:w.selectDescription,onSelectFile:w.selectFile,onCloseExplored:w.closeExplored,onPrewarmFile:w.prewarmFile,activeFile:g}):null,(0,L.jsx)(Gm,{name:`center`,defaultSize:55,minSize:30,children:(0,L.jsx)(Dm,{owner:e,repo:t,pr:n,headSha:m.data?.headSha??``,prBody:m.data?.body??null,prLoading:h.isPending,prError:h.isError,files:h.data?.files,activeFile:g,exploredFiles:v,onCloseExplored:w.closeExplored,scrollNonce:y.nonce,lineTarget:y.line?{...y.line,nonce:y.nonce}:null,expandedStoryFile:C,prewarmFile:b,githubPrUrl:pe,conversation:O.data,conversationLoading:O.isPending,conversationError:O.isError,resolvingThreadId:de,viewMode:ie,story:ae.data,storyPending:ae.isPending,storyError:ae.isError,storyGenerating:oe,onRetryStory:D,onActiveBeatChange:w.setActiveBeat,onAddContextItem:fe.addContextItem,onRetryPr:()=>void h.refetch(),onRetryConversation:()=>void O.refetch(),onResolveThread:j,onSelectFile:w.selectFile,onExpandStoryFile:w.expandStoryFile,blockMarks:ue,history:T,viewportRef:ee,onFileCommented:()=>void u.invalidateQueries({queryKey:le})})}),(0,L.jsx)(qm,{}),(0,L.jsx)(Gm,{name:`side`,defaultSize:30,minSize:20,collapsible:!0,children:he})]}),(0,L.jsx)(th,{owner:e,repo:t,pr:n,open:d,onOpenChange:f,onSubmitted:()=>void u.invalidateQueries({queryKey:le}),canApprove:ce}),(0,L.jsx)(fh,{active:me,onNavigate:a})]})})})},Xg={list:()=>Qe.local.blockMarks.list.query(),set:e=>Qe.local.blockMarks.set.mutate(e)},Zg={chats:null,lines:[],focus:null,collapsed:new Set,connection:null,listeners:new Set,epoch:F.getSnapshot().epoch},Qg=()=>Zg.listeners.forEach(e=>e()),$g=e=>e.flatMap(e=>e.placement.kind===`line`?[{id:e.id,path:e.placement.path,line:e.placement.line,side:e.placement.side}]:[]),e_=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.path===t[n].path&&e.line===t[n].line&&e.side===t[n].side),t_=()=>Qe.local.agent.chats.subscribe(void 0,{onData:e=>{let t=$g(e).reverse();Zg.chats=e,e_(Zg.lines,t)||(Zg.lines=t),Qg()},onConnectionStateChange:e=>{e.state===`connecting`&&e.error&&F.check()},onError:e=>void F.check().then(t=>{t&&P.error(e.message)})});F.subscribe(()=>{let{epoch:e}=F.getSnapshot();e!==Zg.epoch&&(Zg.epoch=e,Zg.connection&&(Zg.connection.unsubscribe(),Zg.chats=null,Zg.lines=[],Zg.connection=t_(),Qg()))});var n_={getSnapshot:()=>Zg.chats,getLineChats:()=>Zg.lines,getFocus:()=>Zg.focus,focus:e=>{Zg.focus=e,Qg()},getCollapsed:()=>Zg.collapsed,toggleCollapsed:e=>{let t=new Set(Zg.collapsed);t.delete(e)||t.add(e),Zg.collapsed=t,Qg()},subscribe:e=>(Zg.listeners.add(e),Zg.connection??=t_(),()=>{Zg.listeners.delete(e)})},r_=(e,t)=>e.find(e=>e.id===t)??e.find(e=>e.available)??e[0],i_={view:{tab:`agent`,chatId:null,terminalOpened:!1,signIn:null},listeners:new Set},a_=e=>{i_.view={...i_.view,...e,terminalOpened:i_.view.terminalOpened||e.tab===`terminal`},i_.listeners.forEach(e=>e())},o_={getSnapshot:()=>i_.view,subscribe:e=>(i_.listeners.add(e),()=>i_.listeners.delete(e)),showTab:e=>a_({tab:e}),showChat:e=>a_({tab:`agent`,chatId:e}),signIn:(e,t,n)=>a_({tab:`terminal`,signIn:{agent:e,label:t,chatId:n,run:(i_.view.signIn?.run??0)+1}}),clearSignIn:()=>a_({signIn:null})},s_=e=>void Qe.local.agent.list.query().then(t=>{let n=n_.getSnapshot()?.find(e=>e.id===o_.getSnapshot().chatId),r=r_(t,n?.agent??null);if(r)return Qe.local.agent.create.mutate({agent:r.id,placement:{kind:`line`,...e}}).then(e=>n_.focus(e.id))}).catch(e=>P.error(e.message)),c_=e=>/^[\w./~-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,l_=(e,t,n)=>e===null?`glen review ${t}`:n?`cd '${e.replaceAll(`'`,`''`)}'; glen review ${t}`:`cd ${c_(e)} && glen review ${t}`,u_=({command:e})=>{let[t,n]=(0,I.useState)(!1);return(0,L.jsxs)(`div`,{className:`bg-muted flex items-center gap-2 rounded-md py-1 pr-1 pl-3`,children:[(0,L.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-sm break-all`,children:e}),(0,L.jsxs)(l,{size:`sm`,variant:`ghost`,"aria-label":`Copy the restart command`,onClick:()=>void navigator.clipboard.writeText(e).then(()=>n(!0),()=>P.error(`Couldn't copy. Select the command instead.`)),children:[t?(0,L.jsx)(fn,{}):(0,L.jsx)(yn,{}),t?`Copied`:`Copy`]})]})},d_=({newHead:e})=>{let t=yt({mutationFn:async()=>{e.needsReload&&await Qe.local.pr.reload.mutate()},onSuccess:()=>location.reload(),onError:e=>P.error(e.message)});return(0,L.jsx)(`div`,{className:`fixed inset-x-0 top-3 z-50 flex justify-center px-4`,children:(0,L.jsxs)(nt,{className:`flex-row items-center gap-3 px-4 py-2 shadow-lg`,children:[(0,L.jsxs)(`span`,{className:`text-sm`,children:[`New commits on this PR. Reload to review`,` `,(0,L.jsx)(`code`,{className:`font-mono`,children:e.sha.slice(0,7)}),`.`]}),(0,L.jsxs)(l,{size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(),children:[t.isPending?(0,L.jsx)(Ke,{}):(0,L.jsx)(ct,{}),`Reload`]})]})})},f_=({pr:e})=>{let t=(0,I.useSyncExternalStore)(F.subscribe,F.getSnapshot);if(t.status===`connected`)return t.newHead?(0,L.jsx)(d_,{newHead:t.newHead}):null;let n=l_(t.info?.repoRoot??null,e,navigator.userAgent.includes(`Windows`));return(0,L.jsx)(`div`,{className:`bg-background/70 fixed inset-0 z-50 flex items-start justify-center px-4 pt-24`,children:(0,L.jsxs)(nt,{className:`w-full max-w-lg shadow-lg`,children:[(0,L.jsxs)(Je,{children:[(0,L.jsxs)(He,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Rn,{}),`The reviewer for #`,e,` stopped`]}),(0,L.jsx)(et,{children:t.status===`signed-out`?`It's back, but it didn't accept this browser. Open the sign-in link it printed in your terminal.`:`Start it again from the repo:`})]}),t.status===`disconnected`?(0,L.jsxs)(Ze,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(u_,{command:n}),(0,L.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,L.jsx)(Ke,{}),`Reconnecting automatically when it's back.`]})]}):null]})})},p_={status:()=>Qe.local.codeIntel.status.query(),hover:e=>Qe.local.codeIntel.hover.query(e),definition:e=>Qe.local.codeIntel.definition.query(e),references:e=>Qe.local.codeIntel.references.query(e)},m_=()=>(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`border-edge flex items-center gap-2 border-b p-2`,children:[(0,L.jsx)(j,{className:`h-7 w-40`}),(0,L.jsx)(j,{className:`ml-auto h-7 w-24`})]}),(0,L.jsx)(`div`,{className:`flex-1`}),(0,L.jsx)(`div`,{className:`border-edge border-t p-2`,children:(0,L.jsx)(j,{className:`h-16 w-full`})})]}),h_=()=>(0,L.jsx)(`div`,{className:`border-edge bg-background border-b p-3`,children:(0,L.jsxs)(`div`,{className:`border-edge max-w-3xl rounded-md border`,children:[(0,L.jsx)(`div`,{className:`border-edge flex items-center gap-2 border-b px-3 py-1.5`,children:(0,L.jsx)(j,{className:`h-4 w-48`})}),(0,L.jsx)(`div`,{className:`p-2`,children:(0,L.jsx)(j,{className:`h-10 w-full`})})]})}),g_=60,__=e=>{let t=N(),n=p(Zm(t,e));if(!n.data)return null;let r=n.data.title.length>g_?`${n.data.title.slice(0,59).trimEnd()}…`:n.data.title;return(0,L.jsx)(`title`,{children:`#${e.pr} · ${r} · glen review`})},v_=(0,I.lazy)(()=>ut(()=>import(`./local-side-panel-DV7OZQax.js`).then(e=>({default:e.LocalSidePanel})),__vite__mapDeps([19,1,6,7,8,9,10,11,12,2,13,14,20,16]))),y_=(0,I.lazy)(()=>ut(()=>import(`./inline-ask-C6EV_383.js`).then(e=>({default:e.InlineAsk})),__vite__mapDeps([21,1,6,7,8,10,11,12,2,17,20,14]))),b_=/^\/([^/]+)\/([^/]+)\/pull\/(\d+)/.exec(location.pathname),x_=Qn(),S_=h({links:[b({transformer:Re,url:`${location.origin}/api/trpc`,fetch:F.fetch})]});F.attach({queryClient:x_,readInfo:()=>Qe.local.server.info.query(),readLatestHead:()=>Qe.local.pr.latestHead.query()});var C_=document.getElementById(`root`);C_&&(0,Ct.createRoot)(C_).render((0,L.jsxs)(Rt,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,children:[(0,L.jsx)(w,{client:x_,children:(0,L.jsx)(Le,{trpcClient:S_,queryClient:x_,children:b_?.[1]&&b_[2]&&b_[3]?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(f_,{pr:Number(b_[3])}),(0,L.jsx)(__,{owner:b_[1],repo:b_[2],pr:Number(b_[3])}),(0,L.jsx)(Yg,{owner:b_[1],repo:b_[2],pr:Number(b_[3]),orgId:`local`,onNavigate:e=>location.assign(e),codeIntel:p_,blockMarks:Xg,inlineAsk:{start:s_,subscribe:n_.subscribe,getLineChats:n_.getLineChats,render:e=>(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(h_,{}),children:(0,L.jsx)(y_,{chatId:e})})},renderSidePanel:({context:e})=>(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(m_,{}),children:(0,L.jsx)(v_,{context:e})})})]}):(0,L.jsx)(`div`,{className:`flex w-full items-center justify-center`,children:(0,L.jsx)(Be,{title:`Open the review link`,description:`Use the URL that glen review printed in your terminal: it names the pull request to show.`})})})}),(0,L.jsx)(Un,{richColors:!0,position:`bottom-center`,style:{"--width":`min(32rem, 38vw)`,"--success-bg":`var(--overlay-fill)`,"--success-text":`var(--popover-foreground)`,"--success-border":`var(--edge-overlay)`,"--info-bg":`var(--overlay-fill)`,"--info-text":`var(--popover-foreground)`,"--info-border":`var(--edge-overlay)`,"--warning-bg":`var(--overlay-fill)`,"--warning-text":`var(--popover-foreground)`,"--warning-border":`var(--edge-overlay)`,"--error-bg":`var(--overlay-fill)`,"--error-text":`var(--destructive)`,"--error-border":`var(--destructive)`}})]}));export{mu as $,Xf as A,Of as B,vp as C,hn as Ct,ip as D,cn as Dt,up as E,ln as Et,Sf as F,rf as G,mf as H,Ef as I,gu as J,nf as K,wf as L,yf as M,Cf as N,rp as O,sn as Ot,xf as P,uu as Q,Tf as R,mp as S,vn as St,_p as T,un as Tt,pf as U,bf as V,tf as W,su as X,du as Y,cu as Z,wp as _,Vn as _t,n_ as a,hu as at,yp as b,Mn as bt,Wm as c,vu as ct,Om as d,Es as dt,lu as et,Zp as f,Ts as ft,Sp as g,Wi as gt,Np as h,Gi as ht,r_ as i,iu as it,Jf as j,np as k,yt as kt,Hm as l,nl as lt,Pp as m,Ki as mt,m_ as n,fu as nt,Lg as o,_u as ot,Hp as p,Cs as pt,au as q,o_ as r,pu as rt,Eg as s,yu as st,h_ as t,ou as tt,Mm as u,Ds as ut,Cp as v,zn as vt,hp as w,fn as wt,dp as x,kn as xt,xp as y,Fn as yt,Df as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./button-DizkG3Et.js";import{B as n,t as r,x as i}from"./query-error-DSrxRVZP.js";import{a,o}from"./bundle-mjs-IMkwHZOK.js";import{C as s,g as c,o as l}from"./card-BPb3NZYg.js";import{a as u}from"./reviewer-connection-B1irBiYS.js";import{t as d}from"./CaretUp.es-C6IDKCMg.js";import{_ as f,f as p,g as m,h,i as g,n as _,p as v,r as y,t as b,u as x}from"./agent-list-query-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./button-DizkG3Et.js";import{B as n,t as r,x as i}from"./query-error-DSrxRVZP.js";import{a,o}from"./bundle-mjs-IMkwHZOK.js";import{C as s,g as c,o as l}from"./card-BPb3NZYg.js";import{a as u}from"./reviewer-connection-B1irBiYS.js";import{t as d}from"./CaretUp.es-C6IDKCMg.js";import{_ as f,f as p,g as m,h,i as g,n as _,p as v,r as y,t as b,u as x}from"./agent-list-query-DqVLNOuo.js";import{Dt as S,a as C,kt as w,r as T,t as E}from"./index-D5VARefi.js";var D=e(o(),1),O=a(),k=e=>e?.kind===`selection`&&e.path?`${e.path}${e.startLine?`:${e.startLine}${e.endLine&&e.endLine!==e.startLine?`-${e.endLine}`:``}`:``}`:e?.label??`Selection`,A=({title:e,actions:n,onClose:r,closing:a=!1,children:o})=>(0,O.jsx)(`div`,{className:`border-edge bg-background border-b p-3`,children:(0,O.jsxs)(`div`,{className:`border-edge max-w-3xl rounded-md border`,children:[(0,O.jsxs)(`div`,{className:o?`border-edge @container flex min-w-0 items-center gap-2 border-b px-3 py-1.5`:`@container flex min-w-0 items-center gap-2 px-3 py-1.5`,children:[(0,O.jsx)(`div`,{className:`text-muted-foreground flex min-w-0 flex-1 items-center gap-1.5 text-xs font-medium`,children:e}),n,(0,O.jsx)(t,{size:`icon-xs`,variant:`ghost`,"aria-label":`Close`,disabled:a,onClick:r,children:a?(0,O.jsx)(c,{}):(0,O.jsx)(i,{})})]}),o]})}),j=({chat:e,agents:n,agent:r,onSettled:i})=>{let a=_(e.id),o=(0,D.useSyncExternalStore)(a.subscribe,a.getSnapshot),b=(0,D.useSyncExternalStore)(C.subscribe,C.getCollapsed).has(e.id),E=(0,D.useSyncExternalStore)(C.subscribe,C.getFocus),[j,M]=(0,D.useState)(``),N=e.id,P=e.placement.kind===`line`?e.placement.item:null,F=w({mutationFn:e=>l.local.agent.prompt.mutate({chatId:N,text:e,contextItems:[]}),onError:e=>u.error(e.message)}),I=w({mutationFn:()=>l.local.agent.cancel.mutate({chatId:N}),onError:e=>u.error(e.message)}),L=w({mutationFn:()=>l.local.agent.restart.mutate({chatId:N}),onError:e=>u.error(e.message)}),R=w({mutationFn:()=>l.local.agent.close.mutate({chatId:N}),onError:e=>u.error(e.message)}),z=w({mutationFn:e=>l.local.agent.setAgent.mutate({chatId:N,agent:e}),onError:e=>u.error(e.message)}),B=w({mutationFn:()=>l.local.agent.moveToPanel.mutate({chatId:N}),onSuccess:()=>T.showChat(N),onError:e=>u.error(e.message)}),V=F.isPending||o.busy,H=e.turns>0||e.queued>0||V,U=(e,t)=>T.signIn(e,t,N),W=()=>{let e=j.trim();e&&(F.mutate(e),M(``))},G=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`shrink-0`,children:`Ask`}),(0,O.jsx)(g,{agents:n,value:r.id,onValueChange:e=>{e!==r.id&&z.mutate(e)},compact:!0,disabled:H||z.isPending}),(0,O.jsx)(`span`,{className:`truncate`,children:b&&e.turns>0?e.title:`about ${k(P)}`}),b&&V?(0,O.jsx)(c,{className:`shrink-0`}):null]}),K=(0,O.jsxs)(O.Fragment,{children:[o.rows.length>0&&!b?(0,O.jsxs)(t,{size:`xs`,variant:`ghost`,disabled:B.isPending,onClick:()=>B.mutate(),children:[B.isPending?(0,O.jsx)(c,{}):(0,O.jsx)(S,{}),`Continue in chat`]}):null,(0,O.jsx)(t,{size:`icon-xs`,variant:`ghost`,"aria-label":b?`Expand`:`Minimize`,onClick:()=>C.toggleCollapsed(N),children:b?(0,O.jsx)(s,{}):(0,O.jsx)(d,{})})]});return b?(0,O.jsx)(A,{title:G,actions:K,onClose:()=>R.mutate(),closing:R.isPending}):r.available?(0,O.jsxs)(A,{title:G,actions:K,onClose:()=>R.mutate(),closing:R.isPending,children:[o.rows.length>0?(0,O.jsxs)(`div`,{className:`flex max-h-96 flex-col gap-3 overflow-y-auto px-3 pt-3`,children:[o.rows.map(e=>(0,O.jsx)(p,{chatId:N,agent:r.id,label:r.label,row:e,onSignIn:U},e.id)),(0,O.jsx)(h,{label:o.status===`starting`?`Starting ${r.label}`:`${r.label} is working`,thinking:V})]}):null,o.status===`failed`||o.status===`closed`?(0,O.jsxs)(`div`,{className:`px-3 pt-3`,children:[(0,O.jsx)(m,{message:o.status===`failed`?`${r.label} didn't start`:`${r.label} stopped`,detail:o.reason??void 0,onRetry:()=>L.mutate(),retryDisabled:L.isPending}),o.status===`failed`&&o.signIn?(0,O.jsx)(`div`,{className:`pt-2`,children:(0,O.jsx)(v,{agent:r.id,label:r.label,onSignIn:U})}):null]}):null,o.queue.length>0?(0,O.jsx)(`div`,{className:`px-3 pt-2`,children:(0,O.jsx)(y,{chatId:N,queue:o.queue})}):null,(0,O.jsx)(`div`,{className:`p-2`,children:(0,O.jsx)(f,{value:j,onValueChange:e=>M(e),onSend:W,onStop:()=>I.mutate(),busy:V,canSend:j.trim().length>0,placeholder:V?`Queue a follow-up`:o.rows.length>0?`Ask a follow-up`:`Ask ${r.label} about these lines`,"aria-label":`Question`,autoFocus:E===N&&o.rows.length===0})})]}):(0,O.jsx)(A,{title:G,actions:K,onClose:()=>R.mutate(),closing:R.isPending,children:(0,O.jsx)(`div`,{className:`p-3`,children:(0,O.jsx)(x,{agents:[r],onSettled:i,onSignIn:U})})})},M=({chatId:e})=>{let t=n(b()),i=(0,D.useSyncExternalStore)(C.subscribe,C.getSnapshot)?.find(t=>t.id===e);if(t.isPending||!i)return(0,O.jsx)(E,{});if(t.isError)return(0,O.jsx)(`div`,{className:`p-3`,children:(0,O.jsx)(r,{message:`Couldn't list the agents.`,refetch:()=>void t.refetch()})});let a=t.data.find(e=>e.id===i.agent);return a?(0,O.jsx)(j,{chat:i,agents:t.data,agent:a,onSettled:()=>void t.refetch()}):(0,O.jsx)(E,{})};export{M as InlineAsk};
|