better-review 0.2.0 → 0.4.0
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/README.md +32 -12
- package/dist/cli.js +1044 -1598
- package/dist/web/assets/highlight.worker-BOqhB448.js +153 -0
- package/dist/web/assets/{html-Bv1KyTF7.js → html-B3xvRgDO.js} +1 -1
- package/dist/web/assets/html-BHZv6uqE.js +1 -0
- package/dist/web/assets/{index-DXvPQh0-.js → index--X0HmlXh.js} +4 -2
- package/dist/web/assets/{index-vJUACaoV.css → index-CZyRc3NX.css} +1 -1
- package/dist/web/assets/{json-B88Oqtu5.js → json-qhed-kSA.js} +1 -1
- package/dist/web/assets/{jsx-D3KKoC5L.js → jsx-Bz0zcwM4.js} +1 -1
- package/dist/web/assets/{markdown-CboqBxpY.js → markdown-BYOwaDjH.js} +1 -1
- package/dist/web/assets/scss-8bKmll0B.js +1 -0
- package/dist/web/assets/{tsx-BOvsFOI6.js → tsx-udAQXfEw.js} +1 -1
- package/dist/web/assets/{typescript-j_1H8WHN.js → typescript-bsJCZSQ-.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/astro-BGCLva2-.js +0 -1
- package/dist/web/assets/bat-qdxAdBWQ.js +0 -1
- package/dist/web/assets/c-Cz4nF6n_.js +0 -1
- package/dist/web/assets/c-SSSlmE39.js +0 -1
- package/dist/web/assets/clojure-DqKBuwfJ.js +0 -1
- package/dist/web/assets/cmake-Bj61d0ZC.js +0 -1
- package/dist/web/assets/cpp-DK5F0KO4.js +0 -1
- package/dist/web/assets/cpp-pF_afpy8.js +0 -1
- package/dist/web/assets/csharp-dmMxLVLW.js +0 -1
- package/dist/web/assets/dart-CHZY9Xhz.js +0 -1
- package/dist/web/assets/diff-woXpYk--.js +0 -1
- package/dist/web/assets/dockerfile-IyjqRm3v.js +0 -1
- package/dist/web/assets/dotenv-CuH5my32.js +0 -1
- package/dist/web/assets/elixir-DcSoMxCm.js +0 -1
- package/dist/web/assets/erlang-59ohNboI.js +0 -1
- package/dist/web/assets/fsharp-D2W_zG4w.js +0 -1
- package/dist/web/assets/gleam-CSRkHgEL.js +0 -1
- package/dist/web/assets/go-rLFTqkRN.js +0 -1
- package/dist/web/assets/graphql-BoW1g5X9.js +0 -1
- package/dist/web/assets/graphql-C2HCcBds.js +0 -1
- package/dist/web/assets/groovy-CacY0gHj.js +0 -1
- package/dist/web/assets/haskell-D8IpX4py.js +0 -1
- package/dist/web/assets/hcl-Dh228itO.js +0 -1
- package/dist/web/assets/highlight.worker-D2jBd466.js +0 -153
- package/dist/web/assets/html-DZNlqGBh.js +0 -1
- package/dist/web/assets/ini-0B7NLFlx.js +0 -1
- package/dist/web/assets/ini-DiZ1IqbV.js +0 -1
- package/dist/web/assets/java-BtIQNnN0.js +0 -1
- package/dist/web/assets/java-_ATy9zCa.js +0 -1
- package/dist/web/assets/json-C3WlssX3.js +0 -1
- package/dist/web/assets/json5-BR5RXkoi.js +0 -1
- package/dist/web/assets/jsx-C4yDKi0A.js +0 -1
- package/dist/web/assets/julia-CBcsyk3j.js +0 -1
- package/dist/web/assets/kotlin-DhhofPvG.js +0 -1
- package/dist/web/assets/lua-B0e3uOiv.js +0 -1
- package/dist/web/assets/lua-pjIdZuk8.js +0 -1
- package/dist/web/assets/makefile-Dixweg8N.js +0 -1
- package/dist/web/assets/markdown-CjQmuOi1.js +0 -1
- package/dist/web/assets/mdx-DQZ5AkYe.js +0 -1
- package/dist/web/assets/nginx-DbUAZ-J7.js +0 -1
- package/dist/web/assets/nix-Cl_7024t.js +0 -1
- package/dist/web/assets/objective-c-D1A_Heim.js +0 -1
- package/dist/web/assets/ocaml-O90oeIOV.js +0 -1
- package/dist/web/assets/perl-CCy4CjC0.js +0 -1
- package/dist/web/assets/php-3goRFXPs.js +0 -1
- package/dist/web/assets/postcss-D_Wz94rJ.js +0 -1
- package/dist/web/assets/powershell-QtSnmXcu.js +0 -1
- package/dist/web/assets/prisma-DMgNhnYS.js +0 -1
- package/dist/web/assets/properties-DiZ1IqbV.js +0 -1
- package/dist/web/assets/proto-DB4EqR-F.js +0 -1
- package/dist/web/assets/python-C5TF47hQ.js +0 -1
- package/dist/web/assets/python-CzFU0dpx.js +0 -1
- package/dist/web/assets/r-BXEss897.js +0 -1
- package/dist/web/assets/r-DWzjseEo.js +0 -1
- package/dist/web/assets/ruby-ChLscevq.js +0 -1
- package/dist/web/assets/rust-DpiIf5JO.js +0 -1
- package/dist/web/assets/scala-BiFt_7mu.js +0 -1
- package/dist/web/assets/shellscript-CVTB3cr6.js +0 -1
- package/dist/web/assets/shellscript-CqHdAlCp.js +0 -1
- package/dist/web/assets/sql-CNu3Or2W.js +0 -1
- package/dist/web/assets/sql-CfM2IJm3.js +0 -1
- package/dist/web/assets/svelte-Bte6OA2r.js +0 -1
- package/dist/web/assets/swift-CyEgAFGc.js +0 -1
- package/dist/web/assets/terraform-DswuEJGm.js +0 -1
- package/dist/web/assets/toml-CcmNWLt0.js +0 -1
- package/dist/web/assets/tsx-CGosfAUg.js +0 -1
- package/dist/web/assets/typescript-Bb1J8qyy.js +0 -1
- package/dist/web/assets/vue-CcmjViMa.js +0 -1
- package/dist/web/assets/xml-Bvlx11yh.js +0 -1
- package/dist/web/assets/xml-Byfru430.js +0 -1
- package/dist/web/assets/yaml-DDA_XMNu.js +0 -1
- package/dist/web/assets/yaml-DijMHRDA.js +0 -1
- package/dist/web/assets/zig-CMLA9XwU.js +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/css-DgaLhXQH.js","assets/css-BGIxQoYs.js","assets/scss-8bKmll0B.js","assets/html-BHZv6uqE.js","assets/javascript-BzbQS41l.js","assets/javascript-CpIGwZ_Y.js"])))=>i.map(i=>d[i]);
|
|
1
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),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 l(e){return Object.keys(e)}function u(e){return e&&typeof e==`object`&&!Array.isArray(e)}function d(e,t){let n={...e},r=t;return u(e)&&u(t)&&Object.keys(t).forEach(t=>{u(r[t])&&t in e?n[t]=d(n[t],r[t]):n[t]=r[t]}),n}function f(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function p(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function m(e){let t=p(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function h(e){return e===`0rem`?`0rem`:`calc(${e} * var(--mantine-scale))`}function g(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r===`0`)return`0${e}`;if(typeof r==`number`){let n=`${r/16}${e}`;return t?h(n):n}if(typeof r==`string`){if(r===``||r.startsWith(`calc(`)||r.startsWith(`clamp(`)||r.includes(`rgba(`))return r;if(r.includes(`,`))return r.split(`,`).map(e=>n(e)).join(`,`);if(r.includes(` `))return r.split(` `).map(e=>n(e)).join(` `);let i=r.replace(`px`,``);if(!Number.isNaN(Number(i))){let n=`${Number(i)/16}${e}`;return t?h(n):n}}return r}return n}var _=g(`rem`,{shouldScale:!0}),v=g(`em`);function y(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function b(e){if(typeof e==`number`)return!0;if(typeof e==`string`){if(e.startsWith(`calc(`)||e.startsWith(`var(`)||e.includes(` `)&&e.trim()!==``)return!0;let t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(e=>t.test(e))}return!1}var x=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ee(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ee(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),ee(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=ee(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=ee(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ee(N(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return ee(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function L(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function R(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else L(R.bind(null,e))}var te={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=te,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=R,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=L,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),S=o(((e,t)=>{t.exports=x()})),C=c(S(),1);function w(e){return Array.isArray(e)||e===null?!1:typeof e==`object`&&e.type!==C.Fragment}function T(e){let t=(0,C.createContext)(null);return[t,()=>{let n=(0,C.use)(t);if(n===null)throw Error(e);return n}]}function E(e,t){return n=>{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}function D(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function O(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].disabled)return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].disabled)return e}return e}function k(e,t,n){for(let n=e+1;n<t.length;n+=1)if(!t[n].disabled)return n;if(n){for(let e=0;e<t.length;e+=1)if(!t[e].disabled)return e}return e}function A(e,t,n){return D(e,n)===D(t,n)}function j({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:i=!1,dir:a=`rtl`,orientation:o}){return s=>{n?.(s);let c=Array.from(D(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>A(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=k(l,c,r),d=O(l,c,r),f=a===`rtl`?d:u,p=a===`rtl`?u:d;switch(s.key){case`ArrowRight`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[f].focus(),i&&c[f].click());break;case`ArrowLeft`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[p].focus(),i&&c[p].click());break;case`ArrowUp`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[d].focus(),i&&c[d].click());break;case`ArrowDown`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[u].focus(),i&&c[u].click());break;case`Home`:s.stopPropagation(),s.preventDefault(),c[k(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[O(c.length,c,!1)]?.focus()}}}var M={app:100,modal:200,popover:300,overlay:400,max:9999};function N(e){return M[e]}var ee=()=>{};function P(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||ee:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function F(e,t=`size`,n=!0){if(e!==void 0)return b(e)?n?_(e):e:`var(--${t}-${e})`}function I(e){return F(e,`mantine-spacing`)}function L(e){return e===void 0?`var(--mantine-radius-default)`:F(e,`mantine-radius`)}function R(e){return F(e,`mantine-font-size`)}function te(e){return F(e,`mantine-line-height`,!1)}function ne(e){if(e)return F(e,`mantine-shadow`,!1)}function re(e,t){return n=>{e?.(n),t?.(n)}}function ie(e,t,n){return t===void 0&&n===void 0?e:t!==void 0&&n===void 0?Math.max(e,t):Math.min(t===void 0&&n!==void 0?e:Math.max(e,t),n)}function ae(e=`mantine-`){return`${e}${Math.random().toString(36).slice(2,11)}`}function oe(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i<r;i+=1){let r=n[i];if(!(r in t)||e[r]!==t[r]&&!(Number.isNaN(e[r])&&Number.isNaN(t[r])))return!1}return!0}function se(e){let t=(0,C.useRef)(e);return(0,C.useEffect)(()=>{t.current=e}),(0,C.useMemo)(()=>((...e)=>t.current?.(...e)),[])}function ce(e,t){let{delay:n,flushOnUnmount:r,leading:i,maxWait:a}=typeof t==`number`?{delay:t,flushOnUnmount:!1,leading:!1,maxWait:void 0}:t,o=se(e),s=(0,C.useRef)(0),c=(0,C.useRef)(0),l=(0,C.useRef)(null),u=(0,C.useMemo)(()=>{let e=Object.assign((...t)=>{window.clearTimeout(s.current),l.current=t;let r=e._isFirstCall;e._isFirstCall=!1;function u(){window.clearTimeout(s.current),window.clearTimeout(c.current),s.current=0,c.current=0,e._isFirstCall=!0,e._hasPendingCallback=!1}function d(){a!==void 0&&c.current===0&&(c.current=window.setTimeout(()=>{if(c.current=0,s.current!==0&&e._hasPendingCallback){let e=l.current;u(),o(...e)}},a))}if(i&&r){o(...t),e.flush=()=>{s.current!==0&&u()},e.cancel=()=>{u()},s.current=window.setTimeout(()=>{u()},n),d();return}if(i&&!r){e._hasPendingCallback=!0,e.flush=()=>{s.current!==0&&(u(),o(...t))},e.cancel=()=>{u()},s.current=window.setTimeout(()=>{u()},n),d();return}e._hasPendingCallback=!0;let f=()=>{s.current!==0&&(u(),o(...t))};e.flush=f,e.cancel=()=>{u()},s.current=window.setTimeout(f,n),d()},{flush:()=>{},cancel:()=>{},isPending:()=>e._hasPendingCallback,_isFirstCall:!0,_hasPendingCallback:!1});return e},[o,n,i,a]);return(0,C.useEffect)(()=>()=>{r?u.flush():u.cancel()},[u,r]),u}var le=[`mousedown`,`touchstart`];function z(e,t,n,r=!0,i=!1){let a=(0,C.useRef)(null),o=t||le,s=(0,C.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let i=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!i.includes(e))&&e(t):a.current&&!i.includes(a.current)&&e(t)}),c=o.join(`,`);return(0,C.useEffect)(()=>{if(!r)return;let e=c.split(`,`);return e.forEach(e=>document.addEventListener(e,s,i)),()=>{e.forEach(e=>document.removeEventListener(e,s,i))}},[c,r,i]),a}function B(e,t){if(typeof t==`boolean`)return t;if(typeof window<`u`&&`matchMedia`in window)try{return window.matchMedia(e).matches}catch{return!1}return!1}function V(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){let[r,i]=(0,C.useState)(n?t:B(e));return(0,C.useEffect)(()=>{try{if(`matchMedia`in window){let t=window.matchMedia(e);i(t.matches);let n=e=>i(e.matches);return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}}}catch{return}},[e]),r||!1}var ue=typeof document<`u`?C.useLayoutEffect:C.useEffect;function de(e,t){return e.length!==t.length||t.some((t,n)=>!Object.is(t,e[n]))}function fe(e,t){let n=(0,C.useRef)(!1),r=(0,C.useRef)(null),i=(0,C.useRef)(void 0),a={};(0,C.useEffect)(()=>{let o=r.current===a,s=i.current;if(r.current=a,i.current=t,!n.current)n.current=!0;else if(!o&&!(t&&s&&!de(s,t)))return e()},t)}function pe({opened:e,shouldReturnFocus:t=!0}){let n=(0,C.useRef)(null),r=()=>{n.current&&`focus`in n.current&&typeof n.current.focus==`function`&&n.current?.focus({preventScroll:!0})};return fe(()=>{let i=-1,a=e=>{e.key===`Tab`&&window.clearTimeout(i)};if(document.addEventListener(`keydown`,a),e)n.current=document.activeElement;else if(t){let e=document.activeElement;i=window.setTimeout(()=>{let t=document.activeElement;(t===null||t===document.body||t===e)&&r()},10)}return()=>{window.clearTimeout(i),document.removeEventListener(`keydown`,a)}},[e,t]),r}var H=/input|select|textarea|button|object|summary|iframe/,me=`a, input, select, textarea, button, object, summary, iframe, audio[controls], video[controls], [contenteditable], [tabindex]`;function he(e){let t=e.getAttribute(`contenteditable`);return t!==null&&t!==`false`}function ge(e){let t=e.nodeName.toLowerCase();return(t===`audio`||t===`video`)&&e.hasAttribute(`controls`)}function _e(e){return e.style.display===`none`}function ve(e){if(e.getAttribute(`aria-hidden`)||e.getAttribute(`hidden`)||e.getAttribute(`type`)===`hidden`)return!1;let t=e;for(;t&&t!==document.body&&t.nodeType!==11;){if(_e(t))return!1;t=t.parentNode}return!0}function ye(e){let t=e.getAttribute(`tabindex`);return t===null&&(t=void 0),parseInt(t,10)}function be(e){let t=e.nodeName.toLowerCase(),n=!Number.isNaN(ye(e));return(H.test(t)&&!e.disabled||he(e)||ge(e)||e instanceof HTMLAnchorElement&&e.href||n)&&ve(e)}function xe(e){let t=ye(e);return(Number.isNaN(t)||t>=0)&&be(e)}function Se(e){let t=Array.from(e.querySelectorAll(me)).filter(xe),n=t.filter(e=>ye(e)>0).sort((e,t)=>ye(e)-ye(t)),r=t.filter(e=>!(ye(e)>0));return[...n,...r]}var Ce=[`date`,`time`,`datetime-local`,`month`,`week`],we=[`audio`,`video`,`iframe`,`object`,`embed`];function Te(e){return!!e&&e.tagName===`INPUT`&&e.type===`radio`}function Ee(e,t){return e.name!==``&&e.name===t.name&&e.form===t.form}function De(e){let t=e.nodeName.toLowerCase();return t===`input`?Ce.includes(e.type):we.includes(t)}function Oe(e,t){let n=Se(e);return n.filter(e=>e===t||!Te(e)?!0:Te(t)&&Ee(e,t)?!1:e.checked?!0:!n.some(t=>Te(t)&&t.checked&&Ee(t,e)))}function ke(e,t,n,r){let i=e.indexOf(t);if(i!==-1)return i+1;if(t===n)return 0;let a=r?Node.DOCUMENT_POSITION_PRECEDING:Node.DOCUMENT_POSITION_FOLLOWING,o=e.findIndex(e=>(t.compareDocumentPosition(e)&a)!==0);return o===-1?0:o}function Ae(e,t,n){let r=Oe(e,t);n&&r.reverse();let i=ke(r,t,e,n);return[...r.slice(i),...r.slice(0,i)].filter(e=>e!==t)}function je(e,t){for(let n of e)if(n.focus(),t.activeElement===n)return}function Me(e,t){let n=e.getRootNode(),r=n.activeElement;if(!r||r!==e&&!e.contains(r))return;let i=Ae(e,r,t.shiftKey);De(r)?setTimeout(()=>{let t=n.activeElement;e.isConnected&&t!==r&&t!==i[0]&&je([...i,r],n)}):(t.preventDefault(),je(i,n))}var Ne=new Set;function Pe(e,t){let n=t.getRootNode().activeElement;if(!n)return!1;for(let r of Ne){let i=r.current;if(r!==e&&i&&i!==t&&t.contains(i)&&i.contains(n))return!0}return!1}function Fe(e=!0){let t=(0,C.useRef)(null),n=e=>{let t=e.querySelector(`[data-autofocus]`);if(!t){let n=Array.from(e.querySelectorAll(me));t=n.find(xe)||n.find(be)||null,!t&&be(e)&&(t=e)}t?t.focus({preventScroll:!0}):console.warn(`[@mantine/hooks/use-focus-trap] Failed to find focusable element within provided node`,e)},r=(0,C.useCallback)(r=>{e&&(r===null?t.current=null:t.current!==r&&(setTimeout(()=>{r.getRootNode()?n(r):console.warn(`[@mantine/hooks/use-focus-trap] Ref node is not part of the dom`,r)}),t.current=r))},[e]);return(0,C.useEffect)(()=>{if(!e)return;t.current&&setTimeout(()=>{t.current&&n(t.current)});let r=e=>{e.key!==`Tab`||e.defaultPrevented||!t.current||Pe(t,t.current)||Me(t.current,e)};return Ne.add(t),document.addEventListener(`keydown`,r),()=>{Ne.delete(t),document.removeEventListener(`keydown`,r)}},[e]),r}var Ie=e=>(e+1)%1e6;function Le(){let[,e]=(0,C.useReducer)(Ie,0);return e}function Re(e){let t=(0,C.useId)(),[n,r]=(0,C.useState)(`mantine-${t.replace(/:/g,``)}`),i=(0,C.useRef)(!1);return ue(()=>{i.current||(i.current=!0,r(ae()))},[]),typeof e==`string`?e:n}function ze(e,t,n){let r=(0,C.useEffectEvent)(t);(0,C.useEffect)(()=>(window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)),[e])}function Be(e,t=`use-local-storage`){try{return JSON.stringify(e)}catch{throw Error(`@mantine/hooks ${t}: Failed to serialize the value`)}}function Ve(e){try{return e&&JSON.parse(e)}catch{return e}}function He(e){return{getItem:t=>{try{return window[e].getItem(t)}catch{return console.warn(`use-local-storage: Failed to get value from storage, localStorage is blocked`),null}},setItem:(t,n)=>{try{window[e].setItem(t,n)}catch{console.warn(`use-local-storage: Failed to set value to storage, localStorage is blocked`)}},removeItem:t=>{try{window[e].removeItem(t)}catch{console.warn(`use-local-storage: Failed to remove value from storage, localStorage is blocked`)}}}}function Ue(e,t){let n=e===`localStorage`?`mantine-local-storage`:`mantine-session-storage`,{getItem:r,setItem:i,removeItem:a}=He(e);return function({key:o,defaultValue:s,getInitialValueInEffect:c=!0,sync:l=!0,deserialize:u=Ve,serialize:d=e=>Be(e,t)}){let f=(0,C.useCallback)(t=>{let n;try{n=typeof window>`u`||!(e in window)||window[e]===null||!!t}catch{n=!0}if(n)return s;let i=r(o);return i===null?s:u(i)},[o,s]),[p,m]=(0,C.useState)(f(c)),h=(0,C.useCallback)(e=>{e instanceof Function?m(t=>{let r=e(t);return i(o,d(r)),queueMicrotask(()=>{window.dispatchEvent(new CustomEvent(n,{detail:{key:o,value:r}}))}),r}):(i(o,d(e)),window.dispatchEvent(new CustomEvent(n,{detail:{key:o,value:e}})),m(e))},[o]),g=(0,C.useCallback)(()=>{a(o),m(s),window.dispatchEvent(new CustomEvent(n,{detail:{key:o,value:s}}))},[o,s]);return ze(`storage`,t=>{l&&t.storageArea===window[e]&&t.key===o&&m(u(t.newValue??void 0))}),ze(n,e=>{l&&e.detail.key===o&&m(e.detail.value)}),(0,C.useEffect)(()=>{s!==void 0&&p===void 0&&h(s)},[s,p,h]),(0,C.useEffect)(()=>{let e=f();e!==void 0&&h(e)},[o]),[p===void 0?s:p,h,g]}}function We(e){let{getItem:t}=He(e);return function({key:n,defaultValue:r,deserialize:i=Ve}){let a;try{a=typeof window>`u`||!(e in window)||window[e]===null}catch{a=!0}if(a)return r;let o=t(n);return o===null?r:i(o)}}function Ge(e){return Ue(`localStorage`,`use-local-storage`)(e)}We(`localStorage`);function Ke(e,t){if(typeof e==`function`)return e(t);typeof e==`object`&&e&&`current`in e&&(e.current=t)}function qe(...e){let t=new Map;return n=>{if(e.forEach(e=>{let r=Ke(e,n);r&&t.set(e,r)}),t.size>0)return()=>{e.forEach(e=>{let n=t.get(e);n&&typeof n==`function`?n():Ke(e,null)}),t.clear()}}}function Je(...e){return(0,C.useCallback)(qe(...e),e)}function Ye({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){let[i,a]=(0,C.useState)(t===void 0?n:t);return e===void 0?[i,(e,...t)=>{a(e),r?.(e,...t)},!1]:[e,r,!0]}function Xe(e,t){return V(`(prefers-reduced-motion: reduce)`,e,t)}var Ze={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function Qe(e){let t=(0,C.useRef)(0),[n,r]=(0,C.useState)(Ze),i=(0,C.useRef)(null);return[(0,C.useCallback)(n=>{i.current&&=(i.current.disconnect(),null),t.current&&cancelAnimationFrame(t.current),n&&(i.current=new ResizeObserver(e=>{let n=e[0];n&&(cancelAnimationFrame(t.current),t.current=requestAnimationFrame(()=>{let e=n.borderBoxSize?.[0]||n.contentBoxSize?.[0];if(e){let t=e.inlineSize,i=e.blockSize;r({width:t,height:i,x:n.contentRect.x,y:n.contentRect.y,top:n.contentRect.top,left:n.contentRect.left,bottom:n.contentRect.bottom,right:n.contentRect.right})}else r(n.contentRect)}))}),i.current.observe(n,e))},[e]),n]}function $e(e){let[t,{width:n,height:r}]=Qe(e);return{ref:t,width:n,height:r}}function et(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!oe(e[n],t[n]))return!1;return!0}function tt(e){let t=(0,C.useRef)([]),n=(0,C.useRef)(0);return et(t.current,e)||(t.current=e,n.current+=1),[n.current]}function nt(e,t){(0,C.useEffect)(e,tt(t))}var rt={" ":`space`,ArrowLeft:`arrowleft`,ArrowRight:`arrowright`,ArrowUp:`arrowup`,ArrowDown:`arrowdown`,Escape:`escape`,Esc:`escape`,esc:`escape`,Enter:`enter`,Tab:`tab`,Backspace:`backspace`,Delete:`delete`,Insert:`insert`,Home:`home`,End:`end`,PageUp:`pageup`,PageDown:`pagedown`,"+":`plus`,"-":`minus`,"*":`asterisk`,"/":`slash`};function it(e){let t=e.replace(`Key`,``).toLowerCase();return rt[e]||t}function at(e){let t=e.toLowerCase().split(`+`).map(e=>e.trim()),n={alt:t.includes(`alt`),ctrl:t.includes(`ctrl`),meta:t.includes(`meta`),mod:t.includes(`mod`),shift:t.includes(`shift`)},r=[`alt`,`ctrl`,`meta`,`shift`,`mod`],i=t.find(e=>!r.includes(e));return{...n,key:i===`[plus]`?`+`:i}}function ot(e,t,n){let{alt:r,ctrl:i,meta:a,mod:o,shift:s,key:c}=e,{altKey:l,ctrlKey:u,metaKey:d,shiftKey:f,key:p,code:m}=t;if(r!==l)return!1;if(o){if(!u&&!d)return!1}else if(i!==u||a!==d)return!1;return s===f&&!!(c&&(n?it(m)===it(c):it(p??m)===it(c)))}function st(e,t){return n=>ot(at(e),n,t)}function ct(e,t,n=!1){return e.target instanceof HTMLElement?(n||!e.target.isContentEditable)&&!t.includes(e.target.tagName):!0}function lt(e,t=[`INPUT`,`TEXTAREA`,`SELECT`],n=!1){let r=(0,C.useEffectEvent)(r=>{e.forEach(([e,i,a])=>{let{preventDefault:o=!0,usePhysicalKeys:s=!1}=a||{};st(e,s)(r)&&ct(r,t,n)&&(o&&r.preventDefault(),i(r))})});(0,C.useEffect)(()=>(document.documentElement.addEventListener(`keydown`,r),()=>document.documentElement.removeEventListener(`keydown`,r)),[])}function ut(e,t,n={autoInvoke:!1}){let r=(0,C.useRef)(null),i=se(e),a=(0,C.useCallback)((...e)=>{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,C.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,C.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function dt(e,t,n){let r=(0,C.useRef)(null);(0,C.useEffect)(()=>{r.current&&=(r.current.disconnect(),null);let i=typeof n==`function`?n():n;return i&&(r.current=new MutationObserver(e),r.current.observe(i,t)),()=>{r.current&&=(r.current.disconnect(),null)}},[e,t,n])}function ft(){let[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>t(!0),[]),e}var pt=[`mouse`,`touch`],mt=10;function ht(e,t={}){let{threshold:n=400,events:r=pt,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,C.useRef)(!1),l=(0,C.useRef)(!1),u=(0,C.useRef)(-1),d=(0,C.useRef)(null);(0,C.useEffect)(()=>()=>window.clearTimeout(u.current),[]);let f=r.join(`,`);return(0,C.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?mt:i===!1?0:i,p=t=>{(vt(t)||_t(t))&&(a&&a(t),d.current=gt(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(vt(e)||_t(e))&&(c.current?o&&o(e):l.current&&s&&s(e),c.current=!1,l.current=!1,d.current=null,u.current!==-1&&(window.clearTimeout(u.current),u.current=-1))},h=e=>{if(!t||!l.current||c.current)return;let n=gt(e);if(!n||!d.current)return;let r=n.x-d.current.x,i=n.y-d.current.y;Math.sqrt(r*r+i*i)>f&&m(e)},g={};return r.includes(`mouse`)&&(g.onMouseDown=p,g.onMouseUp=m,g.onMouseLeave=m,t&&(g.onMouseMove=h)),r.includes(`touch`)&&(g.onTouchStart=p,g.onTouchEnd=m,g.onTouchCancel=m,t&&(g.onTouchMove=h)),g},[e,n,s,o,a,i,f])}function gt(e){if(_t(e)){let t=e.touches[0]??e.changedTouches[0];return t?{x:t.clientX,y:t.clientY}:null}return{x:e.clientX,y:e.clientY}}function _t(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function vt(e){return e.nativeEvent instanceof MouseEvent}var yt=o((e=>{var t=S();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),bt=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=yt()})),xt=c(bt(),1);function St(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function Ct(e){return e.current?e.current.scrollHeight:`auto`}function wt(e){return typeof e==`number`&&e>0}function Tt({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={height:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,C.useEffectEvent)(()=>r?.()),c=(0,C.useEffectEvent)(()=>n?.()),l=(0,C.useRef)(null),[u,d]=(0,C.useState)(i?{}:o),[f,p]=(0,C.useState)(i?`entered`:`exited`),m=e=>{(0,xt.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},g=n=>{let r=e??St(n);return{transition:`height ${r}ms ${t}, opacity ${r}ms ${t}`}},_=(0,C.useRef)(0);fe(()=>{_.current+=1;let t=_.current,n=()=>_.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,xt.flushSync)(()=>p(`entering`)),h({willChange:`height`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=Ct(l);wt(e)?h({...g(e),height:e}):(m({}),p(`entered`),c())}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,xt.flushSync)(()=>p(`exiting`));let e=Ct(l);wt(e)?(h({...g(e),willChange:`height`,height:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({height:0,overflow:`hidden`})})):(m(o),p(`exited`),c())})},[i]);let v=e=>{if(e.target===l.current&&e.propertyName===`height`){if(i){let e=Ct(l);e===u.height?m({}):h({height:e}),p(`entered`),c()}else u.height===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:qe(l,e?.ref),onTransitionEnd:v,style:{boxSizing:`border-box`,...e?.style,...u}})}}function Et(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function Dt(e){return e.current?e.current.scrollWidth:`auto`}function Ot({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={width:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,C.useEffectEvent)(()=>r?.()),c=(0,C.useEffectEvent)(()=>n?.()),l=(0,C.useRef)(null),[u,d]=(0,C.useState)(i?{}:o),[f,p]=(0,C.useState)(i?`entered`:`exited`),m=e=>{(0,xt.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},g=n=>{let r=e??Et(n);return{transition:`width ${r}ms ${t}, opacity ${r}ms ${t}`}},_=(0,C.useRef)(0);fe(()=>{_.current+=1;let t=_.current,n=()=>_.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,xt.flushSync)(()=>p(`entering`)),h({willChange:`width`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=Dt(l);wt(e)?h({...g(e),width:e}):(m({}),p(`entered`),c())}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,xt.flushSync)(()=>p(`exiting`));let e=Dt(l);wt(e)?(h({...g(e),willChange:`width`,width:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({width:0,overflow:`hidden`})})):(m(o),p(`exited`),c())})},[i]);let v=e=>{if(e.target===l.current&&e.propertyName===`width`){if(i){let e=Dt(l);e===u.width?m({}):h({width:e}),p(`entered`),c()}else u.width===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:qe(l,e?.ref),onTransitionEnd:v,style:{boxSizing:`border-box`,...e?.style,...u}})}}var kt=100;function At(e){return e>0?1:e<0?-1:0}function jt(e){let t=e??0;return typeof t==`number`?[t,t]:t}function Mt(){return{isActive:!1,pointerId:-1,startXY:[0,0],prevXY:[0,0],startTimestamp:0,prevTimestamp:0,thresholdMet:!1,firstFired:!1,lockedAxis:null,canceled:!1,lastVelocity:[0,0]}}function Nt(e,t={}){let[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(e);i.current=e;let a=(0,C.useRef)(t);a.current=t;let o=(0,C.useRef)(Mt()),s=(0,C.useRef)(null);return{ref:(0,C.useCallback)(e=>{if(!e)return;let t=new AbortController,n=e=>{let t=a.current,n=o.current;if(t.axis===`x`)return[e[0],0];if(t.axis===`y`)return[0,e[1]];if(t.axis===`lock`){if(n.lockedAxis===null){let r=t.axisThreshold??1;(Math.abs(e[0])>r||Math.abs(e[1])>r)&&(n.lockedAxis=Math.abs(e[0])>=Math.abs(e[1])?`x`:`y`)}if(n.lockedAxis===`x`)return[e[0],0];if(n.lockedAxis===`y`)return[0,e[1]]}return e},c=()=>{let e=o.current;e.isActive=!1,e.pointerId=-1,e.thresholdMet=!1,e.firstFired=!1,e.lockedAxis=null,e.canceled=!1,r(!1),document.body.style.userSelect=``,document.body.style.webkitUserSelect=``,s.current?.abort(),s.current=null},l=()=>{o.current.isActive&&(o.current.canceled=!0,c())},u=()=>{r(!0),document.body.style.userSelect=`none`,document.body.style.webkitUserSelect=`none`},d=e=>{if(a.current.enabled===!1||e.button!==0||o.current.isActive)return;let t=o.current;t.isActive=!0,t.pointerId=e.pointerId,t.startXY=[e.clientX,e.clientY],t.prevXY=[e.clientX,e.clientY],t.startTimestamp=e.timeStamp,t.prevTimestamp=e.timeStamp,t.thresholdMet=!1,t.firstFired=!1,t.lockedAxis=null,t.canceled=!1,t.lastVelocity=[0,0];let[n,r]=jt(a.current.threshold);n===0&&r===0&&(t.thresholdMet=!0,t.firstFired=!0,u(),i.current({xy:[e.clientX,e.clientY],initial:[e.clientX,e.clientY],movement:[0,0],delta:[0,0],distance:[0,0],direction:[0,0],velocity:[0,0],elapsedTime:0,first:!0,last:!1,active:!0,tap:!1,canceled:!1,cancel:l,event:e})),s.current?.abort(),s.current=new AbortController;let c=s.current.signal;document.addEventListener(`pointermove`,f,{signal:c}),document.addEventListener(`pointerup`,p,{signal:c}),document.addEventListener(`pointercancel`,m,{signal:c})},f=e=>{let t=o.current;if(!t.isActive||e.pointerId!==t.pointerId)return;let r=[e.clientX-t.startXY[0],e.clientY-t.startXY[1]];if(!t.thresholdMet){let[n,i]=jt(a.current.threshold);if(Math.abs(r[0])<n&&Math.abs(r[1])<i){t.prevXY=[e.clientX,e.clientY],t.prevTimestamp=e.timeStamp;return}t.thresholdMet=!0,u()}let s=n(r),c=[e.clientX-t.prevXY[0],e.clientY-t.prevXY[1]],d=n(c),f=e.timeStamp-t.prevTimestamp,p=f>0?[Math.abs(d[0])/f,Math.abs(d[1])/f]:t.lastVelocity;t.lastVelocity=p;let m=!t.firstFired;t.firstFired=!0,t.prevXY=[e.clientX,e.clientY],t.prevTimestamp=e.timeStamp,i.current({xy:[e.clientX,e.clientY],initial:[...t.startXY],movement:s,delta:d,distance:[Math.abs(s[0]),Math.abs(s[1])],direction:[At(d[0]),At(d[1])],velocity:p,elapsedTime:e.timeStamp-t.startTimestamp,first:m,last:!1,active:!0,tap:!1,canceled:!1,cancel:l,event:e})},p=e=>{let t=o.current;if(!t.isActive||e.pointerId!==t.pointerId)return;let r=a.current;if(!t.thresholdMet){if(r.filterTaps){let a=[e.clientX-t.startXY[0],e.clientY-t.startXY[1]],o=n(a),s=[Math.abs(o[0]),Math.abs(o[1])],c=Math.max(s[0],s[1])<(r.tapThreshold??3);i.current({xy:[e.clientX,e.clientY],initial:[...t.startXY],movement:o,delta:o,distance:s,direction:[At(o[0]),At(o[1])],velocity:[0,0],elapsedTime:e.timeStamp-t.startTimestamp,first:!0,last:!0,active:!1,tap:c,canceled:!1,cancel:l,event:e})}c();return}let s=[e.clientX-t.startXY[0],e.clientY-t.startXY[1]],u=n(s),d=[Math.abs(u[0]),Math.abs(u[1])],f=[e.clientX-t.prevXY[0],e.clientY-t.prevXY[1]],p=n(f),m=e.timeStamp-t.prevTimestamp>kt?[0,0]:t.lastVelocity,h=Math.max(d[0],d[1]),g=r.filterTaps===!0&&h<(r.tapThreshold??3);i.current({xy:[e.clientX,e.clientY],initial:[...t.startXY],movement:u,delta:p,distance:d,direction:[At(p[0]),At(p[1])],velocity:m,elapsedTime:e.timeStamp-t.startTimestamp,first:!t.firstFired,last:!0,active:!1,tap:g,canceled:!1,cancel:l,event:e}),c()},m=e=>{let t=o.current;if(!t.isActive||e.pointerId!==t.pointerId)return;let r=[e.clientX-t.startXY[0],e.clientY-t.startXY[1]],a=n(r);i.current({xy:[e.clientX,e.clientY],initial:[...t.startXY],movement:a,delta:[0,0],distance:[Math.abs(a[0]),Math.abs(a[1])],direction:[0,0],velocity:[0,0],elapsedTime:e.timeStamp-t.startTimestamp,first:!t.firstFired,last:!0,active:!1,tap:!1,canceled:!0,cancel:l,event:e}),c()};return e.addEventListener(`pointerdown`,d,{signal:t.signal}),()=>{t.abort(),s.current?.abort(),s.current=null,o.current.isActive&&(o.current.isActive=!1,r(!1),document.body.style.userSelect=``,document.body.style.webkitUserSelect=``)}},[]),active:n}}function Pt(){return`development`}function Ft(e){return e?.props?.ref}function It(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function Lt(e){let t=C.Children.toArray(e);return t.length!==1||!w(t[0])?null:t[0]}function U(e){return e}function Rt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Rt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function zt(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Rt(e))&&(r&&(r+=` `),r+=t);return r}var Bt={};function Vt(e){let t={};return e.forEach(e=>{Object.entries(e).forEach(([e,n])=>{t[e]?t[e]=zt(t[e],n):t[e]=n})}),t}function Ht({theme:e,classNames:t,props:n,stylesCtx:r}){return Vt((Array.isArray(t)?t:[t]).map(t=>typeof t==`function`?t(e,n,r):t||Bt))}function Ut({theme:e,styles:t,props:n,stylesCtx:r}){let i=Array.isArray(t)?t:[t],a={};for(let t of i)typeof t==`function`?Object.assign(a,t(e,n,r)):t&&Object.assign(a,t);return a}function Wt(e){return e===`auto`||e===`dark`||e===`light`}function Gt({key:e=`mantine-color-scheme-value`}={}){let t;return{get:t=>{if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return Wt(n)?n:t}catch{return t}},set:t=>{try{window.localStorage.setItem(e,t)}catch(e){console.warn(`[@mantine/core] Local storage color scheme manager was unable to save color scheme.`,e)}},subscribe:n=>{t=t=>{t.storageArea===window.localStorage&&t.key===e&&Wt(t.newValue)&&n(t.newValue)},window.addEventListener(`storage`,t)},unsubscribe:()=>{window.removeEventListener(`storage`,t)},clear:()=>{window.localStorage.removeItem(e)}}}function Kt(e,t){return typeof e.primaryShade==`number`?e.primaryShade:t===`dark`?e.primaryShade.dark:e.primaryShade.light}function qt(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function Jt(e){let t=e.replace(`#`,``);if(t.length===3){let e=t.split(``);t=[e[0],e[0],e[1],e[1],e[2],e[2]].join(``)}if(t.length===8){let e=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:e}}let n=parseInt(t,16);return{r:n>>16&255,g:n>>8&255,b:n&255,a:1}}function Yt(e){let[t,n,r,i]=e.replace(/[^0-9,./]/g,``).split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:i===void 0?1:i}}function Xt(e){let t=e.match(/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i);if(!t)return{r:0,g:0,b:0,a:1};let n=parseInt(t[1],10),r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100,a=t[5]?parseFloat(t[5]):void 0,o=(1-Math.abs(2*i-1))*r,s=n/60,c=o*(1-Math.abs(s%2-1)),l=i-o/2,u,d,f;return s>=0&&s<1?(u=o,d=c,f=0):s>=1&&s<2?(u=c,d=o,f=0):s>=2&&s<3?(u=0,d=o,f=c):s>=3&&s<4?(u=0,d=c,f=o):s>=4&&s<5?(u=c,d=0,f=o):(u=o,d=0,f=c),{r:Math.round((u+l)*255),g:Math.round((d+l)*255),b:Math.round((f+l)*255),a:a||1}}function Zt(e){return qt(e)?Jt(e):e.startsWith(`rgb`)?Yt(e):e.startsWith(`hsl`)?Xt(e):{r:0,g:0,b:0,a:1}}function Qt(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function $t(e){let t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function en(e){if(e.startsWith(`oklch(`))return($t(e)||0)/100;let{r:t,g:n,b:r}=Zt(e),i=t/255,a=n/255,o=r/255,s=Qt(i),c=Qt(a),l=Qt(o);return .2126*s+.7152*c+.0722*l}function tn(e,t=.179){return!e.startsWith(`var(`)&&en(e)>t}function nn({color:e,theme:t,colorScheme:n}){if(typeof e!=`string`)throw Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof e}`);if(e===`bright`)return{color:e,value:n===`dark`?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:tn(n===`dark`?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-bright`};if(e===`dimmed`)return{color:e,value:n===`dark`?t.colors.dark[2]:t.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:tn(n===`dark`?t.colors.dark[2]:t.colors.gray[6],t.luminanceThreshold),variable:`--mantine-color-dimmed`};if(e===`white`||e===`black`)return{color:e,value:e===`white`?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:tn(e===`white`?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};let[r,i]=e.split(`.`),a=i?Number(i):void 0,o=r in t.colors;if(o){let e=a===void 0?t.colors[r][Kt(t,n||`light`)]:t.colors[r][a];return{color:r,value:e,shade:a,isThemeColor:o,isLight:tn(e,t.luminanceThreshold),variable:i?`--mantine-color-${r}-${a}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:o,isLight:tn(e,t.luminanceThreshold),shade:a,variable:void 0}}function rn(e,t){let n=nn({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function an(e){return!!e&&typeof e==`object`&&`mantine-virtual-color`in e}function on(e,t){if(e.startsWith(`var(`))return`color-mix(in srgb, ${e}, black ${t*100}%)`;let{r:n,g:r,b:i,a}=Zt(e),o=1-t,s=e=>Math.round(e*o);return`rgba(${s(n)}, ${s(r)}, ${s(i)}, ${a})`}function sn(e,t){let n={from:e?.from||t.defaultGradient.from,to:e?.to||t.defaultGradient.to,deg:e?.deg??t.defaultGradient.deg??0},r=rn(n.from,t),i=rn(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${i} 100%)`}function cn(e,t){if(typeof e!=`string`||t>1||t<0)return`rgba(0, 0, 0, 1)`;if(e.startsWith(`var(`))return`color-mix(in srgb, ${e}, transparent ${(1-t)*100}%)`;if(e.startsWith(`oklch`))return e.includes(`/`)?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(`)`,` / ${t})`);let{r:n,g:r,b:i}=Zt(e);return`rgba(${n}, ${r}, ${i}, ${t})`}var ln=cn,un=({color:e,theme:t,variant:n,gradient:r,autoContrast:i})=>{let a=nn({color:e,theme:t}),o=typeof i==`boolean`?i:t.autoContrast;if(n===`none`)return{background:`transparent`,hover:`transparent`,color:`inherit`,border:`none`};if(n===`filled`){let n=a.isThemeColor&&a.shade===void 0&&an(t.colors[a.color]),r=o?n?`var(--mantine-color-${a.color}-contrast)`:a.isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`:`var(--mantine-color-white)`;return a.isThemeColor?a.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:r,border:`${_(1)} solid transparent`}:{background:`var(--mantine-color-${a.color}-${a.shade})`,hover:`var(--mantine-color-${a.color}-${a.shade===9?8:a.shade+1})`,color:r,border:`${_(1)} solid transparent`}:{background:e,hover:on(e,.1),color:r,border:`${_(1)} solid transparent`}}if(n===`light`){if(a.isThemeColor){if(a.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${_(1)} solid transparent`};let n=t.colors[a.color][a.shade];return{background:n,hover:on(n,.1),color:`var(--mantine-color-${a.color}-light-color)`,border:`${_(1)} solid transparent`}}return{background:cn(e,.1),hover:cn(e,.12),color:e,border:`${_(1)} solid transparent`}}if(n===`outline`)return a.isThemeColor?a.shade===void 0?{background:`transparent`,hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${_(1)} solid var(--mantine-color-${e}-outline)`}:{background:`transparent`,hover:cn(t.colors[a.color][a.shade],.05),color:`var(--mantine-color-${a.color}-${a.shade})`,border:`${_(1)} solid var(--mantine-color-${a.color}-${a.shade})`}:{background:`transparent`,hover:cn(e,.05),color:e,border:`${_(1)} solid ${e}`};if(n===`subtle`){if(a.isThemeColor){if(a.shade===void 0)return{background:`transparent`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${_(1)} solid transparent`};let n=t.colors[a.color][a.shade];return{background:`transparent`,hover:cn(n,.12),color:`var(--mantine-color-${a.color}-${Math.min(a.shade,6)})`,border:`${_(1)} solid transparent`}}return{background:`transparent`,hover:cn(e,.12),color:e,border:`${_(1)} solid transparent`}}return n===`transparent`?a.isThemeColor?a.shade===void 0?{background:`transparent`,hover:`transparent`,color:`var(--mantine-color-${e}-light-color)`,border:`${_(1)} solid transparent`}:{background:`transparent`,hover:`transparent`,color:`var(--mantine-color-${a.color}-${Math.min(a.shade,6)})`,border:`${_(1)} solid transparent`}:{background:`transparent`,hover:`transparent`,color:e,border:`${_(1)} solid transparent`}:n===`white`?a.isThemeColor?a.shade===void 0?{background:`var(--mantine-color-white)`,hover:on(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${_(1)} solid transparent`}:{background:`var(--mantine-color-white)`,hover:on(t.white,.01),color:`var(--mantine-color-${a.color}-${a.shade})`,border:`${_(1)} solid transparent`}:{background:`var(--mantine-color-white)`,hover:on(t.white,.01),color:e,border:`${_(1)} solid transparent`}:n===`gradient`?{background:sn(r,t),hover:sn(r,t),color:`var(--mantine-color-white)`,border:`none`}:n==="default"?{background:`var(--mantine-color-default)`,hover:`var(--mantine-color-default-hover)`,color:`var(--mantine-color-default-color)`,border:`${_(1)} solid var(--mantine-color-default-border)`}:{}};function dn({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&nn({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function fn(e,t,n){return dn({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function pn(e,t){let n=e.colors[e.primaryColor];return an(n)?e.autoContrast?fn(n,e,t):`var(--mantine-color-white)`:dn({color:n[Kt(e,t)],theme:e,autoContrast:null})}function mn(e,t){return typeof e==`boolean`?e:t.autoContrast}var hn=(0,C.createContext)(null);function gn(){let e=(0,C.use)(hn);if(!e)throw Error(`[@mantine/core] MantineProvider was not found in tree`);return e}function _n(){return gn().cssVariablesResolver}function vn(){return gn().classNamesPrefix}function yn(){return gn().getStyleNonce}function bn(){return gn().withStaticClasses}function xn(){return gn().headless}function Sn(){return gn().stylesTransform?.sx}function Cn(){return gn().stylesTransform?.styles}function wn(){return gn().env||`default`}function Tn(){return gn().deduplicateInlineStyles}function En(e,t){let n=typeof window<`u`&&`matchMedia`in window&&window.matchMedia(`(prefers-color-scheme: dark)`)?.matches,r=e===`auto`?n?`dark`:`light`:e;t()?.setAttribute(`data-mantine-color-scheme`,r)}function Dn({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){let i=(0,C.useRef)(null),[a,o]=(0,C.useState)(()=>e.get(t)),s=r||a,c=(0,C.useCallback)(t=>{r||(En(t,n),o(t),e.set(t))},[e.set,s,r]),l=(0,C.useCallback)(()=>{o(t),En(t,n),e.clear()},[e.clear,t]);return(0,C.useEffect)(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),ue(()=>{En(e.get(t),n)},[]),(0,C.useEffect)(()=>{if(r)return En(r,n),()=>{};r===void 0&&En(a,n),typeof window<`u`&&`matchMedia`in window&&(i.current=window.matchMedia(`(prefers-color-scheme: dark)`));let e=e=>{a===`auto`&&En(e.matches?`dark`:`light`,n)};return i.current?.addEventListener(`change`,e),()=>i.current?.removeEventListener(`change`,e)},[a,r]),{colorScheme:s,setColorScheme:c,clearColorScheme:l}}var On=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),kn=o(((e,t)=>{t.exports=On()})),An={dark:[`#C9C9C9`,`#b8b8b8`,`#828282`,`#696969`,`#424242`,`#3b3b3b`,`#2e2e2e`,`#242424`,`#1f1f1f`,`#141414`],gray:[`#f8f9fa`,`#f1f3f5`,`#e9ecef`,`#dee2e6`,`#ced4da`,`#adb5bd`,`#868e96`,`#495057`,`#343a40`,`#212529`],red:[`#fff5f5`,`#ffe3e3`,`#ffc9c9`,`#ffa8a8`,`#ff8787`,`#ff6b6b`,`#fa5252`,`#f03e3e`,`#e03131`,`#c92a2a`],pink:[`#fff0f6`,`#ffdeeb`,`#fcc2d7`,`#faa2c1`,`#f783ac`,`#f06595`,`#e64980`,`#d6336c`,`#c2255c`,`#a61e4d`],grape:[`#f8f0fc`,`#f3d9fa`,`#eebefa`,`#e599f7`,`#da77f2`,`#cc5de8`,`#be4bdb`,`#ae3ec9`,`#9c36b5`,`#862e9c`],violet:[`#f3f0ff`,`#e5dbff`,`#d0bfff`,`#b197fc`,`#9775fa`,`#845ef7`,`#7950f2`,`#7048e8`,`#6741d9`,`#5f3dc4`],indigo:[`#edf2ff`,`#dbe4ff`,`#bac8ff`,`#91a7ff`,`#748ffc`,`#5c7cfa`,`#4c6ef5`,`#4263eb`,`#3b5bdb`,`#364fc7`],blue:[`#e7f5ff`,`#d0ebff`,`#a5d8ff`,`#74c0fc`,`#4dabf7`,`#339af0`,`#228be6`,`#1c7ed6`,`#1971c2`,`#1864ab`],cyan:[`#e3fafc`,`#c5f6fa`,`#99e9f2`,`#66d9e8`,`#3bc9db`,`#22b8cf`,`#15aabf`,`#1098ad`,`#0c8599`,`#0b7285`],teal:[`#e6fcf5`,`#c3fae8`,`#96f2d7`,`#63e6be`,`#38d9a9`,`#20c997`,`#12b886`,`#0ca678`,`#099268`,`#087f5b`],green:[`#ebfbee`,`#d3f9d8`,`#b2f2bb`,`#8ce99a`,`#69db7c`,`#51cf66`,`#40c057`,`#37b24d`,`#2f9e44`,`#2b8a3e`],lime:[`#f4fce3`,`#e9fac8`,`#d8f5a2`,`#c0eb75`,`#a9e34b`,`#94d82d`,`#82c91e`,`#74b816`,`#66a80f`,`#5c940d`],yellow:[`#fff9db`,`#fff3bf`,`#ffec99`,`#ffe066`,`#ffd43b`,`#fcc419`,`#fab005`,`#f59f00`,`#f08c00`,`#e67700`],orange:[`#fff4e6`,`#ffe8cc`,`#ffd8a8`,`#ffc078`,`#ffa94d`,`#ff922b`,`#fd7e14`,`#f76707`,`#e8590c`,`#d9480f`]},jn=`-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji`,Mn={scale:1,fontSmoothing:!0,focusRing:`auto`,white:`#fff`,black:`#000`,colors:An,primaryShade:{light:6,dark:8},primaryColor:`blue`,variantColorResolver:un,autoContrast:!1,luminanceThreshold:.3,fontFamily:jn,fontFamilyMonospace:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace`,respectReducedMotion:!1,cursorType:`default`,defaultGradient:{from:`blue`,to:`cyan`,deg:45},defaultRadius:`md`,activeClassName:`mantine-active`,focusClassName:``,headings:{fontFamily:jn,fontWeight:`700`,textWrap:`wrap`,sizes:{h1:{fontSize:_(34),lineHeight:`1.3`},h2:{fontSize:_(26),lineHeight:`1.35`},h3:{fontSize:_(22),lineHeight:`1.4`},h4:{fontSize:_(18),lineHeight:`1.45`},h5:{fontSize:_(16),lineHeight:`1.5`},h6:{fontSize:_(14),lineHeight:`1.5`}}},fontSizes:{xs:_(12),sm:_(14),md:_(16),lg:_(18),xl:_(20)},lineHeights:{xs:`1.4`,sm:`1.45`,md:`1.55`,lg:`1.6`,xl:`1.65`},fontWeights:{regular:`400`,medium:`600`,bold:`700`},radius:{xs:_(2),sm:_(4),md:_(8),lg:_(16),xl:_(32)},spacing:{xs:_(10),sm:_(12),md:_(16),lg:_(20),xl:_(32)},breakpoints:{xs:`36em`,sm:`48em`,md:`62em`,lg:`75em`,xl:`88em`},shadows:{xs:`0 ${_(1)} ${_(3)} rgba(0, 0, 0, 0.05), 0 ${_(1)} ${_(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${_(1)} ${_(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_(10)} ${_(15)} ${_(-5)}, rgba(0, 0, 0, 0.04) 0 ${_(7)} ${_(7)} ${_(-5)}`,md:`0 ${_(1)} ${_(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_(20)} ${_(25)} ${_(-5)}, rgba(0, 0, 0, 0.04) 0 ${_(10)} ${_(10)} ${_(-5)}`,lg:`0 ${_(1)} ${_(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_(28)} ${_(23)} ${_(-7)}, rgba(0, 0, 0, 0.04) 0 ${_(12)} ${_(12)} ${_(-7)}`,xl:`0 ${_(1)} ${_(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${_(36)} ${_(28)} ${_(-7)}, rgba(0, 0, 0, 0.04) 0 ${_(17)} ${_(17)} ${_(-7)}`},other:{},components:{}},Nn=`[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color`,Pn=`[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }`;function Fn(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function In(e){if(!(e.primaryColor in e.colors))throw Error(Nn);if(typeof e.primaryShade==`object`&&(!Fn(e.primaryShade.dark)||!Fn(e.primaryShade.light))||typeof e.primaryShade==`number`&&!Fn(e.primaryShade))throw Error(Pn)}function Ln(e,t){if(!t)return In(e),e;let n=d(e,t);return t.fontFamily&&!t.headings?.fontFamily&&(n.headings={...n.headings,fontFamily:t.fontFamily}),In(n),n}var W=kn(),Rn=(0,C.createContext)(null),zn=()=>(0,C.use)(Rn)||Mn;function Bn(){let e=(0,C.use)(Rn);if(!e)throw Error(`@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app`);return e}function Vn({theme:e,children:t,inherit:n=!0}){let r=zn(),i=(0,C.useMemo)(()=>Ln(n?r:Mn,e),[e,r,n]);return(0,W.jsx)(Rn,{value:i,children:t})}Vn.displayName=`@mantine/core/MantineThemeProvider`;function Hn(e){return Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(``)}function Un(e,t){let n=t?[t]:[`:root`,`:host`],r=Hn(e.variables),i=r?`${n.join(`, `)}{${r}}`:``,a=Hn(e.dark),o=Hn(e.light),s=e=>n.map(t=>t===`:host`?`${t}([data-mantine-color-scheme="${e}"])`:`${t}[data-mantine-color-scheme="${e}"]`).join(`, `);return`${i}\n\n${a?`${s(`dark`)}{${a}}`:``}\n\n${o?`${s(`light`)}{${o}}`:``}`}function Wn({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:i=!0}){if(!e.colors[t])return{};if(n===`light`){let n=Kt(e,`light`),a={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${n===9?8:n+1})`,[`--mantine-color-${r}-light`]:`var(--mantine-color-${r}-1)`,[`--mantine-color-${r}-light-hover`]:`var(--mantine-color-${r}-2)`,[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-9)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-outline-hover`]:ln(e.colors[t][n],.05)};return i?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...a}:a}let a=Kt(e,`dark`),o={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${a===9?8:a+1})`,[`--mantine-color-${r}-light`]:on(e.colors[t][9],.5),[`--mantine-color-${r}-light-hover`]:on(e.colors[t][9],.3),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-0)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(a-4,0)})`,[`--mantine-color-${r}-outline-hover`]:ln(e.colors[t][Math.max(a-4,0)],.05)};return i?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...o}:o}function Gn(e,t,n){l(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}var Kn=e=>{let t=Kt(e,`light`),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:_(e.defaultRadius),r={variables:{"--mantine-z-index-app":`100`,"--mantine-z-index-modal":`200`,"--mantine-z-index-popover":`300`,"--mantine-z-index-overlay":`400`,"--mantine-z-index-max":`9999`,"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?`antialiased`:`unset`,"--mantine-moz-font-smoothing":e.fontSmoothing?`grayscale`:`unset`,"--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-color-scheme":`light`,"--mantine-primary-color-contrast":pn(e,`light`),"--mantine-color-bright":`var(--mantine-color-black)`,"--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":`var(--mantine-color-red-6)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-gray-5)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":`var(--mantine-color-white)`,"--mantine-color-default-hover":`var(--mantine-color-gray-0)`,"--mantine-color-default-color":`var(--mantine-color-black)`,"--mantine-color-default-border":`var(--mantine-color-gray-4)`,"--mantine-color-dimmed":`var(--mantine-color-gray-6)`,"--mantine-color-disabled":`var(--mantine-color-gray-2)`,"--mantine-color-disabled-color":`var(--mantine-color-gray-5)`,"--mantine-color-disabled-border":`var(--mantine-color-gray-3)`},dark:{"--mantine-color-scheme":`dark`,"--mantine-primary-color-contrast":pn(e,`dark`),"--mantine-color-bright":`var(--mantine-color-white)`,"--mantine-color-text":`var(--mantine-color-dark-0)`,"--mantine-color-body":`var(--mantine-color-dark-7)`,"--mantine-color-error":`var(--mantine-color-red-8)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-dark-3)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":`var(--mantine-color-dark-6)`,"--mantine-color-default-hover":`var(--mantine-color-dark-5)`,"--mantine-color-default-color":`var(--mantine-color-white)`,"--mantine-color-default-border":`var(--mantine-color-dark-4)`,"--mantine-color-dimmed":`var(--mantine-color-dark-2)`,"--mantine-color-disabled":`var(--mantine-color-dark-6)`,"--mantine-color-disabled-color":`var(--mantine-color-dark-3)`,"--mantine-color-disabled-border":`var(--mantine-color-dark-4)`}};Gn(r.variables,e.breakpoints,`breakpoint`),Gn(r.variables,e.spacing,`spacing`),Gn(r.variables,e.fontSizes,`font-size`),Gn(r.variables,e.lineHeights,`line-height`),Gn(r.variables,e.shadows,`shadow`),Gn(r.variables,e.radius,`radius`),Gn(r.variables,e.fontWeights,`font-weight`),e.colors[e.primaryColor].forEach((t,n)=>{r.variables[`--mantine-primary-color-${n}`]=`var(--mantine-color-${e.primaryColor}-${n})`}),l(e.colors).forEach(t=>{let n=e.colors[t];an(n)?(Object.assign(r.light,Wn({theme:e,name:n.name,color:n.light,colorScheme:`light`,withColorValues:!0})),Object.assign(r.dark,Wn({theme:e,name:n.name,color:n.dark,colorScheme:`dark`,withColorValues:!0})),r.light[`--mantine-color-${n.name}-contrast`]=fn(n,e,`light`),r.dark[`--mantine-color-${n.name}-contrast`]=fn(n,e,`dark`)):(n.forEach((e,n)=>{r.variables[`--mantine-color-${t}-${n}`]=e}),Object.assign(r.light,Wn({theme:e,color:t,colorScheme:`light`,withColorValues:!1})),Object.assign(r.dark,Wn({theme:e,color:t,colorScheme:`dark`,withColorValues:!1})))});let i=e.headings.sizes;return l(i).forEach(t=>{r.variables[`--mantine-${t}-font-size`]=i[t].fontSize,r.variables[`--mantine-${t}-line-height`]=i[t].lineHeight,r.variables[`--mantine-${t}-font-weight`]=i[t].fontWeight||e.headings.fontWeight}),r};function qn(){let e=Bn(),t=yn(),n=l(e.breakpoints).reduce((t,n)=>{let r=e.breakpoints[n].includes(`px`),i=m(e.breakpoints[n]);return`${t}@media (max-width: ${r?`${i-.1}px`:v(i-.1)}) {.mantine-visible-from-${n} {display: none !important;}}@media (min-width: ${r?`${i}px`:v(i)}) {.mantine-hidden-from-${n} {display: none !important;}}`},``);return(0,W.jsx)(`style`,{"data-mantine-styles":`classes`,nonce:t?.(),dangerouslySetInnerHTML:{__html:n}})}function Jn({theme:e,generator:t}){let n=Kn(e),r=t?.(e);return r?d(n,r):n}var Yn=Kn(Mn);function Xn(e){let t={variables:{},light:{},dark:{}};return l(e.variables).forEach(n=>{Yn.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),l(e.light).forEach(n=>{Yn.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),l(e.dark).forEach(n=>{Yn.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function Zn(e){return Un({variables:{},dark:{"--mantine-color-scheme":`dark`},light:{"--mantine-color-scheme":`light`}},e)}function Qn({cssVariablesSelector:e,deduplicateCssVariables:t}){let n=Bn(),r=yn(),i=Jn({theme:n,generator:_n()}),a=(e===void 0||e===`:root`||e===`:host`)&&t,o=Un(a?Xn(i):i,e);return o?(0,W.jsx)(`style`,{"data-mantine-styles":!0,nonce:r?.(),dangerouslySetInnerHTML:{__html:`${o}${a?``:Zn(e)}`}}):null}Qn.displayName=`@mantine/CssVariables`;function $n({respectReducedMotion:e,getRootElement:t}){ue(()=>{e&&t()?.setAttribute(`data-respect-reduced-motion`,`true`)},[e])}function er({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:i=!0,deduplicateCssVariables:a=!0,withCssVariables:o=!0,cssVariablesSelector:s,classNamesPrefix:c=`mantine`,colorSchemeManager:l=Gt(),defaultColorScheme:u=`light`,getRootElement:d=()=>document.documentElement,cssVariablesResolver:f,forceColorScheme:p,stylesTransform:m,env:h,deduplicateInlineStyles:g=!1}){let{colorScheme:_,setColorScheme:v,clearColorScheme:y}=Dn({defaultColorScheme:u,forceColorScheme:p,manager:l,getRootElement:d});return $n({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:d}),(0,W.jsx)(hn,{value:{colorScheme:_,setColorScheme:v,clearColorScheme:y,getRootElement:d,classNamesPrefix:c,getStyleNonce:n,cssVariablesResolver:f,cssVariablesSelector:s??`:root`,withStaticClasses:r,stylesTransform:m,env:h,deduplicateInlineStyles:g},children:(0,W.jsxs)(Vn,{theme:e,children:[o&&(0,W.jsx)(Qn,{cssVariablesSelector:s,deduplicateCssVariables:a}),i&&(0,W.jsx)(qn,{}),t]})})}er.displayName=`@mantine/core/MantineProvider`;function G(e,t,n){let r=Bn(),i=(Array.isArray(e)?e:[e]).filter(Boolean),a={};for(let e of i){let t=r.components[e]?.defaultProps,n=typeof t==`function`?t(r):t;n&&(a={...a,...n})}return{...t,...a,...y(n)}}function tr(e){return e}function nr({classNames:e,styles:t,props:n,stylesCtx:r}){let i=Bn();return{resolvedClassNames:e===void 0?void 0:Ht({theme:i,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:t===void 0?void 0:Ut({theme:i,styles:t,props:n,stylesCtx:r||void 0})}}var rr={always:`mantine-focus-always`,auto:`mantine-focus-auto`,never:`mantine-focus-never`};function ir({theme:e,options:t,unstyled:n}){return zt(t?.focusable&&!n&&(e.focusClassName||rr[e.focusRing]),t?.active&&!n&&e.activeClassName)}function ar(e,t,n=1){if(Object.is(e,t))return!0;if(n===0||typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(!ar(e[r],t[r],n-1))return!1;return!0}let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let i of r)if(!Object.hasOwn(t,i)||!ar(e[i],t[i],n-1))return!1;return!0}function or({selector:e,stylesCtx:t,options:n,props:r,theme:i}){return Ht({theme:i,classNames:n?.classNames,props:n?.props||r,stylesCtx:t})[e]}function sr({selector:e,stylesCtx:t,theme:n,classNames:r,props:i}){return Ht({theme:n,classNames:r,props:i,stylesCtx:t})[e]}function cr({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function lr({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function ur({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(e=>`${t}-${e}-${n}`)}function dr({options:e,classes:t,selector:n,unstyled:r}){return e?.variant&&!r?t[`${n}--${e.variant}`]:void 0}function fr({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:i,resolvedClassNames:a,resolvedThemeClassNames:o,classes:s,unstyled:c,className:l,rootSelector:u,props:d,stylesCtx:f,withStaticClasses:p,headless:m,transformedStyles:h}){return zt(ir({theme:e,options:t,unstyled:c||m}),o.map(e=>e[r]),dr({options:t,classes:s,selector:r,unstyled:c||m}),a[r],sr({selector:r,stylesCtx:f,theme:e,classNames:h,props:d}),or({selector:r,stylesCtx:f,options:t,props:d,theme:e}),cr({rootSelector:u,selector:r,className:l}),lr({selector:r,classes:s,unstyled:c||m}),p&&!m&&ur({themeName:n,classNamesPrefix:i,selector:r,withStaticClass:t?.withStaticClass}),t?.className)}function pr({style:e,theme:t}){return Array.isArray(e)?e.reduce((e,n)=>({...e,...pr({style:n,theme:t})}),{}):typeof e==`function`?e(t):e??{}}function mr({theme:e,selector:t,options:n,props:r,stylesCtx:i,rootSelector:a,withStylesTransform:o,resolvedStyles:s,resolvedThemeStyles:c,resolvedVars:l,resolvedRootStyle:u}){return{...c[t],...s[t],...!o&&Ut({theme:e,styles:n?.styles,props:n?.props||r,stylesCtx:i})[t],...l[t],...a===t?u:null,...pr({style:n?.style,theme:e})}}function hr(e){return e.reduce((e,t)=>(t&&Object.keys(t).forEach(n=>{e[n]={...e[n],...y(t[n])}}),e),{})}function gr({props:e,stylesCtx:t,themeName:n,theme:r}){let i=Cn()?.();return{getTransformedStyles:a=>i?[...a.map(n=>i(n,{props:e,theme:r,ctx:t})),...n.map(n=>i(r.components[n]?.styles,{props:e,theme:r,ctx:t}))].filter(Boolean):[],withStylesTransform:!!i}}function K({name:e,classes:t,props:n,stylesCtx:r,className:i,style:a,rootSelector:o=`root`,unstyled:s,classNames:c,styles:l,vars:u,varsResolver:d,attributes:f,stable:p}){let m=Bn(),h=vn(),g=bn(),_=xn(),v=(Array.isArray(e)?e:[e]).filter(e=>e),{withStylesTransform:y,getTransformedStyles:b}=gr({props:n,stylesCtx:r,themeName:v,theme:m}),x=Ht({theme:m,classNames:c,props:n,stylesCtx:r}),S=v.map(e=>Ht({theme:m,classNames:m.components[e]?.classNames,props:n,stylesCtx:r})),C=y?{}:Ut({theme:m,styles:l,props:n,stylesCtx:r}),w={};if(!y)for(let e of v){let t=Ut({theme:m,styles:m.components[e]?.styles,props:n,stylesCtx:r});for(let e of Object.keys(t))w[e]={...w[e],...t[e]}}let T=hr([_?{}:d?.(m,n,r),...v.map(e=>m.components?.[e]?.vars?.(m,n,r)),u?.(m,n,r)]),E=pr({style:a,theme:m});return _r((e,a)=>({...f?.[e],className:fr({theme:m,options:a,themeName:v,selector:e,classNamesPrefix:h,resolvedClassNames:x,resolvedThemeClassNames:S,classes:t,unstyled:s,className:i,rootSelector:o,props:n,stylesCtx:r,withStaticClasses:g,headless:_,transformedStyles:b([a?.styles,l])}),style:mr({theme:m,selector:e,options:a,props:n,stylesCtx:r,rootSelector:o,withStylesTransform:y,resolvedStyles:C,resolvedThemeStyles:w,resolvedVars:T,resolvedRootStyle:E})}),!!p,[m,h,g,_,y?n:null,t,s,i,o,f,r,x,S,C,w,T,E])}function _r(e,t,n){let r=(0,C.useRef)(null);return t?((!r.current||!ar(r.current.deps,n,3))&&(r.current={deps:n,getStyles:e}),r.current.getStyles):e}function vr(e){return l(e).reduce((t,n)=>e[n]===void 0?t:`${t}${f(n)}:${e[n]};`,``).trim()}function yr({selector:e,styles:t,media:n,container:r}){let i=t?vr(t):``,a=Array.isArray(n)?n.map(t=>`@media${t.query}{${e}{${vr(t.styles)}}}`):[],o=Array.isArray(r)?r.map(t=>`@container ${t.query}{${e}{${vr(t.styles)}}}`):[];return`${i?`${e}{${i}}`:``}${a.join(``)}${o.join(``)}`.trim()}function br(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return(t>>>0).toString(36)}function xr({deduplicate:e,...t}){let n=yn(),r=yr(t);return e?(0,W.jsx)(`style`,{href:`mantine-${br(r)}`,precedence:`mantine`,nonce:n?.(),children:r}):(0,W.jsx)(`style`,{"data-mantine-styles":`inline`,nonce:n?.(),dangerouslySetInnerHTML:{__html:r}})}function Sr(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return(t>>>0).toString(36)}function Cr(e,t){return`__mdi__-${Sr(`${e?vr(e):``}|${Array.isArray(t)?t.map(e=>`${e.query}:${vr(e.styles)}`).join(`|`):``}`)}`}function wr(e){let{m:t,mx:n,my:r,mt:i,mb:a,ml:o,mr:s,me:c,ms:l,mis:u,mie:d,p:f,px:p,py:m,pt:h,pb:g,pl:_,pr:v,pe:b,ps:x,pis:S,pie:C,bd:w,bdrs:T,bg:E,c:D,opacity:O,ff:k,fz:A,fw:j,lts:M,ta:N,lh:ee,fs:P,tt:F,td:I,w:L,miw:R,maw:te,h:ne,mih:re,mah:ie,bgsz:ae,bgp:oe,bgr:se,bga:ce,pos:le,top:z,left:B,bottom:V,right:ue,inset:de,display:fe,flex:pe,hiddenFrom:H,visibleFrom:me,lightHidden:he,darkHidden:ge,sx:_e,...ve}=e;return{styleProps:y({m:t,mx:n,my:r,mt:i,mb:a,ml:o,mr:s,me:c,ms:l,mis:u,mie:d,p:f,px:p,py:m,pt:h,pb:g,pl:_,pr:v,pis:S,pie:C,pe:b,ps:x,bd:w,bg:E,c:D,opacity:O,ff:k,fz:A,fw:j,lts:M,ta:N,lh:ee,fs:P,tt:F,td:I,w:L,miw:R,maw:te,h:ne,mih:re,mah:ie,bgsz:ae,bgp:oe,bgr:se,bga:ce,pos:le,top:z,left:B,bottom:V,right:ue,inset:de,display:fe,flex:pe,bdrs:T,hiddenFrom:H,visibleFrom:me,lightHidden:he,darkHidden:ge,sx:_e}),rest:ve}}var Tr={m:{type:`spacing`,property:`margin`},mt:{type:`spacing`,property:`marginTop`},mb:{type:`spacing`,property:`marginBottom`},ml:{type:`spacing`,property:`marginLeft`},mr:{type:`spacing`,property:`marginRight`},ms:{type:`spacing`,property:`marginInlineStart`},me:{type:`spacing`,property:`marginInlineEnd`},mis:{type:`spacing`,property:`marginInlineStart`},mie:{type:`spacing`,property:`marginInlineEnd`},mx:{type:`spacing`,property:`marginInline`},my:{type:`spacing`,property:`marginBlock`},p:{type:`spacing`,property:`padding`},pt:{type:`spacing`,property:`paddingTop`},pb:{type:`spacing`,property:`paddingBottom`},pl:{type:`spacing`,property:`paddingLeft`},pr:{type:`spacing`,property:`paddingRight`},ps:{type:`spacing`,property:`paddingInlineStart`},pe:{type:`spacing`,property:`paddingInlineEnd`},pis:{type:`spacing`,property:`paddingInlineStart`},pie:{type:`spacing`,property:`paddingInlineEnd`},px:{type:`spacing`,property:`paddingInline`},py:{type:`spacing`,property:`paddingBlock`},bd:{type:`border`,property:`border`},bdrs:{type:`radius`,property:`borderRadius`},bg:{type:`color`,property:`background`},c:{type:`textColor`,property:`color`},opacity:{type:`identity`,property:`opacity`},ff:{type:`fontFamily`,property:`fontFamily`},fz:{type:`fontSize`,property:`fontSize`},fw:{type:`identity`,property:`fontWeight`},lts:{type:`size`,property:`letterSpacing`},ta:{type:`identity`,property:`textAlign`},lh:{type:`lineHeight`,property:`lineHeight`},fs:{type:`identity`,property:`fontStyle`},tt:{type:`identity`,property:`textTransform`},td:{type:`identity`,property:`textDecoration`},w:{type:`spacing`,property:`width`},miw:{type:`spacing`,property:`minWidth`},maw:{type:`spacing`,property:`maxWidth`},h:{type:`spacing`,property:`height`},mih:{type:`spacing`,property:`minHeight`},mah:{type:`spacing`,property:`maxHeight`},bgsz:{type:`size`,property:`backgroundSize`},bgp:{type:`identity`,property:`backgroundPosition`},bgr:{type:`identity`,property:`backgroundRepeat`},bga:{type:`identity`,property:`backgroundAttachment`},pos:{type:`identity`,property:`position`},top:{type:`size`,property:`top`},left:{type:`size`,property:`left`},bottom:{type:`size`,property:`bottom`},right:{type:`size`,property:`right`},inset:{type:`size`,property:`inset`},display:{type:`identity`,property:`display`},flex:{type:`identity`,property:`flex`}};function Er(e,t){let n=nn({color:e,theme:t});return n.color===`dimmed`?`var(--mantine-color-dimmed)`:n.color===`bright`?`var(--mantine-color-bright)`:n.variable?`var(${n.variable})`:n.color}function Dr(e,t){let n=nn({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:Er(e,t)}function Or(e,t){if(typeof e==`number`)return _(e);if(typeof e==`string`){let[n,r,...i]=e.split(` `).filter(e=>e.trim()!==``),a=`${_(n)}`;return r&&(a+=` ${r}`),i.length>0&&(a+=` ${Er(i.join(` `),t)}`),a.trim()}return e}var kr={text:`var(--mantine-font-family)`,mono:`var(--mantine-font-family-monospace)`,monospace:`var(--mantine-font-family-monospace)`,heading:`var(--mantine-font-family-headings)`,headings:`var(--mantine-font-family-headings)`};function Ar(e){return typeof e==`string`&&e in kr?kr[e]:e}var jr=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`];function Mr(e,t){return typeof e==`string`&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e==`string`&&jr.includes(e)?`var(--mantine-${e}-font-size)`:typeof e==`number`||typeof e==`string`?_(e):e}function Nr(e){return e}var Pr=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`];function Fr(e,t){return typeof e==`string`&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e==`string`&&Pr.includes(e)?`var(--mantine-${e}-line-height)`:e}function Ir(e,t){return typeof e==`string`&&e in t.radius?`var(--mantine-radius-${e})`:typeof e==`number`||typeof e==`string`?_(e):e}function Lr(e){return typeof e==`number`?_(e):e}function Rr(e,t){if(typeof e==`number`)return _(e);if(typeof e==`string`){let n=e.replace(`-`,``);if(!(n in t.spacing))return _(e);let r=`--mantine-spacing-${n}`;return e.startsWith(`-`)?`calc(var(${r}) * -1)`:`var(${r})`}return e}var zr={color:Er,textColor:Dr,fontSize:Mr,spacing:Rr,radius:Ir,identity:Nr,size:Lr,lineHeight:Fr,fontFamily:Ar,border:Or};function Br(e){return e.replace(`(min-width: `,``).replace(`em)`,``)}function Vr({media:e,...t}){let n=Object.keys(e).sort((e,t)=>Number(Br(e))-Number(Br(t))).map(t=>({query:t,styles:e[t]}));return{...t,media:n}}function Hr(e){if(typeof e!=`object`||!e)return!1;let t=Object.keys(e);return t.length!==1||t[0]!==`base`}function Ur(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function Wr(e){return typeof e==`object`&&e?l(e).filter(e=>e!==`base`):[]}function Gr(e,t){return typeof e==`object`&&e&&t in e?e[t]:e}function Kr({styleProps:e,data:t,theme:n}){return Vr(l(e).reduce((r,i)=>{if(i===`hiddenFrom`||i===`visibleFrom`||i===`sx`)return r;let a=t[i],o=Array.isArray(a.property)?a.property:[a.property],s=Ur(e[i]);if(!Hr(e[i]))return o.forEach(e=>{r.inlineStyles[e]=zr[a.type](s,n)}),r;r.hasResponsiveStyles=!0;let c=Wr(e[i]);return o.forEach(t=>{s!=null&&(r.styles[t]=zr[a.type](s,n)),c.forEach(o=>{let s=`(min-width: ${n.breakpoints[o]})`;r.media[s]={...r.media[s],[t]:zr[a.type](Gr(e[i],o),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function qr(){return`__m__-${(0,C.useId)().replace(/[:«»]/g,``)}`}function Jr(e,t){return Array.isArray(e)?[...e].reduce((e,n)=>({...e,...Jr(n,t)}),{}):typeof e==`function`?e(t):e??{}}function Yr(e){return e}var Xr=Yr;function Zr(e){return e}function q(e){let t=e;return t.extend=Zr,t.withProps=e=>{let n=n=>(0,W.jsx)(t,{...e,...n});return n.extend=t.extend,n.displayName=`WithProps(${t.displayName})`,n},t}function Qr(e){return q(e)}function $r(e){let t=e;return t.withProps=e=>{let n=n=>(0,W.jsx)(t,{...e,...n});return n.extend=t.extend,n.displayName=`WithProps(${t.displayName})`,n},t.extend=Zr,t}function ei(e){return`data-${(e.startsWith(`data-`)?e.slice(5):e).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}`}function ti(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r===void 0||r===``||r===!1||r===null||(t[ei(n)]=e[n]),t},{})}function ni(e){return e?typeof e==`string`?{[ei(e)]:!0}:Array.isArray(e)?[...e].reduce((e,t)=>({...e,...ni(t)}),{}):ti(e):null}function ri(e,t){return Array.isArray(e)?[...e].reduce((e,n)=>({...e,...ri(n,t)}),{}):typeof e==`function`?e(t):e??{}}function ii({theme:e,style:t,vars:n,styleProps:r}){let i=ri(t,e),a=ri(n,e);return{...i,...a,...r}}function ai({component:e,style:t,__vars:n,className:r,variant:i,mod:a,size:o,hiddenFrom:s,visibleFrom:c,lightHidden:l,darkHidden:u,renderRoot:d,__size:f,ref:p,...m}){let h=Bn(),g=e||`div`,{styleProps:_,rest:v}=wr(m),y=Sn()?.()?.(_.sx),x=qr(),S=Kr({styleProps:_,theme:h,data:Tr}),C=Tn(),w=C&&S.hasResponsiveStyles?Cr(S.styles,S.media):x,T={ref:p,style:ii({theme:h,style:t,vars:n,styleProps:S.inlineStyles}),className:zt(r,y,{[w]:S.hasResponsiveStyles,"mantine-light-hidden":l,"mantine-dark-hidden":u,[`mantine-hidden-from-${s}`]:s,[`mantine-visible-from-${c}`]:c}),"data-variant":i,"data-size":b(o)?void 0:o||void 0,size:f,...ni(a),...v};return(0,W.jsxs)(W.Fragment,{children:[S.hasResponsiveStyles&&(0,W.jsx)(xr,{selector:`.${w}`,styles:S.styles,media:S.media,deduplicate:C}),typeof d==`function`?d(T):(0,W.jsx)(g,{...T})]})}ai.displayName=`@mantine/core/Box`;var J=Xr(ai),oi=(0,C.createContext)({dir:`ltr`,toggleDirection:()=>{},setDirection:()=>{}});function si(){return(0,C.use)(oi)}var ci={transitionDuration:200,transitionTimingFunction:`ease`,animateOpacity:!0,orientation:`vertical`,keepMounted:!0,keepMountedMode:`activity`},li=q(e=>{let{children:t,expanded:n,transitionDuration:r,transitionTimingFunction:i,style:a,onTransitionEnd:o,onTransitionStart:s,animateOpacity:c,keepMounted:l,keepMountedMode:u,ref:d,orientation:f,...p}=G(`Collapse`,ci,e),m=wn(),h=Bn(),g=Xe(),_=h.respectReducedMotion&&g?0:r,v=(f===`horizontal`?Ot:Tt)({expanded:n,transitionDuration:_,transitionTimingFunction:i,onTransitionEnd:o,onTransitionStart:s,keepMounted:!1});if(_===0)return l===!0&&(u===`display-none`||m!==`test`)?u===`display-none`?(0,W.jsx)(J,{...p,style:{...Jr(a,h),...n?{}:{display:`none`}},ref:d,children:t}):(0,W.jsx)(C.Activity,{mode:n?`visible`:`hidden`,children:(0,W.jsx)(J,{...p,style:a,ref:d,children:t})}):n?(0,W.jsx)(J,{...p,style:a,ref:d,children:t}):null;let y=v.state===`exited`,b;return b=l===!1?y?null:t:l===!0?u===`display-none`?t:(0,W.jsx)(C.Activity,{mode:y?`hidden`:`visible`,children:t}):t,(0,W.jsx)(J,{...p,...v.getCollapseProps({style:{opacity:n||!c?1:0,transition:c?`opacity ${_}ms ${i}`:`none`,...Jr(a,h),...l&&u===`display-none`&&y?{display:`none`}:{}},ref:d}),children:b})});li.displayName=`@mantine/core/Collapse`;var[ui,di]=T(`ScrollArea.Root component was not found in tree`);function fi(e,t){let n=(0,C.useEffectEvent)(t);ue(()=>{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])}function pi(e){let{style:t,...n}=e,r=di(),[i,a]=(0,C.useState)(0),[o,s]=(0,C.useState)(0),c=!!(i&&o);return fi(r.scrollbarX,()=>{let e=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(e),s(e)}),fi(r.scrollbarY,()=>{let e=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(e),a(e)}),c?(0,W.jsx)(`div`,{...n,style:{...t,width:i,height:o}}):null}function mi(e){let t=di(),n=!!(t.scrollbarX&&t.scrollbarY);return t.type!==`scroll`&&n?(0,W.jsx)(pi,{...e}):null}var hi={scrollHideDelay:1e3,type:`hover`};function gi(e){let{type:t,scrollHideDelay:n,scrollbars:r,getStyles:i,ref:a,...o}=G(`ScrollAreaRoot`,hi,e),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(null),[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(0),[y,b]=(0,C.useState)(0),[x,S]=(0,C.useState)(!1),[w,T]=(0,C.useState)(!1),E=Je(a,c);return(0,W.jsx)(ui,{value:{type:t,scrollHideDelay:n,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:b,getStyles:i},children:(0,W.jsx)(J,{...o,ref:E,__vars:{"--sa-corner-width":r===`xy`?`${_}px`:`0px`,"--sa-corner-height":r===`xy`?`${y}px`:`0px`}})})}gi.displayName=`@mantine/core/ScrollAreaRoot`;function _i(e,t){let n=e/t;return Number.isNaN(n)?0:n}function vi(e){let t=_i(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function yi(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 bi(e,[t,n]){return Math.min(n,Math.max(t,e))}function xi(e,t,n=`ltr`){let r=vi(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=bi(e,n===`ltr`?[0,o]:[o*-1,0]);return yi([0,o],[0,s])(c)}function Si(e,t,n,r=`ltr`){let i=vi(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 yi([c,l],d)(e)}function Ci(e,t){return e>0&&e<t}function wi(e){return e?parseInt(e,10):0}function Ti(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e?.(r),(n===!1||!r.defaultPrevented)&&t?.(r)}}var[Ei,Di]=T(`ScrollAreaScrollbar was not found in tree`);function Oi(e){let{sizes:t,hasThumb:n,onThumbChange:r,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:o,onDragScroll:s,onWheelScroll:c,onResize:l,ref:u,...d}=e,f=di(),[p,m]=(0,C.useState)(null),h=Je(u,m),g=(0,C.useRef)(null),_=(0,C.useRef)(``),v=t.content-t.viewport,y=(0,C.useEffectEvent)(e=>c(e,v)),b=se(o),x=ce(l,10),S=e=>{if(g.current){let t=e.clientX-g.current.left,n=e.clientY-g.current.top;s({x:t,y:n})}};return(0,C.useEffect)(()=>{if(!p)return;let e=e=>y(e);return p.addEventListener(`wheel`,e,{passive:!1}),()=>p.removeEventListener(`wheel`,e)},[p]),(0,C.useEffect)(b,[t,b]),fi(p,x),fi(f.content,x),(0,W.jsx)(Ei,{value:{scrollbar:p,hasThumb:n,onThumbChange:se(r),onThumbPointerUp:se(i),onThumbPositionChange:b,onThumbPointerDown:se(a)},children:(0,W.jsx)(`div`,{...d,ref:h,"data-mantine-scrollbar":!0,style:{position:`absolute`,...d.style},onPointerDown:Ti(e.onPointerDown,e=>{e.preventDefault(),e.button===0&&(e.target.setPointerCapture(e.pointerId),g.current=p.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,S(e))}),onPointerMove:Ti(e.onPointerMove,S),onPointerUp:Ti(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(e.preventDefault(),t.releasePointerCapture(e.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=_.current,g.current=null}})})}var ki=e=>{let{sizes:t,onSizesChange:n,style:r,ref:i,...a}=e,o=di(),[s,c]=(0,C.useState)(),l=(0,C.useRef)(null),u=Je(i,l,o.onScrollbarXChange);return(0,C.useEffect)(()=>{l.current&&c(getComputedStyle(l.current))},[l]),(0,W.jsx)(Oi,{"data-orientation":`horizontal`,...a,ref:u,sizes:t,style:{...r,"--sa-thumb-width":`${vi(t)}px`},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(o.viewport){let r=o.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Ci(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:wi(s.paddingLeft),paddingEnd:wi(s.paddingRight)}})}})};ki.displayName=`@mantine/core/ScrollAreaScrollbarX`;function Ai(e){let{sizes:t,onSizesChange:n,style:r,ref:i,...a}=e,o=di(),[s,c]=(0,C.useState)(),l=(0,C.useRef)(null),u=Je(i,l,o.onScrollbarYChange);return(0,C.useEffect)(()=>{l.current&&c(window.getComputedStyle(l.current))},[]),(0,W.jsx)(Oi,{...a,"data-orientation":`vertical`,ref:u,sizes:t,style:{"--sa-thumb-height":`${vi(t)}px`,...r},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(o.viewport){let r=o.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Ci(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:wi(s.paddingTop),paddingEnd:wi(s.paddingBottom)}})}})}Ai.displayName=`@mantine/core/ScrollAreaScrollbarY`;function ji(e){let{orientation:t=`vertical`,...n}=e,{dir:r}=si(),i=di(),a=(0,C.useRef)(null),o=(0,C.useRef)(0),[s,c]=(0,C.useState)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=_i(s.viewport,s.content),u={...n,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>{a.current=e},onThumbPointerUp:()=>{o.current=0},onThumbPointerDown:e=>{o.current=e}},d=(e,t)=>Si(e,o.current,s,t);return t===`horizontal`?(0,W.jsx)(ki,{...u,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=xi(e,s,r);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,r))}}):t===`vertical`?(0,W.jsx)(Ai,{...u,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=xi(e,s);s.scrollbar.size===0?a.current.style.setProperty(`--thumb-opacity`,`0`):a.current.style.setProperty(`--thumb-opacity`,`1`),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}ji.displayName=`@mantine/core/ScrollAreaScrollbarVisible`;function Mi(e){let t=di(),{forceMount:n,...r}=e,[i,a]=(0,C.useState)(!1),o=e.orientation===`horizontal`,s=ce(()=>{if(t.viewport){let e=t.viewport.offsetWidth<t.viewport.scrollWidth,n=t.viewport.offsetHeight<t.viewport.scrollHeight;a(o?e:n)}},10);return fi(t.viewport,s),fi(t.content,s),n||i?(0,W.jsx)(ji,{"data-state":i?`visible`:`hidden`,...r}):null}Mi.displayName=`@mantine/core/ScrollAreaScrollbarAuto`;function Ni(e){let{forceMount:t,...n}=e,r=di(),[i,a]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let{scrollArea:e}=r,t=0;if(e){let n=()=>{window.clearTimeout(t),a(!0)},i=()=>{t=window.setTimeout(()=>a(!1),r.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,i),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,i)}}},[r.scrollArea,r.scrollHideDelay]),t||i?(0,W.jsx)(Mi,{"data-state":i?`visible`:`hidden`,...n}):null}Ni.displayName=`@mantine/core/ScrollAreaScrollbarHover`;function Pi(e){let{forceMount:t,...n}=e,r=di(),i=e.orientation===`horizontal`,[a,o]=(0,C.useState)(`hidden`),s=ce(()=>o(`idle`),100);return(0,C.useEffect)(()=>{if(a===`idle`){let e=window.setTimeout(()=>o(`hidden`),r.scrollHideDelay);return()=>window.clearTimeout(e)}},[a,r.scrollHideDelay]),(0,C.useEffect)(()=>{let{viewport:e}=r,t=i?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(o(`scrolling`),s()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[r.viewport,i,s]),t||a!==`hidden`?(0,W.jsx)(ji,{"data-state":a===`hidden`?`hidden`:`visible`,...n,onPointerEnter:Ti(e.onPointerEnter,()=>o(`interacting`)),onPointerLeave:Ti(e.onPointerLeave,()=>o(`idle`))}):null}function Fi(e){let{forceMount:t,...n}=e,r=di(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=r,o=e.orientation===`horizontal`;return(0,C.useEffect)(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),r.type===`hover`?(0,W.jsx)(Ni,{...n,forceMount:t}):r.type===`scroll`?(0,W.jsx)(Pi,{...n,forceMount:t}):r.type===`auto`?(0,W.jsx)(Mi,{...n,forceMount:t}):r.type===`always`?(0,W.jsx)(ji,{...n}):null}Fi.displayName=`@mantine/core/ScrollAreaScrollbar`;function Ii(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 Li(e){let{style:t,ref:n,...r}=e,i=di(),a=Di(),{onThumbPositionChange:o}=a,s=Je(n,a.onThumbChange),c=(0,C.useRef)(void 0),l=ce(()=>{c.current&&=(c.current(),void 0)},100);return(0,C.useEffect)(()=>{let{viewport:e}=i;if(e){let t=()=>{if(l(),!c.current){let t=Ii(e,o);c.current=t,o()}};return o(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[i.viewport,l,o]),(0,W.jsx)(`div`,{"data-state":a.hasThumb?`visible`:`hidden`,...r,ref:s,style:{width:`var(--sa-thumb-width)`,height:`var(--sa-thumb-height)`,...t},onPointerDownCapture:Ti(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;a.onThumbPointerDown({x:n,y:r})}),onPointerUp:Ti(e.onPointerUp,a.onThumbPointerUp)})}Li.displayName=`@mantine/core/ScrollAreaThumb`;function Ri(e){let{forceMount:t,...n}=e,r=Di();return t||r.hasThumb?(0,W.jsx)(Li,{...n}):null}Ri.displayName=`@mantine/core/ScrollAreaThumb`;function zi({children:e,style:t,ref:n,onWheel:r,...i}){let a=di(),o=Je(n,a.onViewportChange),s=e=>{if(r?.(e),a.scrollbarXEnabled&&a.viewport&&e.shiftKey){let{scrollTop:t,scrollHeight:n,clientHeight:r,scrollWidth:i,clientWidth:o}=a.viewport,s=t<1,c=t>=n-r-1;i>o&&(s||c)&&e.stopPropagation()}};return(0,W.jsx)(J,{...i,ref:o,onWheel:s,"data-scrollarea-viewport":!0,style:{overflowX:a.scrollbarXEnabled?`scroll`:`hidden`,overflowY:a.scrollbarYEnabled?`scroll`:`hidden`,...t},children:(0,W.jsx)(`div`,{...a.getStyles(`content`),ref:a.onContentChange,children:e})})}zi.displayName=`@mantine/core/ScrollAreaViewport`;var Bi={root:`m_d57069b5`,content:`m_b1336c6`,viewport:`m_c0783ff9`,viewportInner:`m_f8f631dd`,scrollbar:`m_c44ba933`,thumb:`m_d8b5e363`,corner:`m_21657268`};function Vi(){return typeof window<`u`}function Hi(e){return Gi(e)?(e.nodeName||``).toLowerCase():`#document`}function Ui(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wi(e){return((Gi(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Gi(e){return Vi()?e instanceof Node||e instanceof Ui(e).Node:!1}function Ki(e){return Vi()?e instanceof Element||e instanceof Ui(e).Element:!1}function qi(e){return Vi()?e instanceof HTMLElement||e instanceof Ui(e).HTMLElement:!1}function Ji(e){return!Vi()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ui(e).ShadowRoot}function Y(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=aa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Yi(e){return/^(table|td|th)$/.test(Hi(e))}function Xi(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Zi=/transform|translate|scale|rotate|perspective|filter/,Qi=/paint|layout|strict|content/,$i=e=>!!e&&e!==`none`,ea;function ta(e){let t=Ki(e)?aa(e):e;return $i(t.transform)||$i(t.translate)||$i(t.scale)||$i(t.rotate)||$i(t.perspective)||!ra()&&($i(t.backdropFilter)||$i(t.filter))||Zi.test(t.willChange||``)||Qi.test(t.contain||``)}function na(e){let t=sa(e);for(;qi(t)&&!ia(t);){if(ta(t))return t;if(Xi(t))return null;t=sa(t)}return null}function ra(){return ea??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ea}function ia(e){return/^(html|body|#document)$/.test(Hi(e))}function aa(e){return Ui(e).getComputedStyle(e)}function oa(e){return Ki(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sa(e){if(Hi(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ji(e)&&e.host||Wi(e);return Ji(t)?t.host:t}function ca(e){let t=sa(e);return ia(t)?(e.ownerDocument||e).body:qi(t)&&Y(t)?t:ca(t)}function la(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ca(e),i=r===e.ownerDocument?.body,a=Ui(r);if(i){let e=ua(a);return t.concat(a,a.visualViewport||[],Y(r)?r:[],e&&n?la(e):[])}return t.concat(r,la(r,[],n))}function ua(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var da=[`top`,`right`,`bottom`,`left`],fa=Math.min,pa=Math.max,ma=Math.round,ha=Math.floor,ga=e=>({x:e,y:e}),_a={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function va(e,t,n){return pa(e,fa(t,n))}function ya(e,t){return typeof e==`function`?e(t):e}function ba(e){return e.split(`-`)[0]}function xa(e){return e.split(`-`)[1]}function Sa(e){return e===`x`?`y`:`x`}function Ca(e){return e===`y`?`height`:`width`}function wa(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ta(e){return Sa(wa(e))}function Ea(e,t,n){n===void 0&&(n=!1);let r=xa(e),i=Ta(e),a=Ca(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fa(o)),[o,Fa(o)]}function Da(e){let t=Fa(e);return[Oa(e),t,Oa(t)]}function Oa(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ka=[`left`,`right`],Aa=[`right`,`left`],ja=[`top`,`bottom`],Ma=[`bottom`,`top`];function Na(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Aa:ka:t?ka:Aa;case`left`:case`right`:return t?ja:Ma;default:return[]}}function Pa(e,t,n,r){let i=xa(e),a=Na(ba(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Oa)))),a}function Fa(e){let t=ba(e);return _a[t]+e.slice(t.length)}function Ia(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function La(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ia(e)}function Ra(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function za(){let e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Ba(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+`/`+n}).join(` `):navigator.userAgent}function Va(){return/apple/i.test(navigator.vendor)}function Ha(){return za().toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints}function Ua(){return Ba().includes(`jsdom/`)}var Wa=`data-floating-ui-focusable`,Ga=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`;function Ka(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function qa(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Ji(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ja(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Ya(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Xa(e){return e.matches(`html,body`)}function Za(e){return e?.ownerDocument||document}function Qa(e){return qi(e)&&e.matches(Ga)}function $a(e){if(!e||Ua())return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function eo(e){return e?e.hasAttribute(Wa)?e:e.querySelector(`[`+Wa+`]`)||e:null}function to(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...to(e,t.id,n)])}function no(e){return`nativeEvent`in e}function ro(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}var io=typeof document<`u`?C.useLayoutEffect:function(){},ao={...C};function oo(e){let t=C.useRef(e);return io(()=>{t.current=e}),t}var so=ao.useInsertionEffect||(e=>e());function co(e){let t=C.useRef(()=>{});return so(()=>{t.current=e}),C.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function lo(e,t,n){let{reference:r,floating:i}=e,a=wa(t),o=Ta(t),s=Ca(o),c=ba(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=xa(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function uo(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ya(t,e),p=La(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ra(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ra(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var fo=50,po=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:uo},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=lo(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<fo&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=lo(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},mo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=ya(e,t)||{};if(l==null)return{};let d=La(u),f={x:n,y:r},p=Ta(i),m=Ca(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=fa(d[_],T),D=fa(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=va(E,k,O),j=!c.arrow&&xa(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),ho=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ya(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ba(r),_=wa(o),v=ba(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fa(o)]:Da(o)),x=p!==`none`;!d&&x&&b.push(...Pa(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ea(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===wa(t)||T.every(e=>wa(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=wa(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function go(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _o(e){return da.some(t=>e[t]>=0)}var vo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ya(e,t);switch(i){case`referenceHidden`:{let e=go(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_o(e)}}}case`escaped`:{let e=go(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:_o(e)}}}default:return{}}}}};function yo(e){let t=fa(...e.map(e=>e.left)),n=fa(...e.map(e=>e.top)),r=pa(...e.map(e=>e.right)),i=pa(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function bo(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>Ra(yo(e)))}var xo=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=ya(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]);if(!u.length)return{};let d=bo(u),f=Ra(yo(u)),p=La(s);function m(){if(d.length===2&&(d[0].left>d[1].right||d[1].left>d[0].right)&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&c<e.right+p.right&&l>e.top-p.top&&l<e.bottom+p.bottom)||f;if(d.length>=2){if(wa(n)===`y`){let e=d[0],t=d[d.length-1],r=ba(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left;return Ra({x:o,y:i,width:(r?e.right:t.right)-o,height:a-i})}let e=ba(n)===`left`,t=pa(...d.map(e=>e.right)),r=fa(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom;return Ra({x:r,y:a,width:t-r,height:o-a})}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},So=new Set([`left`,`top`]);async function Co(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ba(n),s=xa(n),c=wa(n)===`y`,l=So.has(o)?-1:1,u=a&&c?-1:1,d=ya(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Co(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},To=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ya(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=wa(i),p=Sa(f),m=u[p],h=u[f],g=(e,t)=>va(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Eo=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=ya(e,t),u={x:n,y:r},d=wa(i),f=Sa(d),p=u[f],m=u[d],h=ya(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=So.has(ba(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Do=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=ya(e,t),c=await i.detectOverflow(t,s),l=ba(n),u=xa(n),d=wa(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=fa(p-c[m],g),y=fa(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*pa(c.left,c.right):S=p-2*pa(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Oo(e){let t=aa(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=qi(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ma(n)!==a||ma(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ko(e){return Ki(e)?e:e.contextElement}function Ao(e){let t=ko(e);if(!qi(t))return ga(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Oo(t),o=(a?ma(n.width):n.width)/r,s=(a?ma(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var jo=ga(0);function Mo(e){let t=Ui(e);return!ra()||!t.visualViewport?jo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function X(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ui(e)}function No(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ko(e),o=ga(1);t&&(r?Ki(r)&&(o=Ao(r)):o=Ao(e));let s=X(a,n,r)?Mo(a):ga(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Ui(a),t=Ki(r)?Ui(r):r,n=e,i=ua(n);for(;i&&t!==n;){let e=Ao(i),t=i.getBoundingClientRect(),r=aa(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ui(i),i=ua(n)}}return Ra({width:u,height:d,x:c,y:l})}function Po(e,t){let n=oa(e).scrollLeft;return t?t.left+n:No(Wi(e)).left+n}function Fo(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Po(e,n),y:n.top+t.scrollTop}}function Io(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Wi(r),s=t?Xi(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ga(1),u=ga(0),d=qi(r);if((d||!a)&&((Hi(r)!==`body`||Y(o))&&(c=oa(r)),d)){let e=No(r);l=Ao(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Fo(o,c):ga(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Lo(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ro(e){let t=oa(e),n=e.ownerDocument.body,r=pa(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=pa(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Po(e),o=-t.scrollTop;return aa(n).direction===`rtl`&&(a+=pa(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var zo=25;function Bo(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ui(e),a=Wi(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ra()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Po(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=zo&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Vo(e,t){let n=No(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ao(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ho(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Bo(e,n,t);else if(t===`document`)r=Ro(Wi(e));else if(Ki(t))r=Vo(t,n);else{let n=Mo(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ra(r)}function Uo(e,t){let n=t.get(e);if(n)return n;let r=la(e,[],!1).filter(e=>Ki(e)&&Hi(e)!==`body`),i=null,a=aa(e).position===`fixed`,o=a?sa(e):e;for(;Ki(o)&&!ia(o);){let e=aa(o),t=ta(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=sa(o)}return t.set(e,r),r}function Wo(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Xi(t)?[]:Uo(t,this._c):[].concat(n),r],o=Ho(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ho(t,a[e],i);s=pa(n.top,s),c=fa(n.right,c),l=fa(n.bottom,l),u=pa(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Go(e){let{width:t,height:n}=Oo(e);return{width:t,height:n}}function Ko(e,t,n){let r=qi(t),i=Wi(t),a=n===`fixed`,o=No(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ga(0);if((r||!a)&&((Hi(t)!==`body`||Y(i))&&(s=oa(t)),r)){let e=No(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Po(i));let l=i&&!r&&!a?Fo(i,s):ga(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function qo(e){return aa(e).position===`static`}function Jo(e,t){if(!qi(e)||aa(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Wi(e)===n&&(n=n.ownerDocument.body),n}function Yo(e,t){let n=Ui(e);if(Xi(e))return n;if(!qi(e)){let t=sa(e);for(;t&&!ia(t);){if(Ki(t)&&!qo(t))return t;t=sa(t)}return n}let r=Jo(e,t);for(;r&&Yi(r)&&qo(r);)r=Jo(r,t);return r&&ia(r)&&qo(r)&&!ta(r)?n:r||na(e)||n}var Xo=async function(e){let t=this.getOffsetParent||Yo,n=this.getDimensions,r=await n(e.floating);return{reference:Ko(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return aa(e).direction===`rtl`}var Qo={convertOffsetParentRelativeRectToViewportRelativeRect:Io,getDocumentElement:Wi,getClippingRect:Wo,getOffsetParent:Yo,getElementRects:Xo,getClientRects:Lo,getDimensions:Go,getScale:Ao,isElement:Ki,isRTL:Zo};function $o(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(e,t,n){let r=null,i,a=Wi(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ha(d),h=ha(a.clientWidth-(u+f)),g=ha(a.clientHeight-(d+p)),_=ha(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:pa(0,fa(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!$o(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Ui(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ts(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ko(e),u=i||a?[...l?la(l):[],...t?la(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?es(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?No(e):null;c&&g();function g(){let t=No(e);h&&!$o(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ns=wo,rs=To,is=ho,as=Do,os=vo,ss=mo,cs=xo,ls=Eo,us=(e,t,n)=>{let r=new Map,i=n??{},a={...Qo,...i.platform,_c:r};return po(e,t,{...i,platform:a})},ds=typeof document<`u`?C.useLayoutEffect:function(){};function fs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!fs(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!fs(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ps(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ms(e,t){let n=ps(e);return Math.round(t*n)/n}function hs(e){let t=C.useRef(e);return ds(()=>{t.current=e}),t}function gs(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=C.useState(r);fs(f,r)||p(r);let[m,h]=C.useState(null),[g,_]=C.useState(null),v=C.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=C.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),b=a||m,x=o||g,S=C.useRef(null),w=C.useRef(null),T=C.useRef(u),E=c!=null,D=hs(c),O=hs(i),k=hs(l),A=C.useCallback(()=>{if(!S.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),us(S.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!fs(T.current,t)&&(T.current=t,xt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);ds(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=C.useRef(!1);ds(()=>(j.current=!0,()=>{j.current=!1}),[]),ds(()=>{if(b&&(S.current=b),x&&(w.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,E]);let M=C.useMemo(()=>({reference:S,floating:w,setReference:v,setFloating:y}),[v,y]),N=C.useMemo(()=>({reference:b,floating:x}),[b,x]),ee=C.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=ms(N.floating,u.x),r=ms(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ps(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var _s=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ss({element:r.current,padding:i}).fn(n):r?ss({element:r,padding:i}).fn(n):{}}}},vs=(e,t)=>{let n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ys=(e,t)=>{let n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},bs=(e,t)=>({fn:ls(e).fn,options:[e,t]}),xs=(e,t)=>{let n=is(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ss=(e,t)=>{let n=as(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cs=(e,t)=>{let n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},ws=(e,t)=>{let n=cs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ts=(e,t)=>{let n=_s(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Es(e){let t=C.useRef(void 0),n=C.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return C.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}var Ds=`data-floating-ui-focusable`,Os=`active`,ks=`selected`,As=`ArrowLeft`,js=`ArrowRight`,Ms=`ArrowUp`,Ns=`ArrowDown`,Ps=[As,js],Fs=[Ms,Ns];[...Ps,...Fs];var Is={...C},Ls=!1,Rs=0,zs=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+Rs++;function Bs(){let[e,t]=C.useState(()=>Ls?zs():void 0);return io(()=>{e??t(zs())},[]),C.useEffect(()=>{Ls=!0},[]),e}var Vs=Is.useId||Bs;function Hs(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var Us=C.createContext(null),Ws=C.createContext(null),Gs=()=>C.useContext(Us)?.id||null,Ks=()=>C.useContext(Ws);function qs(e){return`data-floating-ui-`+e}function Js(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}var Ys=qs(`safe-polygon`);function Xs(e,t,n){if(n&&!ro(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function Zs(e){return typeof e==`function`?e():e}function Qs(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=t,p=Ks(),m=Gs(),h=oo(l),g=oo(c),_=oo(n),v=oo(d),y=C.useRef(),b=C.useRef(-1),x=C.useRef(),S=C.useRef(-1),w=C.useRef(!0),T=C.useRef(!1),E=C.useRef(()=>{}),D=C.useRef(!1),O=co(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});C.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||(Js(b),Js(S),w.current=!0,D.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),C.useEffect(()=>{if(!s||!h.current||!n)return;function e(e){O()&&r(!1,e,`hover`)}let t=Za(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,h,O]);let k=C.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Xs(g.current,`close`,y.current);i&&!x.current?(Js(b),b.current=window.setTimeout(()=>r(!1,e,n),i)):t&&(Js(b),r(!1,e,n))},[g,r]),A=co(()=>{E.current(),x.current=void 0}),j=co(()=>{if(T.current){let e=Za(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(Ys),T.current=!1}}),M=co(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);C.useEffect(()=>{if(!s)return;function e(e){if(Js(b),w.current=!1,u&&!ro(y.current)||Zs(v.current)>0&&!Xs(g.current,`open`))return;let t=Xs(g.current,`open`,y.current);t?b.current=window.setTimeout(()=>{_.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(M()){j();return}E.current();let t=Za(o.floating);if(Js(S),D.current=!1,h.current&&i.current.floatingContext){n||Js(b),x.current=h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){j(),A(),M()||k(e,!0,`safe-polygon`)}});let r=x.current;t.addEventListener(`mousemove`,r),E.current=()=>{t.removeEventListener(`mousemove`,r)}}else(y.current!==`touch`||!qa(o.floating,e.relatedTarget))&&k(e)}function a(e){M()||i.current.floatingContext&&(h.current==null||h.current({...i.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){j(),A(),M()||k(e)}})(e))}function c(){Js(b)}function l(e){M()||k(e,!1)}if(Ki(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),f&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,c),i.addEventListener(`mouseleave`,l)),()=>{n&&r.removeEventListener(`mouseleave`,a),f&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,c),i.removeEventListener(`mouseleave`,l))}}},[o,s,e,u,f,k,A,j,r,n,_,p,g,h,i,M,v]),io(()=>{var e;if(s&&n&&(e=h.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&O()){T.current=!0;let e=o.floating;if(Ki(o.domReference)&&e){var t;let n=Za(o.floating).body;n.setAttribute(Ys,``);let r=o.domReference,i=p==null||(t=p.nodesRef.current.find(e=>e.id===m))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,m,o,p,h,O]),io(()=>{n||(y.current=void 0,D.current=!1,A(),j())},[n,A,j]),C.useEffect(()=>()=>{A(),Js(b),Js(S),j()},[s,o.domReference,A,j]);let N=C.useMemo(()=>{function e(e){y.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!w.current&&!_.current&&r(!0,t,`hover`)}(!u||ro(y.current))&&(n||Zs(v.current)===0||D.current&&e.movementX**2+e.movementY**2<2||(Js(S),y.current===`touch`?i():(D.current=!0,S.current=window.setTimeout(i,Zs(v.current)))))}}},[u,r,n,_,v]);return C.useMemo(()=>s?{reference:N}:{},[s,N])}var $s=()=>{},ec=C.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:$s,setState:$s,isInstantPhase:!1}),tc=()=>C.useContext(ec);function nc(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=C.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=C.useRef(null),s=C.useCallback(e=>{a({currentId:e})},[]);return io(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),(0,W.jsx)(ec.Provider,{value:C.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}function rc(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{id:a,enabled:o=!0}=t,s=a??i,c=tc(),{currentId:l,setCurrentId:u,initialDelay:d,setState:f,timeoutMs:p}=c;return io(()=>{o&&l&&(f({delay:{open:1,close:Xs(d,`close`)}}),l!==s&&r(!1))},[o,s,r,f,l,d]),io(()=>{function e(){r(!1),f({delay:d,currentId:null})}if(o&&l&&!n&&l===s){if(p){let t=window.setTimeout(e,p);return()=>{clearTimeout(t)}}e()}},[o,n,f,l,s,r,d,p]),io(()=>{o&&u!==$s&&n&&u(s)},[o,n,u,s]),c}function ic(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Ji(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ac(e){return`composedPath`in e?e.composedPath()[0]:e.target}var oc={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},sc={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},cc=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0});function lc(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,elements:i,dataRef:a}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`pointerdown`,referencePress:u=!1,referencePressEvent:d=`pointerdown`,ancestorScroll:f=!1,bubbles:p,capture:m}=t,h=Ks(),g=co(typeof c==`function`?c:()=>!1),_=typeof c==`function`?g:c,v=C.useRef(!1),{escapeKey:y,outsidePress:b}=cc(p),{escapeKey:x,outsidePress:S}=cc(m),w=C.useRef(!1),T=co(e=>{if(!n||!o||!s||e.key!==`Escape`||w.current)return;let t=a.current.floatingContext?.nodeId,i=h?to(h.nodesRef.current,t):[];if(!y&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;(n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}r(!1,no(e)?e.nativeEvent:e,`escape-key`)}),E=co(e=>{var t;let n=()=>{var t;T(e),(t=Ja(e))==null||t.removeEventListener(`keydown`,n)};(t=Ja(e))==null||t.addEventListener(`keydown`,n)}),D=co(e=>{let t=a.current.insideReactTree;a.current.insideReactTree=!1;let n=v.current;if(v.current=!1,l===`click`&&n||t||typeof _==`function`&&!_(e))return;let o=Ja(e),s=`[`+qs(`inert`)+`]`,c=Za(i.floating).querySelectorAll(s),u=Ki(o)?o:null;for(;u&&!ia(u);){let e=sa(u);if(ia(e)||!Ki(e))break;u=e}if(c.length&&Ki(o)&&!Xa(o)&&!qa(o,i.floating)&&Array.from(c).every(e=>!qa(u,e)))return;if(qi(o)&&A){let t=ia(o),n=aa(o),r=/auto|scroll/,i=t||r.test(n.overflowX),a=t||r.test(n.overflowY),s=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,c=a&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),d=s&&e.offsetY>o.clientHeight;if(u||d)return}let d=a.current.floatingContext?.nodeId,f=h&&to(h.nodesRef.current,d).some(t=>Ya(e,t.context?.elements.floating));if(Ya(e,i.floating)||Ya(e,i.domReference)||f)return;let p=h?to(h.nodesRef.current,d):[];if(p.length>0){let e=!0;if(p.forEach(t=>{var n;(n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}r(!1,e,`outside-press`)}),O=co(e=>{var t;let n=()=>{var t;D(e),(t=Ja(e))==null||t.removeEventListener(l,n)};(t=Ja(e))==null||t.addEventListener(l,n)});C.useEffect(()=>{if(!n||!o)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=b;let e=-1;function t(e){r(!1,e,`ancestor-scroll`)}function c(){window.clearTimeout(e),w.current=!0}function u(){e=window.setTimeout(()=>{w.current=!1},ra()?5:0)}let d=Za(i.floating);s&&(d.addEventListener(`keydown`,x?E:T,x),d.addEventListener(`compositionstart`,c),d.addEventListener(`compositionend`,u)),_&&d.addEventListener(l,S?O:D,S);let p=[];return f&&(Ki(i.domReference)&&(p=la(i.domReference)),Ki(i.floating)&&(p=p.concat(la(i.floating))),!Ki(i.reference)&&i.reference&&i.reference.contextElement&&(p=p.concat(la(i.reference.contextElement)))),p=p.filter(e=>e!==d.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t)}),()=>{s&&(d.removeEventListener(`keydown`,x?E:T,x),d.removeEventListener(`compositionstart`,c),d.removeEventListener(`compositionend`,u)),_&&d.removeEventListener(l,S?O:D,S),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[a,i,s,_,l,n,r,f,o,y,b,T,x,E,D,S,O]),C.useEffect(()=>{a.current.insideReactTree=!1},[a,_,l]);let k=C.useMemo(()=>({onKeyDown:T,...u&&{[oc[d]]:e=>{r(!1,e.nativeEvent,`reference-press`)},...d!==`click`&&{onClick(e){r(!1,e.nativeEvent,`reference-press`)}}}}),[T,r,u,d]),A=C.useMemo(()=>{function e(e){e.button===0&&(v.current=!0)}return{onKeyDown:T,onMouseDown:e,onMouseUp:e,[sc[l]]:()=>{a.current.insideReactTree=!0}}},[T,l,a]);return C.useMemo(()=>o?{reference:k,floating:A}:{},[o,k,A])}function uc(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=Vs(),a=C.useRef({}),[o]=C.useState(()=>Hs()),s=Gs()!=null,[c,l]=C.useState(r.reference),u=co((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=C.useMemo(()=>({setPositionReference:l}),[]),f=C.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return C.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function dc(e){let{elements:t,...n}=e===void 0?{}:e,{nodeId:r}=n,i=uc({...n,elements:{reference:t?.reference??null,floating:t?.floating??null}}),a=n.rootContext||i,o=a.elements,[s,c]=C.useState(null),[l,u]=C.useState(null),d=o?.domReference||s,f=C.useRef(null),p=Ks();io(()=>{d&&(f.current=d)},[d]);let m=gs({...n,elements:{...o,...l&&{reference:l}}}),h=C.useCallback(e=>{let t=Ki(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=C.useCallback(e=>{(Ki(e)||e===null)&&(f.current=e,c(e)),(Ki(m.refs.reference.current)||m.refs.reference.current===null||e!==null&&!Ki(e))&&m.refs.setReference(e)},[m.refs]),_=C.useMemo(()=>({...m.refs,setReference:g,setPositionReference:h,domReference:f}),[m.refs,g,h]),v=C.useMemo(()=>({...m.elements,domReference:d}),[m.elements,d]),y=C.useMemo(()=>({...m,...a,refs:_,elements:v,nodeId:r}),[m,_,v,r,a]);return io(()=>{a.dataRef.current.floatingContext=y;let e=p?.nodesRef.current.find(e=>e.id===r);e&&(e.context=y)}),C.useMemo(()=>({...m,context:y,refs:_,elements:v}),[m,_,v,y])}function fc(){return Ha()&&Va()}function pc(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,events:i,dataRef:a,elements:o}=e,{enabled:s=!0,visibleOnly:c=!0}=t,l=C.useRef(!1),u=C.useRef(-1),d=C.useRef(!0);C.useEffect(()=>{if(!s)return;let e=Ui(o.domReference);function t(){!n&&qi(o.domReference)&&o.domReference===Ka(Za(o.domReference))&&(l.current=!0)}function r(){d.current=!0}function i(){d.current=!1}return e.addEventListener(`blur`,t),fc()&&(e.addEventListener(`keydown`,r,!0),e.addEventListener(`pointerdown`,i,!0)),()=>{e.removeEventListener(`blur`,t),fc()&&(e.removeEventListener(`keydown`,r,!0),e.removeEventListener(`pointerdown`,i,!0))}},[o.domReference,n,s]),C.useEffect(()=>{if(!s)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(l.current=!0)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[i,s]),C.useEffect(()=>()=>{Js(u)},[]);let f=C.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(e){if(l.current)return;let t=Ja(e.nativeEvent);if(c&&Ki(t)){if(fc()&&!e.relatedTarget){if(!d.current&&!Qa(t))return}else if(!$a(t))return}r(!0,e.nativeEvent,`focus`)},onBlur(e){l.current=!1;let t=e.relatedTarget,n=e.nativeEvent,i=Ki(t)&&t.hasAttribute(qs(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;u.current=window.setTimeout(()=>{let e=Ka(o.domReference?o.domReference.ownerDocument:document);(t||e!==o.domReference)&&(qa(a.current.floatingContext?.refs.floating.current,e)||qa(o.domReference,e)||i||r(!1,n,`focus`))})}}),[a,o.domReference,r,c]);return C.useMemo(()=>s?{reference:f}:{},[s,f])}function mc(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[Os]:t,[ks]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[Ds]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[Os,ks].includes(n))){if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}}),e),{})}}function hc(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=C.useCallback(t=>mc(t,e,`reference`),t),a=C.useCallback(t=>mc(t,e,`floating`),n),o=C.useCallback(t=>mc(t,e,`item`),r);return C.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}var gc=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function _c(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=Vs(),c=r.domReference?.id||s,l=C.useMemo(()=>eo(r.floating)?.id||i,[r.floating,i]),u=gc.get(o)??o,d=Gs()!=null,f=C.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=C.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=C.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return C.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}function vc(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...vc(e,t.id,n)])}function yc(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function bc(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function xc(e){e===void 0&&(e={});let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i={current:-1},a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=e=>{let{x:n,y:o,placement:s,elements:c,onClose:u,nodeId:d,tree:f}=e;return function(e){function p(){Js(i),u()}if(Js(i),!c.domReference||!c.floating||s==null||n==null||o==null)return;let{clientX:m,clientY:h}=e,g=[m,h],_=ac(e),v=e.type===`mouseleave`,y=ic(c.floating,_),b=ic(c.domReference,_),x=c.domReference.getBoundingClientRect(),S=c.floating.getBoundingClientRect(),C=s.split(`-`)[0],w=n>S.right-S.width/2,T=o>S.bottom-S.height/2,E=bc(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&Ki(e.relatedTarget)&&ic(c.floating,e.relatedTarget)||f&&vc(f.nodesRef.current,d).length)return;if(C===`top`&&o>=x.bottom-1||C===`bottom`&&o<=x.top+1||C===`left`&&n>=x.right-1||C===`right`&&n<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]]}function ee(e){let[n,r]=e;switch(C){case`top`:return[[D?n+t/2:w?n+t*4:n-t*4,r+t+1],[D?n-t/2:w?n+t*4:n-t*4,r+t+1],[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]];case`bottom`:return[[D?n+t/2:w?n+t*4:n-t*4,r-t],[D?n-t/2:w?n+t*4:n-t*4,r-t],[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]];case`left`:{let e=[n+t+1,O?r+t/2:T?r+t*4:r-t*4],i=[n+t+1,O?r-t/2:T?r+t*4:r-t*4];return[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom],e,i]}case`right`:return[[n-t,O?r+t/2:T?r+t*4:r-t*4],[n-t,O?r-t/2:T?r+t*4:r-t*4],[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]]}}if(!yc([m,h],N)){if(a&&!E)return p();if(!v&&r){let t=l(e.clientX,e.clientY);if(t!==null&&t<.1)return p()}yc([m,h],ee([n,o]))?!a&&r&&(i.current=window.setTimeout(p,40)):p()}}};return u.__options={blockPointerEvents:n},u}var Sc={scrollHideDelay:1e3,type:`hover`,scrollbars:`xy`},Cc=U((e,{scrollbarSize:t,overscrollBehavior:n,scrollbars:r})=>{let i=n;return n&&r&&(r===`x`?i=`${n} auto`:r===`y`&&(i=`auto ${n}`)),{root:{"--scrollarea-scrollbar-size":_(t),"--scrollarea-over-scroll-behavior":i,"--scrollarea-offset-size":void 0}}}),wc=q(e=>{let t=G(`ScrollArea`,Sc,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,scrollbarSize:s,vars:c,type:l,scrollHideDelay:u,viewportProps:d,viewportRef:f,onScrollPositionChange:p,children:m,offsetScrollbars:h,scrollbars:g,onBottomReached:_,onTopReached:v,onLeftReached:y,onRightReached:b,overscrollBehavior:x,startScrollPosition:S,verticalScrollbarPosition:w,attributes:T,...E}=t,[D,O]=(0,C.useState)(!1),[k,A]=(0,C.useState)(!1),[j,M]=(0,C.useState)(!1),N=(0,C.useRef)(!0),ee=(0,C.useRef)(!1),P=(0,C.useRef)(!0),F=(0,C.useRef)(!1),I=K({name:`ScrollArea`,props:t,classes:Bi,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:T,vars:c,varsResolver:Cc}),L=(0,C.useRef)(null),[R,te]=(0,C.useState)(null),ne=Es([f,L,(0,C.useCallback)(e=>{te(t=>t===e?t:e)},[])]);return fi(h===`present`?R:null,()=>{let e=L.current;e&&(A(e.scrollHeight>e.clientHeight),M(e.scrollWidth>e.clientWidth))}),ue(()=>{S&&L.current&&L.current.scrollTo({left:S.x??0,top:S.y??0})},[]),(0,W.jsxs)(gi,{getStyles:I,type:l===`never`?`always`:l,scrollHideDelay:u,scrollbars:g,...I(`root`),...E,children:[(0,W.jsx)(zi,{...d,...I(`viewport`,{style:d?.style}),ref:ne,"data-offset-scrollbars":h===!0?`xy`:h||void 0,"data-scrollbars":g||void 0,"data-vertical-scrollbar-position":w||void 0,"data-horizontal-hidden":h===`present`&&!j?`true`:void 0,"data-vertical-hidden":h===`present`&&!k?`true`:void 0,onScroll:e=>{d?.onScroll?.(e),p?.({x:e.currentTarget.scrollLeft,y:e.currentTarget.scrollTop});let{scrollTop:t,scrollHeight:n,clientHeight:r,scrollLeft:i,scrollWidth:a,clientWidth:o}=e.currentTarget,s=t-(n-r)>=-.8,c=t===0;s&&!ee.current&&_?.(),c&&!N.current&&v?.(),ee.current=s,N.current=c;let l=i-(a-o)>=-.8,u=i===0;l&&!F.current&&b?.(),u&&!P.current&&y?.(),F.current=l,P.current=u},children:m}),(g===`xy`||g===`x`)&&(0,W.jsx)(Fi,{...I(`scrollbar`),orientation:`horizontal`,"data-vertical-scrollbar-position":w||void 0,"data-hidden":l===`never`||h===`present`&&!j||void 0,forceMount:!0,onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1),children:(0,W.jsx)(Ri,{...I(`thumb`)})}),(g===`xy`||g===`y`)&&(0,W.jsx)(Fi,{...I(`scrollbar`),orientation:`vertical`,"data-vertical-scrollbar-position":w||void 0,"data-hidden":l===`never`||h===`present`&&!k||void 0,forceMount:!0,onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1),children:(0,W.jsx)(Ri,{...I(`thumb`)})}),(0,W.jsx)(mi,{...I(`corner`),"data-vertical-scrollbar-position":w||void 0,"data-hovered":D||void 0,"data-hidden":l===`never`||void 0})]})});wc.displayName=`@mantine/core/ScrollArea`;var Tc=q(e=>{let{children:t,classNames:n,styles:r,scrollbarSize:i,scrollHideDelay:a,type:o,dir:s,offsetScrollbars:c,overscrollBehavior:l,viewportRef:u,onScrollPositionChange:d,unstyled:f,variant:p,viewportProps:m,scrollbars:h,style:g,vars:_,onBottomReached:v,onTopReached:y,startScrollPosition:b,verticalScrollbarPosition:x,onOverflowChange:S,...w}=G(`ScrollAreaAutosize`,Sc,e),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),O=Es([u,T,(0,C.useCallback)(e=>{D(t=>t===e?t:e)},[])]),k=(0,C.useRef)(!1),A=(0,C.useRef)(!1),j=(0,C.useEffectEvent)(()=>{let e=T.current;if(!e||!S)return;let t=e.scrollHeight>e.clientHeight;t!==k.current&&(A.current?S(t):(A.current=!0,t&&S(!0)),k.current=t)});return fi(S?E:null,j),(0,W.jsx)(J,{...w,variant:p,style:[{display:`flex`,overflow:`hidden`},g],children:(0,W.jsx)(J,{style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`,...h===`y`&&{minWidth:0},...h===`x`&&{minHeight:0},...h===`xy`&&{minWidth:0,minHeight:0},...h===!1&&{minWidth:0,minHeight:0}},children:(0,W.jsx)(wc,{classNames:n,styles:r,scrollHideDelay:a,scrollbarSize:i,type:o,dir:s,offsetScrollbars:c,overscrollBehavior:l,viewportRef:O,onScrollPositionChange:d,unstyled:f,variant:p,viewportProps:m,vars:_,scrollbars:h,onBottomReached:v,onTopReached:y,startScrollPosition:b,verticalScrollbarPosition:x,"data-autosize":`true`,children:t})})})});wc.classes=Bi,wc.varsResolver=Cc,Tc.displayName=`@mantine/core/ScrollAreaAutosize`,Tc.classes=Bi,wc.Autosize=Tc;var Ec={root:`m_87cf2631`},Dc={__staticSelector:`UnstyledButton`},Oc=$r(e=>{let t=G(`UnstyledButton`,Dc,e),{className:n,component:r=`button`,__staticSelector:i,unstyled:a,classNames:o,styles:s,style:c,attributes:l,...u}=t,d=K({name:i,props:t,classes:Ec,className:n,style:c,classNames:o,styles:s,unstyled:a,attributes:l});return(0,W.jsx)(J,{...d(`root`,{focusable:!0}),component:r,type:r===`button`?`button`:void 0,...u})});Oc.classes=Ec,Oc.displayName=`@mantine/core/UnstyledButton`;var kc={root:`m_515a97f8`},Ac=q(e=>{let t=G(`VisuallyHidden`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t,u=K({name:`VisuallyHidden`,classes:kc,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c});return(0,W.jsx)(J,{component:`span`,...u(`root`),...l})});Ac.classes=kc,Ac.displayName=`@mantine/core/VisuallyHidden`;var jc={root:`m_1b7284a3`},Mc=U((e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:L(t),"--paper-shadow":ne(n)}})),Nc=$r(e=>{let t=G(`Paper`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,withBorder:s,vars:c,radius:l,shadow:u,variant:d,mod:f,attributes:p,...m}=t,h=K({name:`Paper`,props:t,classes:jc,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:p,vars:c,varsResolver:Mc});return(0,W.jsx)(J,{mod:[{withBorder:s},f],...h(`root`),variant:d,...m})});Nc.classes=jc,Nc.varsResolver=Mc,Nc.displayName=`@mantine/core/Paper`;function Pc(e,t,n,r){return e===`center`||r===`center`?{top:t}:e===`end`?{bottom:n}:e===`start`?{top:n}:{}}function Fc(e,t,n,r,i){return e===`center`||r===`center`?{left:t}:e===`end`?{[i===`ltr`?`right`:`left`]:n}:e===`start`?{[i===`ltr`?`left`:`right`]:n}:{}}var Ic={bottom:`borderTopLeftRadius`,left:`borderTopRightRadius`,right:`borderBottomLeftRadius`,top:`borderBottomRightRadius`};function Lc({position:e,arrowSize:t,dir:n}){let[r,i]=e.split(`-`);if(!i)return;let a={width:t,height:t,position:`absolute`};if(r===`bottom`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,top:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(100% 0%, 0% 100%, 100% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`}}if(r===`top`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,bottom:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(0% 0%, 100% 0%, 0% 100%)`}}if(r===`left`)return{...a,right:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 0% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`};if(r===`right`)return{...a,left:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(100% 0%, 0% 100%, 100% 100%)`}}function Rc({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,arrowX:a,arrowY:o,dir:s}){if(i===`merge`){let n=Lc({position:e,arrowSize:t,dir:s});if(n)return n}let[c,l=`center`]=e.split(`-`),u={width:t,height:t,transform:`rotate(45deg)`,position:`absolute`,[Ic[c]]:r},d=-t/2;return c===`left`?{...u,...Pc(l,o,n,i),right:d,borderLeftColor:`transparent`,borderBottomColor:`transparent`,clipPath:`polygon(100% 0, 0 0, 100% 100%)`}:c===`right`?{...u,...Pc(l,o,n,i),left:d,borderRightColor:`transparent`,borderTopColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 100%)`}:c===`top`?{...u,...Fc(l,a,n,i,s),bottom:d,borderTopColor:`transparent`,borderLeftColor:`transparent`,clipPath:`polygon(0 100%, 100% 100%, 100% 0)`}:c===`bottom`?{...u,...Fc(l,a,n,i,s),top:d,borderBottomColor:`transparent`,borderRightColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 0)`}:{}}function zc({position:e,dir:t}){let[n,r]=e.split(`-`);if(!r)return;let i=r===`start`&&t===`ltr`||r===`end`&&t===`rtl`;if(n===`bottom`)return i?{borderTopLeftRadius:0}:{borderTopRightRadius:0};if(n===`top`)return i?{borderBottomLeftRadius:0}:{borderBottomRightRadius:0};if(n===`left`)return r===`start`?{borderTopRightRadius:0}:{borderBottomRightRadius:0};if(n===`right`)return r===`start`?{borderTopLeftRadius:0}:{borderBottomLeftRadius:0}}function Bc({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,visible:a,arrowX:o,arrowY:s,style:c,...l}){let{dir:u}=si();return a?(0,W.jsx)(`div`,{role:`presentation`,...l,style:{...c,...Rc({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,dir:u,arrowX:o,arrowY:s})}}):null}Bc.displayName=`@mantine/core/FloatingArrow`;function Vc(e,t){if(e===`rtl`&&(t.includes(`right`)||t.includes(`left`))){let[e,n]=t.split(`-`),r=e===`right`?`left`:`right`;return n===void 0?r:`${r}-${n}`}return t}var Hc={root:`m_9814e45f`},Uc={zIndex:N(`modal`)},Wc=U((e,{gradient:t,color:n,backgroundOpacity:r,blur:i,radius:a,zIndex:o})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&cn(n||`#000`,r??.6)||void 0,"--overlay-filter":i?`blur(${_(i)})`:void 0,"--overlay-radius":a===void 0?void 0:L(a),"--overlay-z-index":o?.toString()}})),Gc=$r(e=>{let t=G(`Overlay`,Uc,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,fixed:c,center:l,children:u,radius:d,zIndex:f,gradient:p,blur:m,color:h,backgroundOpacity:g,mod:_,attributes:v,...y}=t,b=K({name:`Overlay`,props:t,classes:Hc,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:v,vars:s,varsResolver:Wc});return(0,W.jsx)(J,{...b(`root`),mod:[{center:l,fixed:c},_],...y,children:u})});Gc.classes=Hc,Gc.varsResolver=Wc,Gc.displayName=`@mantine/core/Overlay`;function Kc(e){let t=document.createElement(`div`);return t.setAttribute(`data-portal`,`true`),typeof e.className==`string`&&t.classList.add(...e.className.split(` `).filter(Boolean)),typeof e.style==`object`&&Object.assign(t.style,e.style),typeof e.id==`string`&&t.setAttribute(`id`,e.id),t}var qc=null;function Jc({target:e,reuseTargetNode:t,...n}){if(e)return typeof e==`string`?document.querySelector(e)||Kc(n):e;if(t){if(qc){if(document.body.contains(qc))return qc;qc=null}let e=document.querySelector(`[data-mantine-shared-portal-node]`);if(e)return qc=e,e;let t=Kc(n);return t.setAttribute(`data-mantine-shared-portal-node`,`true`),document.body.appendChild(t),qc=t,t}return Kc(n)}var Yc={reuseTargetNode:!0},Xc=q(e=>{let{children:t,target:n,reuseTargetNode:r,ref:i,...a}=G(`Portal`,Yc,e),[o,s]=(0,C.useState)(!1),c=(0,C.useRef)(null);return ue(()=>(s(!0),c.current=Jc({target:n,reuseTargetNode:r,...a}),Ke(i,c.current),!n&&!r&&c.current&&document.body.appendChild(c.current),()=>{!n&&!r&&c.current&&document.body.removeChild(c.current)}),[n]),!o||!c.current?null:(0,xt.createPortal)((0,W.jsx)(W.Fragment,{children:t}),c.current)});Xc.displayName=`@mantine/core/Portal`;var Zc=q(({withinPortal:e=!0,children:t,...n})=>wn()===`test`||!e?(0,W.jsx)(W.Fragment,{children:t}):(0,W.jsx)(Xc,{...n,children:t}));Zc.displayName=`@mantine/core/OptionalPortal`;var Qc=e=>({in:{opacity:1,transform:`scale(1)`},out:{opacity:0,transform:`scale(.9) translateY(${e===`bottom`?10:-10}px)`},transitionProperty:`transform, opacity`}),$c={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:`opacity`},"fade-up":{in:{opacity:1,transform:`translateY(0)`},out:{opacity:0,transform:`translateY(30px)`},transitionProperty:`opacity, transform`},"fade-down":{in:{opacity:1,transform:`translateY(0)`},out:{opacity:0,transform:`translateY(-30px)`},transitionProperty:`opacity, transform`},"fade-left":{in:{opacity:1,transform:`translateX(0)`},out:{opacity:0,transform:`translateX(30px)`},transitionProperty:`opacity, transform`},"fade-right":{in:{opacity:1,transform:`translateX(0)`},out:{opacity:0,transform:`translateX(-30px)`},transitionProperty:`opacity, transform`},scale:{in:{opacity:1,transform:`scale(1)`},out:{opacity:0,transform:`scale(0)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"scale-y":{in:{opacity:1,transform:`scaleY(1)`},out:{opacity:0,transform:`scaleY(0)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"scale-x":{in:{opacity:1,transform:`scaleX(1)`},out:{opacity:0,transform:`scaleX(0)`},common:{transformOrigin:`left`},transitionProperty:`transform, opacity`},"skew-up":{in:{opacity:1,transform:`translateY(0) skew(0deg, 0deg)`},out:{opacity:0,transform:`translateY(-20px) skew(-10deg, -5deg)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"skew-down":{in:{opacity:1,transform:`translateY(0) skew(0deg, 0deg)`},out:{opacity:0,transform:`translateY(20px) skew(-10deg, -5deg)`},common:{transformOrigin:`bottom`},transitionProperty:`transform, opacity`},"rotate-left":{in:{opacity:1,transform:`translateY(0) rotate(0deg)`},out:{opacity:0,transform:`translateY(20px) rotate(-5deg)`},common:{transformOrigin:`bottom`},transitionProperty:`transform, opacity`},"rotate-right":{in:{opacity:1,transform:`translateY(0) rotate(0deg)`},out:{opacity:0,transform:`translateY(20px) rotate(5deg)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"slide-down":{in:{opacity:1,transform:`translateY(0)`},out:{opacity:0,transform:`translateY(-100%)`},common:{transformOrigin:`top`},transitionProperty:`transform, opacity`},"slide-up":{in:{opacity:1,transform:`translateY(0)`},out:{opacity:0,transform:`translateY(100%)`},common:{transformOrigin:`bottom`},transitionProperty:`transform, opacity`},"slide-left":{in:{opacity:1,transform:`translateX(0)`},out:{opacity:0,transform:`translateX(100%)`},common:{transformOrigin:`left`},transitionProperty:`transform, opacity`},"slide-right":{in:{opacity:1,transform:`translateX(0)`},out:{opacity:0,transform:`translateX(-100%)`},common:{transformOrigin:`right`},transitionProperty:`transform, opacity`},pop:{...Qc(`bottom`),common:{transformOrigin:`center center`}},"pop-bottom-left":{...Qc(`bottom`),common:{transformOrigin:`bottom left`}},"pop-bottom-right":{...Qc(`bottom`),common:{transformOrigin:`bottom right`}},"pop-top-left":{...Qc(`top`),common:{transformOrigin:`top left`}},"pop-top-right":{...Qc(`top`),common:{transformOrigin:`top right`}}},el={entering:`in`,entered:`in`,exiting:`out`,exited:`out`,"pre-exiting":`out`,"pre-entering":`out`};function tl({transition:e,state:t,duration:n,timingFunction:r}){let i={WebkitBackfaceVisibility:`hidden`,transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e==`string`?e in $c?{transitionProperty:$c[e].transitionProperty,...i,...$c[e].common,...$c[e][el[t]]}:{}:{transitionProperty:e.transitionProperty,...i,...e.common,...e[el[t]]}}function nl({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:i,onExit:a,onEntered:o,onExited:s,enterDelay:c,exitDelay:l}){let u=Bn(),d=Xe(),f=u.respectReducedMotion?d:!1,[p,m]=(0,C.useState)(f?0:e),[h,g]=(0,C.useState)(r?`entered`:`exited`),_=(0,C.useRef)(-1),v=(0,C.useRef)(-1),y=(0,C.useRef)(-1);function b(){window.clearTimeout(_.current),window.clearTimeout(v.current),cancelAnimationFrame(y.current),y.current=-1}let x=n=>{b();let r=n?i:a,c=n?o:s,l=f?0:n?e:t;if(m(l),l===0)typeof r==`function`&&r(),typeof c==`function`&&c(),g(n?`entered`:`exited`);else{let e=requestAnimationFrame(()=>{xt.flushSync(()=>{g(n?`pre-entering`:`pre-exiting`)}),y.current===e&&(y.current=requestAnimationFrame(()=>{typeof r==`function`&&r(),g(n?`entering`:`exiting`),_.current=window.setTimeout(()=>{typeof c==`function`&&c(),g(n?`entered`:`exited`)},l)}))});y.current=e}},S=e=>{b(),typeof(e?c:l)==`number`?v.current=window.setTimeout(()=>{x(e)},e?c:l):x(e)};return fe(()=>{S(r)},[r]),(0,C.useEffect)(()=>()=>{b()},[]),{transitionDuration:p,transitionStatus:h,transitionTimingFunction:n||`ease`}}function rl({keepMounted:e,keepMountedMode:t=`activity`,transition:n=`fade`,duration:r=250,exitDuration:i=r,mounted:a,children:o,timingFunction:s=`ease`,onExit:c,onEntered:l,onEnter:u,onExited:d,enterDelay:f,exitDelay:p}){let m=wn(),{transitionDuration:h,transitionStatus:g,transitionTimingFunction:_}=nl({mounted:a,exitDuration:i,duration:r,timingFunction:s,onExit:c,onEntered:l,onEnter:u,onExited:d,enterDelay:f,exitDelay:p});if(m===`test`)return a?(0,W.jsx)(W.Fragment,{children:o({})}):e?o({display:`none`}):null;if(h===0)return e?t===`display-none`?a?(0,W.jsx)(W.Fragment,{children:o({})}):o({display:`none`}):(0,W.jsx)(C.Activity,{mode:a?`visible`:`hidden`,children:o({})}):a?(0,W.jsx)(W.Fragment,{children:o({})}):null;let v=g===`exited`;if(e){let e=o(v?t===`display-none`?{display:`none`}:{}:tl({transition:n,duration:h,state:g,timingFunction:_}));return t===`display-none`?e:(0,W.jsx)(C.Activity,{mode:v?`hidden`:`visible`,children:e})}return v?null:(0,W.jsx)(W.Fragment,{children:o(tl({transition:n,duration:h,state:g,timingFunction:_}))})}rl.displayName=`@mantine/core/Transition`;var il={duration:100,transition:`fade`};function al(e,t){return{...il,...t,...e}}var[ol,sl]=T(`Popover component was not found in the tree`);function cl({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,C.useRef)(!1),s=(0,C.useRef)(!1),c=(0,C.useRef)(null),l=(0,C.useRef)(t);l.current=t;let u=(e,t,n)=>{i({getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t,toJSON:()=>void 0}),contextElement:n}),a()},d=re(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=re(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=ht(e=>{if(l.current||s.current)return;let t=e,n=t.touches[0]??t.changedTouches[0];n&&(u(n.clientX,n.clientY,c.current),s.current=!0)},{threshold:r,events:[`touch`],cancelOnMove:!0,onStart:e=>{o.current=!0,s.current=!1,c.current=e.currentTarget},onFinish:e=>{o.current=!1,s.current=!1,l.current||e.preventDefault()},onCancel:()=>{o.current=!1,s.current=!1}});return{onContextMenu:f,onMouseDown:d,onTouchStart:re(e.onTouchStart,p.onTouchStart),onTouchEnd:re(e.onTouchEnd,p.onTouchEnd),onTouchCancel:re(e.onTouchCancel,p.onTouchCancel),onTouchMove:re(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function ll(e){let{children:t,disabled:n,longPressDelay:r}=G(`PopoverContextMenu`,null,e),i=Lt(t);if(!i)throw Error(`Popover.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=sl(),o=cl({childProps:i.props,disabled:n||a.disabled,opened:a.opened,longPressDelay:r,setReference:a.reference,open:()=>{a.opened||a.onToggle()}});return(0,C.cloneElement)(i,o)}ll.displayName=`@mantine/core/PopoverContextMenu`;function ul({children:e,active:t=!0,refProp:n=`ref`,innerRef:r}){let i=Je(Fe(t),r),a=Lt(e);return a?(0,C.cloneElement)(a,{[n]:i}):e}function dl(e){return(0,W.jsx)(Ac,{tabIndex:-1,"data-autofocus":!0,...e})}ul.displayName=`@mantine/core/FocusTrap`,dl.displayName=`@mantine/core/FocusTrapInitialFocus`,ul.InitialFocus=dl;var fl={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},pl=q(e=>{let t=G(`PopoverDropdown`,null,e),{className:n,style:r,vars:i,children:a,onKeyDownCapture:o,variant:s,classNames:c,styles:l,ref:u,...d}=t,f=sl(),{dir:p}=si(),m=f.arrowPosition===`merge`&&f.withArrow?zc({position:f.placement,dir:p}):void 0,h=pe({opened:f.opened,shouldReturnFocus:f.returnFocus}),g=f.withRoles?{"aria-labelledby":f.getTargetId(),id:f.getDropdownId(),role:`dialog`,tabIndex:-1}:{},v=Je(u,f.floating);return f.disabled?null:(0,W.jsx)(Zc,{...f.portalProps,withinPortal:f.withinPortal,children:(0,W.jsx)(rl,{mounted:f.opened,...f.transitionProps,transition:f.transitionProps?.transition||`fade`,duration:f.transitionProps?.duration??150,keepMounted:f.keepMounted,keepMountedMode:f.keepMountedMode,exitDuration:typeof f.transitionProps?.exitDuration==`number`?f.transitionProps.exitDuration:f.transitionProps?.duration,children:e=>(0,W.jsx)(ul,{active:f.trapFocus&&f.opened,innerRef:v,children:(0,W.jsxs)(J,{...g,...d,variant:s,onKeyDownCapture:P(()=>{f.onClose?.(),f.onDismiss?.()},{active:f.closeOnEscape,onTrigger:h,onKeyDown:o}),"data-position":f.placement,"data-fixed":f.floatingStrategy===`fixed`||void 0,...f.getStyles(`dropdown`,{className:n,props:t,classNames:c,styles:l,style:[{...e,...m,zIndex:f.zIndex,top:f.y??0,left:f.x??0,width:f.width===`target`?void 0:_(f.width),...f.referenceHidden?{display:`none`}:null},f.resolvedStyles?.dropdown,l?.dropdown,r]}),children:[a,(0,W.jsx)(Bc,{ref:f.arrowRef,arrowX:f.arrowX,arrowY:f.arrowY,visible:f.withArrow,position:f.placement,arrowSize:f.arrowSize,arrowRadius:f.arrowRadius,arrowOffset:f.arrowOffset,arrowPosition:f.arrowPosition,...f.getStyles(`arrow`,{props:t,classNames:c,styles:l})})]})})})})});pl.classes=fl,pl.displayName=`@mantine/core/PopoverDropdown`;var ml={refProp:`ref`,popupType:`dialog`},hl=q(e=>{let{children:t,refProp:n,popupType:r,ref:i,...a}=G(`PopoverTarget`,ml,e),o=Lt(t);if(!o)throw Error(`Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let s=a,c=sl(),l=Je(c.reference,Ft(o),i),u=c.withRoles?{"aria-haspopup":r,"aria-expanded":c.opened,"aria-controls":c.opened?c.getDropdownId():void 0,id:c.getTargetId()}:{},d=o.props;return(0,C.cloneElement)(o,{...s,...u,...c.targetProps,className:zt(c.targetProps.className,s.className,d.className),[n]:l,...c.controlled?null:{onClick:e=>{c.onToggle(),d.onClick?.(e)}}})});hl.displayName=`@mantine/core/PopoverTarget`;function gl(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function _l(e,t,n,r){let i=gl(e.middlewares),a=[vs(e.offset),Cs()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(xs(t))}if(i.shift){let t=typeof i.shift==`boolean`?{}:i.shift;a.push(ys(n=>{let r=n.placement.startsWith(`top`)||n.placement.startsWith(`bottom`);return{limiter:bs(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?ws():ws(i.inline)),a.push(Ts({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(Ss({...typeof i.size==`boolean`?{}:i.size,apply({rects:n,availableWidth:r,availableHeight:a,...o}){let s=t().refs.floating.current?.style??{};i.size&&(typeof i.size==`object`&&i.size.apply?i.size.apply({rects:n,availableWidth:r,availableHeight:a,...o}):Object.assign(s,{maxWidth:`${r}px`,maxHeight:`${a}px`})),e.width===`target`&&Object.assign(s,{width:`${n.reference.width}px`})}})),a}function vl(e){let[t,n]=Ye({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,C.useRef)(t),i=(0,C.useRef)(!1),[a,o]=(0,C.useState)(null),s=e.preventPositionChangeWhenVisible!==!1,c=(0,C.useRef)(t);t!==c.current&&(c.current=t,t&&a!==null&&o(null));let l=(0,C.useRef)(e.position);e.position!==l.current&&(l.current=e.position,i.current=!1,a!==null&&o(null));let u=(0,C.useCallback)(()=>o(null),[]),d=()=>{t&&!e.disabled&&n(!1)},f=()=>{e.disabled||n(!t)},p=dc({open:t,strategy:e.strategy,placement:s?a??e.position:e.position,middleware:_l(e,()=>p,s&&a!==null,s),whileElementsMounted:e.keepMounted?void 0:ts});(0,C.useEffect)(()=>{if(!e.keepMounted)return;let n=p.refs.reference.current,r=p.refs.floating.current;if(t&&n&&r)return ts(n,r,p.update)},[e.keepMounted,t,p.update,p.elements.reference,p.elements.floating]),ue(()=>{if(!t){i.current=!1;return}if(!s||a!==null)return;let e=p.refs.floating.current;e&&e.offsetHeight!==0&&e.offsetWidth!==0&&(i.current?p.isPositioned&&o(p.placement):(i.current=!0,p.update()))},[s,t,p.isPositioned,p.placement,a,p.update]);let m=(0,C.useRef)(p.placement);return ue(()=>{m.current!==p.placement&&(m.current=p.placement,e.onPositionChange?.(p.placement))},[p.placement]),fe(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:p,controlled:typeof e.opened==`boolean`,opened:t,onClose:d,onToggle:f,resetLockedPlacement:u}}var yl={position:`bottom`,offset:8,transitionProps:{transition:`fade`,duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,preventPositionChangeWhenVisible:!0,clickOutsideEvents:[`mousedown`,`touchstart`],clickOutsideCapture:!1,zIndex:N(`popover`),__staticSelector:`Popover`,width:`max-content`},bl=U((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:L(t),"--popover-shadow":ne(n)}}));function xl(e){let t=G(`Popover`,yl,e),{children:n,position:r,offset:i,onPositionChange:a,opened:o,transitionProps:s,onExitTransitionEnd:c,onEnterTransitionEnd:l,width:u,middlewares:d,withArrow:f,arrowSize:p,arrowOffset:m,arrowRadius:h,arrowPosition:g,unstyled:_,classNames:v,styles:y,closeOnClickOutside:b,withinPortal:x,portalProps:S,closeOnEscape:w,clickOutsideEvents:T,clickOutsideCapture:E,trapFocus:D,onClose:O,onDismiss:k,onOpen:A,onChange:j,zIndex:M,radius:N,shadow:ee,id:P,defaultOpened:F,__staticSelector:I,withRoles:L,disabled:R,returnFocus:te,variant:ne,keepMounted:re,keepMountedMode:ie,vars:ae,floatingStrategy:oe,withOverlay:se,overlayProps:ce,hideDetached:le,attributes:B,preventPositionChangeWhenVisible:V,...ue}=t,de=K({name:I,props:t,classes:fl,classNames:v,styles:y,unstyled:_,attributes:B,rootSelector:`dropdown`,vars:ae,varsResolver:bl}),{resolvedStyles:fe}=nr({classNames:v,styles:y,props:t}),pe=(0,C.useRef)(null),[H,me]=(0,C.useState)(null),[he,ge]=(0,C.useState)(null),{dir:_e}=si(),ve=wn(),ye=Re(P),be=vl({middlewares:d,width:u,position:Vc(_e,r),offset:typeof i==`number`?i+(f?p/2:0):i,arrowRef:pe,arrowOffset:m,onPositionChange:a,opened:o,defaultOpened:F,onChange:j,onOpen:A,onClose:O,onDismiss:k,strategy:oe,disabled:R,preventPositionChangeWhenVisible:V,keepMounted:re});z(()=>{b&&(be.onClose(),k?.())},T,[H,he],!0,E);let xe=(0,C.useCallback)(e=>{me(e),be.floating.refs.setReference(e)},[be.floating.refs.setReference]),Se=(0,C.useCallback)(e=>{ge(e),be.floating.refs.setFloating(e)},[be.floating.refs.setFloating]),Ce=(0,C.useCallback)(()=>{s?.onExited?.(),c?.(),be.resetLockedPlacement()},[s?.onExited,c,be.resetLockedPlacement]),we=(0,C.useCallback)(()=>{s?.onEntered?.(),l?.()},[s?.onEntered,l]);return(0,W.jsxs)(ol,{value:{returnFocus:te,disabled:R,controlled:be.controlled,reference:xe,floating:Se,x:be.floating.x,y:be.floating.y,arrowX:be.floating?.middlewareData?.arrow?.x,arrowY:be.floating?.middlewareData?.arrow?.y,opened:be.opened,arrowRef:pe,transitionProps:{...s,onExited:Ce,onEntered:we},width:u,withArrow:f,arrowSize:p,arrowOffset:m,arrowRadius:h,arrowPosition:g,placement:be.floating.placement,trapFocus:D,withinPortal:x,portalProps:S,zIndex:M,radius:N,shadow:ee,closeOnEscape:w,onDismiss:k,onClose:be.onClose,onToggle:be.onToggle,getTargetId:()=>ye,getDropdownId:()=>`${ye}-dropdown`,withRoles:L,targetProps:ue,__staticSelector:I,classNames:v,styles:y,unstyled:_,variant:ne,keepMounted:re,keepMountedMode:ie,getStyles:de,resolvedStyles:fe,floatingStrategy:oe,referenceHidden:le&&ve!==`test`?be.floating.middlewareData.hide?.referenceHidden:!1},children:[n,se&&(0,W.jsx)(rl,{transition:`fade`,mounted:be.opened,duration:s?.duration||250,exitDuration:s?.exitDuration||250,children:e=>(0,W.jsx)(Zc,{withinPortal:x,children:(0,W.jsx)(Gc,{...ce,...de(`overlay`,{className:ce?.className,style:[e,ce?.style]})})})})]})}xl.Target=hl,xl.Dropdown=pl,xl.ContextMenu=ll,xl.varsResolver=bl,xl.displayName=`@mantine/core/Popover`,xl.extend=e=>e,xl.withProps=e=>{let t=t=>(0,W.jsx)(xl,{...e,...t});return t.extend=xl.extend,t.displayName=`WithProps(${xl.displayName})`,t};var Sl={root:`m_5ae2e3c`,barsLoader:`m_7a2bd4cd`,bar:`m_870bb79`,"bars-loader-animation":`m_5d2b3b9d`,dotsLoader:`m_4e3f22d7`,dot:`m_870c4af`,"loader-dots-animation":`m_aac34a1`,ovalLoader:`m_b34414df`,"oval-loader-animation":`m_f8e89c4b`},Cl=({className:e,...t})=>(0,W.jsxs)(J,{component:`span`,className:zt(Sl.barsLoader,e),...t,children:[(0,W.jsx)(`span`,{className:Sl.bar}),(0,W.jsx)(`span`,{className:Sl.bar}),(0,W.jsx)(`span`,{className:Sl.bar})]});Cl.displayName=`@mantine/core/Bars`;var wl=({className:e,...t})=>(0,W.jsxs)(J,{component:`span`,className:zt(Sl.dotsLoader,e),...t,children:[(0,W.jsx)(`span`,{className:Sl.dot}),(0,W.jsx)(`span`,{className:Sl.dot}),(0,W.jsx)(`span`,{className:Sl.dot})]});wl.displayName=`@mantine/core/Dots`;var Tl=({className:e,...t})=>(0,W.jsx)(J,{component:`span`,className:zt(Sl.ovalLoader,e),...t});Tl.displayName=`@mantine/core/Oval`;var El={bars:Cl,oval:Tl,dots:wl},Dl={loaders:El,type:`oval`},Ol=U((e,{size:t,color:n})=>({root:{"--loader-size":F(t,`loader-size`),"--loader-color":n?rn(n,e):void 0}})),kl=q(e=>{let t=G(`Loader`,Dl,e),{size:n,color:r,type:i,vars:a,className:o,style:s,classNames:c,styles:l,unstyled:u,loaders:d,variant:f,children:p,attributes:m,...h}=t,g=K({name:`Loader`,props:t,classes:Sl,className:o,style:s,classNames:c,styles:l,unstyled:u,attributes:m,vars:a,varsResolver:Ol});return p?(0,W.jsx)(J,{...g(`root`),...h,children:p}):(0,W.jsx)(J,{...g(`root`),component:d[i],variant:f,size:n,...h})});kl.defaultLoaders=El,kl.classes=Sl,kl.varsResolver=Ol,kl.displayName=`@mantine/core/Loader`;var Al={root:`m_8d3f4000`,icon:`m_8d3afb97`,loader:`m_302b9fb1`,group:`m_1a0f1b21`,groupSection:`m_437b6484`},jl={orientation:`horizontal`},Ml=U((e,{borderWidth:t})=>({group:{"--ai-border-width":_(t)}})),Nl=q(e=>{let t=G(`ActionIconGroup`,jl,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,orientation:s,vars:c,borderWidth:l,variant:u,mod:d,attributes:f,...p}=t,m=K({name:`ActionIconGroup`,props:t,classes:Al,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:c,varsResolver:Ml,rootSelector:`group`});return(0,W.jsx)(J,{...m(`group`),variant:u,mod:[{orientation:s},d],role:`group`,...p})});Nl.classes=Al,Nl.varsResolver=Ml,Nl.displayName=`@mantine/core/ActionIconGroup`;var Pl=U((e,{radius:t,color:n,gradient:r,variant:i,autoContrast:a,size:o})=>{let s=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:a});return{groupSection:{"--section-height":F(o,`section-height`),"--section-padding-x":F(o,`section-padding-x`),"--section-fz":R(o),"--section-radius":t===void 0?void 0:L(t),"--section-bg":n||i?s.background:void 0,"--section-color":s.color,"--section-bd":n||i?s.border:void 0}}}),Fl=q(e=>{let t=G(`ActionIconGroupSection`,null,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,vars:s,variant:c,gradient:l,radius:u,autoContrast:d,attributes:f,...p}=t,m=K({name:`ActionIconGroupSection`,props:t,classes:Al,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:Pl,rootSelector:`groupSection`});return(0,W.jsx)(J,{...m(`groupSection`),variant:c,...p})});Fl.classes=Al,Fl.varsResolver=Pl,Fl.displayName=`@mantine/core/ActionIconGroupSection`;var Il=U((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o})=>{let s=e.variantColorResolver({color:a||e.primaryColor,theme:e,gradient:i,variant:r||`filled`,autoContrast:o});return{root:{"--ai-size":F(t,`ai-size`),"--ai-radius":n===void 0?void 0:L(n),"--ai-bg":a||r?s.background:void 0,"--ai-hover":a||r?s.hover:void 0,"--ai-hover-color":a||r?s.hoverColor:void 0,"--ai-color":s.color,"--ai-bd":a||r?s.border:void 0}}}),Ll=$r(e=>{let t=G(`ActionIcon`,null,e),{className:n,unstyled:r,variant:i,classNames:a,styles:o,style:s,loading:c,loaderProps:l,size:u,color:d,radius:f,__staticSelector:p,gradient:m,vars:h,children:g,disabled:_,"data-disabled":v,autoContrast:y,mod:b,attributes:x,...S}=t,C=K({name:[`ActionIcon`,p],props:t,className:n,style:s,classes:Al,classNames:a,styles:o,unstyled:r,attributes:x,vars:h,varsResolver:Il});return(0,W.jsxs)(Oc,{...C(`root`,{active:!_&&!c&&!v}),"aria-busy":c||void 0,...S,unstyled:r,variant:i,size:u,disabled:_||c,mod:[{loading:c,disabled:_||v},b],children:[typeof c==`boolean`&&(0,W.jsx)(rl,{mounted:c,transition:`slide-down`,duration:150,children:e=>(0,W.jsx)(J,{component:`span`,...C(`loader`,{style:e}),"aria-hidden":!0,children:(0,W.jsx)(kl,{color:`var(--ai-color)`,size:`calc(var(--ai-size) * 0.55)`,...l})})}),(0,W.jsx)(J,{component:`span`,mod:{loading:c},...C(`icon`),children:g})]})});Ll.classes=Al,Ll.varsResolver=Il,Ll.displayName=`@mantine/core/ActionIcon`,Ll.Group=Nl,Ll.GroupSection=Fl;function Rl({size:e=`var(--cb-icon-size, 70%)`,style:t,...n}){return(0,W.jsx)(`svg`,{viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{...t,width:e,height:e},...n,children:(0,W.jsx)(`path`,{d:`M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}Rl.displayName=`@mantine/core/CloseIcon`;var zl={root:`m_86a44da5`,"root--subtle":`m_220c80f2`},Bl={variant:`subtle`},Vl=U((e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":F(t,`cb-size`),"--cb-radius":n===void 0?void 0:L(n),"--cb-icon-size":_(r)}})),Hl=$r(e=>{let t=G(`CloseButton`,Bl,e),{iconSize:n,children:r,vars:i,radius:a,className:o,classNames:s,style:c,styles:l,unstyled:u,"data-disabled":d,disabled:f,variant:p,icon:m,mod:h,attributes:g,__staticSelector:_,...v}=t,y=K({name:_||`CloseButton`,props:t,className:o,style:c,classes:zl,classNames:s,styles:l,unstyled:u,attributes:g,vars:i,varsResolver:Vl});return(0,W.jsxs)(Oc,{...v,unstyled:u,variant:p,disabled:f,mod:[{disabled:f||d},h],...y(`root`,{variant:p,active:!f&&!d}),children:[m||(0,W.jsx)(Rl,{}),r]})});Hl.classes=zl,Hl.varsResolver=Vl,Hl.displayName=`@mantine/core/CloseButton`;function Ul(e){return C.Children.toArray(e).filter(Boolean)}var Wl={root:`m_4081bf90`},Gl={preventGrowOverflow:!0,gap:`md`,align:`center`,justify:`flex-start`,wrap:`wrap`},Kl=U((e,{grow:t,preventGrowOverflow:n,gap:r,align:i,justify:a,wrap:o},{childWidth:s})=>({root:{"--group-child-width":t&&n?s:void 0,"--group-gap":I(r),"--group-align":i,"--group-justify":a,"--group-wrap":o}})),ql=q(e=>{let t=G(`Group`,Gl,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,children:s,gap:c,align:l,justify:u,wrap:d,grow:f,preventGrowOverflow:p,vars:m,variant:h,__size:g,mod:_,attributes:v,...y}=t,b=Ul(s),x=b.length,S=I(c??`md`),C=K({name:`Group`,props:t,stylesCtx:{childWidth:`calc(${100/x}% - (${S} - ${S} / ${x}))`},className:r,style:i,classes:Wl,classNames:n,styles:a,unstyled:o,attributes:v,vars:m,varsResolver:Kl});return(0,W.jsx)(J,{...C(`root`),variant:h,mod:[{grow:f},_],size:g,...y,children:b})});ql.classes=Wl,ql.varsResolver=Kl,ql.displayName=`@mantine/core/Group`;var[Jl,Yl]=T(`ModalBase component was not found in tree`);function Xl({opened:e,transitionDuration:t}){let[n,r]=(0,C.useState)(e),i=(0,C.useRef)(-1),a=Xe()?0:t;return(0,C.useEffect)(()=>(e?(r(!0),window.clearTimeout(i.current)):a===0?r(!1):i.current=window.setTimeout(()=>r(!1),a),()=>window.clearTimeout(i.current)),[e,a]),n}function Zl({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:i,onClose:a,returnFocus:o,handledEscapeEvents:s}){let c=Re(e),[l,u]=(0,C.useState)(!1),[d,f]=(0,C.useState)(!1),p=Xl({opened:n,transitionDuration:typeof t?.duration==`number`?t?.duration:200});return ze(`keydown`,e=>{e.key===`Escape`&&i&&!e.isComposing&&n&&!s?.has(e)&&e.target?.getAttribute(`data-mantine-stop-propagation`)!==`true`&&(s?.add(e),a())},{capture:!0}),pe({opened:n,shouldReturnFocus:r&&o}),{_id:c,titleMounted:l,bodyMounted:d,shouldLockScroll:p,setTitleMounted:u,setBodyMounted:f}}var Ql=function(){return Ql=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ql.apply(this,arguments)};function $l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function eu(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var tu=`right-scroll-bar-position`,nu=`width-before-scroll-bar`,ru=`with-scroll-bars-hidden`,iu=`--removed-body-scroll-bar-size`;function au(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ou(e,t){var n=(0,C.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var su=typeof window<`u`?C.useLayoutEffect:C.useEffect,cu=new WeakMap;function lu(e,t){var n=ou(t||null,function(t){return e.forEach(function(e){return au(e,t)})});return su(function(){var t=cu.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||au(e,null)}),i.forEach(function(e){r.has(e)||au(e,a)})}cu.set(n,e)},[e]),n}function uu(e){return e}function du(e,t){t===void 0&&(t=uu);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function fu(e){e===void 0&&(e={});var t=du(null);return t.options=Ql({async:!0,ssr:!1},e),t}var pu=function(e){var t=e.sideCar,n=$l(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return C.createElement(r,Ql({},n))};pu.isSideCarExport=!0;function mu(e,t){return e.useMedium(t),pu}var hu=fu(),gu=function(){},_u=C.forwardRef(function(e,t){var n=C.useRef(null),r=C.useState({onScrollCapture:gu,onWheelCapture:gu,onTouchMoveCapture:gu}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=$l(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=lu([n,t]),w=Ql(Ql({},b),i);return C.createElement(C.Fragment,null,u&&C.createElement(x,{sideCar:hu,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?C.cloneElement(C.Children.only(s),Ql(Ql({},w),{ref:S})):C.createElement(v,Ql({},w,{className:c,ref:S}),s))});_u.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},_u.classNames={fullWidth:nu,zeroRight:tu};var vu=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function yu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=vu();return t&&e.setAttribute(`nonce`,t),e}function bu(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xu(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Su=function(){var e=0,t=null;return{add:function(n){e==0&&(t=yu())&&(bu(t,n),xu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Cu=function(){var e=Su();return function(t,n){C.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},wu=function(){var e=Cu();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Tu={left:0,top:0,right:0,gap:0},Eu=function(e){return parseInt(e||``,10)||0},Du=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Eu(n),Eu(r),Eu(i)]},Ou=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Tu;var t=Du(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ku=wu(),Au=`data-scroll-locked`,ju=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
3
|
.${ru} {
|
|
3
4
|
overflow: hidden ${r};
|
|
@@ -105,5 +106,6 @@ Error generating stack: `+e.message+`
|
|
|
105
106
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function zM(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;zM(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var BM=new Set([`type`,`properties`,`required`,`additionalProperties`]),VM=[`oneOf`,`anyOf`];function HM(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function UM(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!BM.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??HM(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}XE(n,r,e.length===1?e[0]:UM(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=HM(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function WM(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of BM)if(t in e)return;let n=t.filter(e=>VM.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=UM(t);else{let e=n[0],i=VM.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>UM([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,NM(e,r))}function GM(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):NM(i,s),NM(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())zM(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])WM(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}NM(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,XE(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:JM(t,`input`,e.processors),output:JM(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function KM(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return KM(r.element,n);if(r.type===`set`)return KM(r.valueType,n);if(r.type===`lazy`)return KM(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return KM(r.innerType,n);if(r.type===`intersection`)return KM(r.left,n)||KM(r.right,n);if(r.type===`record`||r.type===`map`)return KM(r.keyType,n)||KM(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:KM(r.in,n)||KM(r.out,n);if(r.type===`object`){for(let e in r.shape)if(KM(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(KM(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(KM(e,n))return!0;return!!(r.rest&&KM(r.rest,n))}return!1}var qM=(e,t={})=>n=>{let r=PM({...n,processors:t});return IM(e,r),RM(r,e),GM(r,e)},JM=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=PM({...i??{},target:a,io:t,processors:n});return IM(e,o),RM(o,e),GM(o,e)},YM=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},XM=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ZM=(e,t)=>{YM(e,`minimum`,t),XM(e,`maximum`,t)},QM=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},$M=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},eN=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},tN=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},nN=(e,t)=>YM(e,`minimum`,t.minimum),rN=(e,t)=>XM(e,`maximum`,t.maximum),iN=e=>(t,n)=>{tN(t,n.format);let[r,i]=e[n.format];YM(t,`minimum`,r),XM(t,`maximum`,i)},aN={greater_than:(e,t)=>YM(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>XM(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>QM(e,t.value),number_format:iN(gD),bigint_format:iN(_D),min_length:nN,max_length:rN,length_equals:(e,t)=>ZM(e,t.length),min_size:nN,max_size:rN,size_equals:(e,t)=>ZM(e,t.size),string_format:(e,t)=>{tN(e,t.format),t.pattern&&$M(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>eN(e,t.mime)};function oN(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)aN[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&YM(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&YM(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&XM(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&XM(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&QM(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&eN(t,i.mime);for(let e of i.patterns??[])$M(t,e);return t}var sN={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},cN=new Map([[pA,ZO],[hA,QO]]),lN=e=>cN.get(e)??e,uN=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=oN(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=sN[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(lN);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},dN=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=oN(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):FM(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},fN=(e,t,n,r)=>{n.not={}},pN=(e,t,n,r)=>{let i=e._zod.def,a=HE(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},mN=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(FM(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(FM(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},hN=(e,t,n,r)=>{FM(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},gN=(e,t,n,r)=>{FM(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},_N=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=oN(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=IM(a.element,t,{...r,path:[...r.path,`items`]})};function vN(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?vN(t.out):t.type===`catch`?vN(t.innerType):e._zod.optin}var yN=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&FM(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)XE(i.properties,e,IM(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?vN(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=IM(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},bN=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>IM(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},xN=(e,t,n,r)=>{let i=e._zod.def,a=IM(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=IM(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},SN=(e,t,n,r)=>{let i=e._zod.def,a=IM(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},CN=(e,t,n,r)=>{let i=e._zod.def;IM(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},wN=Symbol();function TN(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(FM(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),wN):JSON.parse(o)}var EN=(e,t,n,r)=>{let i=e._zod.def;IM(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=TN(i.defaultValue,e,t,n,r);o!==wN&&(n.default=o)},DN=(e,t,n,r)=>{let i=e._zod.def;IM(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=TN(i.defaultValue,e,t,n,r);o!==wN&&(n._prefault=o)},ON=(e,t,n,r)=>{let i=e._zod.def;IM(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{FM(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},kN=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;IM(o,t,r);let s=t.seen.get(e);s.ref=o},AN=(e,t,n,r)=>{let i=e._zod.def;IM(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},jN=(e,t,n,r)=>{let i=e._zod.def;IM(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},MN=new WeakSet([Object.prototype,Error.prototype]);function NN(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var PN=$(`ZodError`,(e,t)=>{dO.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);MN.has(n)||(MN.add(n),NN(n,`format`,e=>t=>mO(e,t)),NN(n,`flatten`,e=>t=>pO(e,t)),NN(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,WE,2)}),NN(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,WE,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),FN=gO(PN),IN=_O(PN),LN=vO(PN),RN=bO(PN),zN=EO(PN),BN=DO(PN),VN=OO(PN),HN=kO(PN),UN=AO(PN),WN=jO(PN),GN=MO(PN),KN=NO(PN);function qN(){iO.localeError||aO(Ej())}function JN(){iO.memoizer||aO({memoizer:Cj()})}var YN=$(`ZodType`,(e,t)=>(qN(),jk.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(rD(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return pD(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(fF(e,t))},superRefine(e,t){return this.check(pF(e,t))},overwrite(e){return this.check(CM(e))},optional(){return JP(this)},exactOptional(){return XP(this)},nullable(){return QP(this)},nullish(){return JP(QP(this))},nonoptional(e){return iF(this,e)},array(){return MP(this)},or(e){return IP([this,e])},and(e){return BP(this,e)},transform(e){return cF(this,KP(e))},default(e){return eF(this,e)},prefault(e){return nF(this,e)},catch(e){return oF(this,e)},pipe(e){return cF(this,e)},readonly(){return uF(this)},describe(e){let t=this.clone();return Aj.add(t,{description:e}),t},meta(...e){if(e.length===0)return Aj.get(this);let t=this.clone();return Aj.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return VD(this,`~standard`,{...Pk(this),jsonSchema:{input:JM(this,`input`),output:JM(this,`output`)}})},set"~standard"(e){BD(this,`~standard`,e)},parse:function e(t,n){return FN(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await IN(this,t,n,{callee:e})},safeParse(e,t){return LN(this,e,t)},async safeParseAsync(e,t){return RN(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){BD(this,`spa`,e)},validate(e,t){return CO(this,e,t)},validateAsync(e,t){return TO(this,e,t)},encode:function e(t,n){return zN(this,t,n,{callee:e})},decode:function e(t,n){return BN(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await VN(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await HN(this,t,n,{callee:e})},safeEncode(e,t){return UN(this,e,t)},safeDecode(e,t){return WN(this,e,t)},async safeEncodeAsync(e,t){return GN(this,e,t)},async safeDecodeAsync(e,t){return KN(this,e,t)},toJSONSchema(e){return qM(this,{})(e)},get description(){return Aj.get(this)?.description},get _def(){return this._zod.def}}),XN=$(`_ZodString`,(e,t)=>{Fk.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uN(e,t,n,r)},HD({format:e=>oN(e).format??null,minLength:e=>oN(e).minimum??null,maxLength:e=>oN(e).maximum??null},{regex(...e){return this.check(_M(...e))},includes(...e){return this.check(bM(...e))},startsWith(...e){return this.check(xM(...e))},endsWith(...e){return this.check(SM(...e))},min(...e){return this.check(hM(...e))},max(...e){return this.check(mM(...e))},length(...e){return this.check(gM(...e))},nonempty(...e){return this.check(hM(1,...e))},lowercase(e){return this.check(vM(e))},uppercase(e){return this.check(yM(e))},trim(){return this.check(TM())},normalize(...e){return this.check(wM(...e))},toLowerCase(){return this.check(EM())},toUpperCase(){return this.check(DM())},slugify(){return this.check(OM())}})),ZN=$(`ZodString`,(e,t)=>{Fk.init(e,t),XN.init(e,t)},{email(e){return this.check(Nj(iP,e))},url(e){return this.check(zj(sP,e))},jwt(e){return this.check(eM(SP,e))},emoji(e){return this.check(Bj(cP,e))},guid(e){return this.check(Pj(aP,e))},uuid(e){return this.check(Fj(oP,e))},uuidv4(e){return this.check(Ij(oP,e))},uuidv6(e){return this.check(Lj(oP,e))},uuidv7(e){return this.check(Rj(oP,e))},nanoid(e){return this.check(Vj(lP,e))},cuid(e){return this.check(Hj(uP,e))},cuid2(e){return this.check(Uj(dP,e))},ulid(e){return this.check(Wj(fP,e))},base64(e){return this.check(Zj(yP,e))},base64url(e){return this.check(Qj(bP,e))},xid(e){return this.check(Gj(pP,e))},ksuid(e){return this.check(Kj(mP,e))},ipv4(e){return this.check(qj(hP,e))},ipv6(e){return this.check(Jj(gP,e))},cidrv4(e){return this.check(Yj(_P,e))},cidrv6(e){return this.check(Xj(vP,e))},e164(e){return this.check($j(xP,e))},datetime(e){return this.check(tM(eP,e))},date(e){return this.check(nM(tP,e))},time(e){return this.check(rM(nP,e))},duration(e){return this.check(iM(rP,e))}});function QN(e){return Mj(ZN,e)}var $N=$(`ZodStringFormat`,(e,t)=>{Ik.init(e,t),XN.init(e,t)}),eP=$(`ZodISODateTime`,(e,t)=>{tA.init(e,t),$N.init(e,t)}),tP=$(`ZodISODate`,(e,t)=>{nA.init(e,t),$N.init(e,t)}),nP=$(`ZodISOTime`,(e,t)=>{rA.init(e,t),$N.init(e,t)}),rP=$(`ZodISODuration`,(e,t)=>{iA.init(e,t),$N.init(e,t)}),iP=$(`ZodEmail`,(e,t)=>{zk.init(e,t),$N.init(e,t)}),aP=$(`ZodGUID`,(e,t)=>{Lk.init(e,t),$N.init(e,t)}),oP=$(`ZodUUID`,(e,t)=>{Rk.init(e,t),$N.init(e,t)}),sP=$(`ZodURL`,(e,t)=>{qk.init(e,t),$N.init(e,t)}),cP=$(`ZodEmoji`,(e,t)=>{Jk.init(e,t),$N.init(e,t)}),lP=$(`ZodNanoID`,(e,t)=>{Yk.init(e,t),$N.init(e,t)}),uP=$(`ZodCUID`,(e,t)=>{Xk.init(e,t),$N.init(e,t)}),dP=$(`ZodCUID2`,(e,t)=>{Zk.init(e,t),$N.init(e,t)}),fP=$(`ZodULID`,(e,t)=>{Qk.init(e,t),$N.init(e,t)}),pP=$(`ZodXID`,(e,t)=>{$k.init(e,t),$N.init(e,t)}),mP=$(`ZodKSUID`,(e,t)=>{eA.init(e,t),$N.init(e,t)}),hP=$(`ZodIPv4`,(e,t)=>{aA.init(e,t),$N.init(e,t)}),gP=$(`ZodIPv6`,(e,t)=>{cA.init(e,t),$N.init(e,t)}),_P=$(`ZodCIDRv4`,(e,t)=>{lA.init(e,t),$N.init(e,t)}),vP=$(`ZodCIDRv6`,(e,t)=>{dA.init(e,t),$N.init(e,t)}),yP=$(`ZodBase64`,(e,t)=>{mA.init(e,t),$N.init(e,t)}),bP=$(`ZodBase64URL`,(e,t)=>{_A.init(e,t),$N.init(e,t)}),xP=$(`ZodE164`,(e,t)=>{vA.init(e,t),$N.init(e,t)}),SP=$(`ZodJWT`,(e,t)=>{bA.init(e,t),$N.init(e,t)}),CP=$(`ZodNumber`,(e,t)=>{xA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dN(e,t,n,r),e.isFinite=!0},HD({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=oN(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=oN(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=oN(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>oN(e).format??null},{gt(e,t){return this.check(dM(e,t))},gte(e,t){return this.check(fM(e,t))},min(e,t){return this.check(fM(e,t))},lt(e,t){return this.check(lM(e,t))},lte(e,t){return this.check(uM(e,t))},max(e,t){return this.check(uM(e,t))},int(e){return this.check(EP(e))},safe(e){return this.check(EP(e))},positive(e){return this.check(dM(0,e))},nonnegative(e){return this.check(fM(0,e))},negative(e){return this.check(lM(0,e))},nonpositive(e){return this.check(uM(0,e))},multipleOf(e,t){return this.check(pM(e,t))},step(e,t){return this.check(pM(e,t))},finite(){return this}}));function wP(e){return aM(CP,e)}var TP=$(`ZodNumberFormat`,(e,t)=>{SA.init(e,t),CP.init(e,t)});function EP(e){return oM(TP,e)}var DP=$(`ZodUnknown`,(e,t)=>{CA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function OP(){return sM(DP)}var kP=$(`ZodNever`,(e,t)=>{wA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fN(e,t,n,r)});function AP(e){return cM(kP,e)}var jP=$(`ZodArray`,(e,t)=>{JN(),OA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_N(e,t,n,r),e.element=t.element},{min(e,t){return this.check(hM(e,t))},nonempty(e){return this.check(hM(1,e))},max(e,t){return this.check(mM(e,t))},length(e,t){return this.check(gM(e,t))},unwrap(){return this.element}});function MP(e,t){return kM(jP,e,t)}var NP=$(`ZodObject`,(e,t)=>{JN(),PA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yN(e,t,n,r),YD(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return HP(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(rD(this._zod.def,{catchall:e}))},passthrough(){return this.clone(rD(this._zod.def,{catchall:OP()}))},loose(){return this.clone(rD(this._zod.def,{catchall:OP()}))},strict(){return this.clone(rD(this._zod.def,{catchall:AP()}))},strip(){return this.clone(rD(this._zod.def,{catchall:void 0}))},extend(e){return xD(this,e)},safeExtend(e){return CD(this,e)},merge(e){return wD(this,e)},pick(e){return vD(this,e)},omit(e){return bD(this,e)},partial(...e){return TD(qP,this,e[0])},exactPartial(...e){return TD(YP,this,e[0],`exactPartial`)},required(...e){return ED(rF,this,e[0])}});function PP(e,t){return new NP({type:`object`,shape:e??{},...Q(t)})}var FP=$(`ZodUnion`,(e,t)=>{IA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bN(e,t,n,r),e.options=t.options});function IP(e,t){return new FP({type:`union`,options:e,...Q(t)})}var LP=$(`ZodDiscriminatedUnion`,(e,t)=>{FP.init(e,t),RA.init(e,t)});function RP(e,t,n){return new LP({type:`union`,options:t,discriminator:e,...Q(n)})}var zP=$(`ZodIntersection`,(e,t)=>{zA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xN(e,t,n,r)});function BP(e,t){return new zP({type:`intersection`,left:e,right:t})}var VP=$(`ZodEnum`,(e,t)=>{HA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pN(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new VP({...t,checks:[],...Q(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new VP({...t,checks:[],...Q(r),entries:i})}});function HP(e,t){return new VP({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Q(t)})}var UP=$(`ZodLiteral`,(e,t)=>{UA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mN(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function WP(e,t){return new UP({type:`literal`,values:Array.isArray(e)?e:[e],...Q(t)})}var GP=$(`ZodTransform`,(e,t)=>{JN(),WA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gN(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new rO(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(RD(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(RD(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function KP(e){return new GP({type:`transform`,transform:e})}var qP=$(`ZodOptional`,(e,t)=>{KA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jN(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function JP(e){return new qP({type:`optional`,innerType:e})}var YP=$(`ZodExactOptional`,(e,t)=>{qA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jN(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function XP(e){return new YP({type:`optional`,innerType:e})}var ZP=$(`ZodNullable`,(e,t)=>{JA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>SN(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function QP(e){return new ZP({type:`nullable`,innerType:e})}var $P=$(`ZodDefault`,(e,t)=>{YA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>EN(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function eF(e,t){return new $P({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():uD(t)}})}var tF=$(`ZodPrefault`,(e,t)=>{ZA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>DN(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nF(e,t){return new tF({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():uD(t)}})}var rF=$(`ZodNonOptional`,(e,t)=>{QA.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>CN(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function iF(e,t){return new rF({type:`nonoptional`,innerType:e,...Q(t)})}var aF=$(`ZodCatch`,(e,t)=>{tj.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ON(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oF(e,t){return new aF({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ZD(t)})}var sF=$(`ZodPipe`,(e,t)=>{nj.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kN(e,t,n,r),e.in=t.in,e.out=t.out});function cF(e,t){return new sF({type:`pipe`,in:e,out:t})}var lF=$(`ZodReadonly`,(e,t)=>{ij.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>AN(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uF(e){return new lF({type:`readonly`,innerType:e})}var dF=$(`ZodCustom`,(e,t)=>{oj.init(e,t),YN.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hN(e,t,n,r)});function fF(e,t={}){return AM(dF,e,t)}function pF(e,t){return jM(e,t)}var mF=QN().regex(/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9_])?$/,`Nom de compte GitHub invalide`),hF=QN().regex(/^[A-Za-z0-9._-]+$/,`Nom de repo invalide`),gF=QN().trim().regex(/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9_])?\/[A-Za-z0-9._-]+$/,`Format attendu : owner/repo`);QN().regex(/^[0-9a-f]{7,40}$/,`SHA invalide`),PP({owner:mF,repo:hF,number:wP().int().positive()}),PP({repos:MP(gF).default([]),orgs:MP(mF).default([]),staleDays:wP().int().positive().default(5)}),IP([PP({kind:WP(`repo`),name:gF}),PP({kind:WP(`org`),name:mF})]);var _F=HP([`LEFT`,`RIGHT`]);HP([`COMMENT`,`APPROVE`,`REQUEST_CHANGES`]),RP(`subjectType`,[PP({subjectType:WP(`LINE`),path:QN().min(1),side:_F,line:wP().int().positive(),startLine:wP().int().positive().nullable(),startSide:_F.nullable(),body:QN().trim().min(1)}),PP({subjectType:WP(`FILE`),path:QN().min(1),body:QN().trim().min(1)})]);function vF(e,t){let n=new Set(e),r=new Map,i=new Map;for(let t of e)r.set(t,new Set),i.set(t,new Set);for(let e of t)e.from!==e.to&&n.has(e.from)&&n.has(e.to)&&(r.get(e.from).add(e.to),i.get(e.to).add(e.from));let a=e.filter(e=>r.get(e).size+i.get(e).size>0),o=e.filter(e=>r.get(e).size+i.get(e).size===0).sort(),s=new Map(a.map(e=>[e,r.get(e).size])),c=(e,t)=>i.get(t).size-i.get(e).size||r.get(e).size-r.get(t).size||e.localeCompare(t),l=[];for(;s.size>0;){let e;for(let[t,n]of s)n===0&&(e===void 0||c(t,e)<0)&&(e=t);if(e===void 0)for(let[t,n]of s)(e===void 0||n<s.get(e)||n===s.get(e)&&c(t,e)<0)&&(e=t);let t=e;l.push(t),s.delete(t);for(let e of i.get(t)){let t=s.get(e);t!==void 0&&s.set(e,t-1)}}return[...l,...o]}function yF(e,t,n){let r=new Set,i=[];for(let t of e)for(let e of vF(t.items,n))r.has(e)||(r.add(e),i.push(e));let a=t.filter(e=>!r.has(e));return[...i,...vF(a,n)]}function bF(e){let t=TE(),[n,r]=Ge({key:`br:draft:${e.draftKey}`,defaultValue:``}),[i,a]=(0,C.useState)(`write`),[o,s]=(0,C.useState)(null),c=(0,C.useRef)(null),l=fv({...t.markdown.queryOptions({text:n,context:e.repoContext}),enabled:i===`preview`&&n.trim()!==``,staleTime:1/0}),u=async t=>{let i=e.actions[t];if(i&&!i.disabled&&n.trim()!==``&&o===null){s(t);try{await i.run(n),r(``),e.onCancel?.()}catch{}finally{s(null)}}};return(0,W.jsxs)(J,{className:`editor`,p:8,children:[(0,W.jsxs)(jh,{value:i,onChange:a,variant:`outline`,children:[(0,W.jsxs)(jh.List,{children:[(0,W.jsx)(jh.Tab,{value:`write`,children:`Écrire`}),(0,W.jsx)(jh.Tab,{value:`preview`,children:`Aperçu`}),e.suggestionLines&&(0,W.jsx)(Qf,{ml:`auto`,size:`compact-xs`,variant:`subtle`,onClick:()=>{let t="```suggestion\n"+(e.suggestionLines??[]).join(`
|
|
106
107
|
`)+"\n```\n",i=c.current,o=i?.selectionStart??n.length;r(n.slice(0,o)+(o>0&&n[o-1]!==`
|
|
107
108
|
`?`
|
|
108
|
-
`:``)+t+n.slice(o)),a(`write`),requestAnimationFrame(()=>i?.focus())},children:`± suggestion`})]}),(0,W.jsx)(jh.Panel,{value:`write`,pt:6,children:(0,W.jsx)(Lp,{ref:c,autosize:!0,minRows:3,maxRows:18,autoFocus:e.autoFocus??!0,placeholder:e.placeholder??`Laisser un commentaire (Markdown)…`,value:n,onChange:e=>r(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),u(e.actions.length-1)):t.key===`Escape`&&(t.preventDefault(),e.onCancel?.())},styles:{input:{fontFamily:`var(--mantine-font-family-monospace)`,fontSize:13}}})}),(0,W.jsx)(jh.Panel,{value:`preview`,pt:6,children:(0,W.jsxs)(J,{mih:70,p:6,children:[n.trim()===``&&(0,W.jsx)(Z,{c:`dimmed`,children:`Rien à prévisualiser.`}),l.isFetching&&(0,W.jsx)(kl,{size:`xs`}),l.data&&(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:l.data}})]})})]}),(0,W.jsxs)(ql,{gap:6,mt:6,justify:`flex-end`,children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,mr:`auto`,children:[`brouillon conservé localement · `,(0,W.jsx)(Bp,{size:`xs`,children:`Ctrl ↵`}),` envoyer · `,(0,W.jsx)(Bp,{size:`xs`,children:`Esc`}),` `,`fermer`]}),e.onCancel&&(0,W.jsx)(Qf,{size:`compact-sm`,variant:`subtle`,color:`gray`,onClick:e.onCancel,children:`Annuler`}),e.actions.map((t,r)=>(0,W.jsx)(Qf,{size:`compact-sm`,variant:t.variant??(r===e.actions.length-1?`filled`:`default`),color:t.color,disabled:t.disabled||n.trim()===``,loading:o===r,onClick:()=>void u(r),children:t.label},t.label))]})]})}var xF=(0,C.createContext)(null);function SF(){let e=(0,C.useContext)(xF);if(!e)throw Error(`usePrView must be used inside <PrViewContext>`);return e}function CF(e){return t=>ng.show({color:`red`,title:e,message:t.message})}function wF(e){let t=TE(),n=Gg(),r=t.pr.get.queryKey(e),i=e=>n.setQueryData(r,t=>t&&e(t)),a=()=>n.invalidateQueries({queryKey:r}),o=()=>{a(),n.invalidateQueries({queryKey:t.inbox.get.queryKey()})};return{setFileViewed:hv(t.pr.setFileViewed.mutationOptions({onMutate:({path:e,viewed:t})=>i(n=>({...n,files:n.files.map(n=>n.path===e?{...n,viewed:t?`VIEWED`:`UNVIEWED`}:n)})),onError:e=>{CF(`Marquage « vu » impossible`)(e),a()}})),setHunksSeen:hv(t.pr.setHunksSeen.mutationOptions({onMutate:({hunks:e,seen:t})=>i(n=>{let r=new Set(n.seenHunks);for(let n of e){let e=`${n.path}\n${n.hash}`;t?r.add(e):r.delete(e)}return{...n,seenHunks:[...r]}}),onError:CF(`Marquage du hunk impossible`)})),markThreadsRead:hv(t.pr.markThreadsRead.mutationOptions()),visit:hv(t.pr.visit.mutationOptions()),reply:hv(t.pr.reply.mutationOptions({onSuccess:o,onError:CF(`Réponse non envoyée`)})),setResolved:hv(t.pr.setResolved.mutationOptions({onMutate:({threadId:e,resolved:t})=>i(n=>({...n,threads:n.threads.map(n=>n.id===e?{...n,isResolved:t}:n)})),onSettled:o,onError:CF(`Changement de statut impossible`)})),addThread:hv(t.pr.addThread.mutationOptions({onSuccess:o,onError:CF(`Commentaire non envoyé`)})),submitReview:hv(t.pr.submitReview.mutationOptions({onSuccess:()=>{ng.show({color:`green`,message:`Review envoyée.`}),o()},onError:CF(`Review non envoyée`)})),discardReview:hv(t.pr.discardReview.mutationOptions({onSuccess:o,onError:CF(`Abandon impossible`)})),comment:hv(t.pr.comment.mutationOptions({onSuccess:o,onError:CF(`Commentaire non envoyé`)})),deleteComment:hv(t.pr.deleteComment.mutationOptions({onSuccess:o,onError:CF(`Suppression impossible`)})),updateComment:hv(t.pr.updateComment.mutationOptions({onSuccess:o,onError:CF(`Modification impossible`)})),applySuggestion:hv(t.pr.applySuggestion.mutationOptions({onSuccess:e=>{ng.show({color:`green`,message:`Suggestion appliquée (commit ${e.slice(0,7)}).`}),o()},onError:CF(`Suggestion non appliquée`)}))}}function TF(e,t,n){let r=e.comments.at(-1);return e.isResolved||!r||r.author?.login===t?!1:n===t||e.comments.some(e=>e.author?.login===t)}function EF(){let e=SF(),t=wF(e.ref),[n,r]=(0,C.useState)(`open`),i=e.me,a=e.detail.pr.author?.login,o=e.detail.threads,s={open:o.filter(e=>!e.isResolved).length,mine:o.filter(e=>TF(e,i,a)).length,unread:o.filter(e=>e.unread>0).length,all:o.length},c=o.filter(e=>n===`open`?!e.isResolved:n===`mine`?TF(e,i,a):n!==`unread`||e.unread>0);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{padding:`10px 12px`,borderBottom:`1px solid var(--br-border)`,position:`sticky`,top:0,background:`var(--br-bg)`,zIndex:1},children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,mb:6,children:[o.length,` threads · `,e.detail.timeline.length,` messages généraux`]}),(0,W.jsx)(Qm,{size:`xs`,fullWidth:!0,value:n,onChange:e=>r(e),data:[{value:`open`,label:`Ouverts ${s.open}`},{value:`mine`,label:`Ma réponse ${s.mine}`},{value:`unread`,label:`Non lus ${s.unread}`},{value:`all`,label:`Tous ${s.all}`}]})]}),c.map(t=>{let n=t.comments.at(-1);return(0,W.jsxs)(`div`,{className:`conv-item`,"data-resolved":t.isResolved||void 0,"data-current":e.focusedThread===t.id||void 0,onClick:()=>e.scrollToThread(t.id),children:[(0,W.jsxs)(ql,{gap:6,wrap:`nowrap`,children:[(0,W.jsxs)(Z,{size:`xs`,ff:`monospace`,c:`dimmed`,truncate:!0,style:{flex:1},children:[t.path,t.subjectType===`FILE`?` · fichier`:t.line===null?``:`:${t.line}`,t.isOutdated?` · outdated`:``,t.isResolved?` · résolu`:``]}),t.unread>0&&(0,W.jsxs)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:[t.unread,` nouveau`,t.unread>1?`x`:``]}),t.pending&&(0,W.jsx)(Uf,{size:`xs`,color:`yellow`,variant:`light`,children:`en attente`})]}),n&&(0,W.jsxs)(Z,{size:`sm`,className:`clamp2`,my:2,children:[(0,W.jsx)(`b`,{children:n.author?.login??`ghost`}),` :`,` `,n.body.replace(/```suggestion[\s\S]*?```/g,`[suggestion]`)]}),(0,W.jsxs)(ql,{gap:4,children:[[...new Map(t.comments.map(e=>[e.author?.login,e.author])).values()].map(e=>(0,W.jsx)(Bf,{src:e?.avatarUrl,size:16},e?.login??`ghost`)),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[t.comments.length,` message`,t.comments.length>1?`s`:``,TF(t,i,a)?` · attend ma réponse`:``]})]})]},t.id)}),c.length===0&&(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,p:`md`,children:`Aucun thread pour ce filtre.`}),(0,W.jsx)(Z,{size:`xs`,tt:`uppercase`,fw:600,c:`dimmed`,px:12,pt:`md`,pb:4,children:`Conversation générale`}),(0,W.jsx)(nh,{gap:0,children:e.detail.timeline.map(e=>(0,W.jsxs)(`div`,{className:`comment`,"data-new":e.unread||void 0,children:[(0,W.jsx)(Bf,{src:e.author?.avatarUrl,size:22}),(0,W.jsxs)(`div`,{className:`comment-body`,children:[(0,W.jsxs)(ql,{gap:6,mb:2,children:[(0,W.jsx)(Z,{size:`sm`,fw:600,children:e.author?.login??`ghost`}),e.kind===`review`&&(0,W.jsxs)(Uf,{size:`xs`,variant:`light`,color:PE[e.state]?.color??`gray`,children:[`review : `,PE[e.state]?.label??e.state]}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(e.createdAt)}),e.unread&&(0,W.jsx)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:`nouveau`})]}),e.bodyHTML?(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:e.bodyHTML}}):(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:`(sans message)`})]})]},e.id))}),(0,W.jsx)(bF,{draftKey:`general:${e.ref.owner}/${e.ref.repo}#${e.ref.number}`,repoContext:`${e.ref.owner}/${e.ref.repo}`,placeholder:`Commentaire général sur la PR…`,autoFocus:!1,actions:[{label:`Commenter`,run:n=>t.comment.mutateAsync({prId:e.detail.pr.id,body:n})}]})]})}function DF(){let{pr:e}=SF().detail;return(0,W.jsxs)(`div`,{className:`panel-body`,children:[(0,W.jsxs)(ql,{gap:8,mb:`sm`,children:[(0,W.jsx)(Bf,{src:e.author?.avatarUrl,size:22}),(0,W.jsx)(Z,{size:`sm`,fw:600,children:e.author?.login??`ghost`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(e.createdAt)}),(0,W.jsx)(sf,{href:e.url,target:`_blank`,size:`xs`,c:`dimmed`,ml:`auto`,children:`modifier sur GitHub ↗`})]}),e.bodyHTML?(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:e.bodyHTML}}):(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:`Pas de description.`})]})}function OF(e){return typeof e==`object`?e.key:e}function kF(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function AF(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function jF(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var MF=(e,t)=>Math.abs(e-t)<1.01,NF=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})};function PF({offset:e,isScrolling:t,elementMax:n,holdOffset:r,scrollOffset:i,pendingWrite:a,clampedMaxAtWrite:o}){return t&&a===null&&e===i?`spurious`:a!==null&&Math.abs(e-a.target)<1.5?`readBack`:a!==null&&!a.smooth&&n!==null&&a.target>n+r+.5&&Math.abs(e-(n+r))<1.5||a!==null&&!a.smooth&&a.lowMaxes?.some(t=>Math.abs(e-t)<1.5)?`clampedReadBack`:o!==null&&Math.abs(e-o)<1.5?`clampedEcho`:`external`}var FF=e=>e===`smooth`||e===`smoothFinishing`;function IF({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!FF(n.phase)&&!MF(t,n.lastTargetOffset)&&!MF(t,r())&&e!==`clampedEcho`}var LF=40;function RF(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<LF;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<LF;)i--;if(i<0)return!1;let a=e[i],o=(t.offset-r.offset)/(t.t-r.t),s=(r.offset-a.offset)/(r.t-a.t);return o*s>=0&&Math.abs(o)>=2*Math.abs(s)&&Math.abs(o)-Math.abs(s)>=.8}function zF(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<LF;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var BF,VF=()=>{if(BF!==void 0)return BF;if(typeof navigator>`u`)return BF=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return BF=!0;let e=navigator.maxTouchPoints;return BF=navigator.platform===`MacIntel`&&e!==void 0&&e>0},HF,UF=()=>HF===void 0?HF=VF()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):HF,WF={capture:!0,passive:!0},GF=class{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!==`lateFling`,this.dragging=()=>this._touch?.phase===`down`&&this._touch.moved,this.tail=()=>this._touch?.phase===`tail`?this._touch.moved?`fling`:`tap`:null,this.onScroll=({isScrolling:e,ownReadBack:t,moved:n,external:r})=>(e&&this._touch?.phase===`tail`?this._openTail(this._touch.moved||!t,!1):this._touch?.phase===`lateFling`&&(this.host.now()>this._touch.until?this._touch=null:r&&e&&n&&this._openTail(!0,!1)),!t&&e&&n&&this._touch?.phase===`down`?(this._touch.moved=!0,!0):!1),this.touchStart=()=>{this.end(),this._touch={phase:`down`,moved:!1}},this.touchEnd=()=>{let e=this._touch?.phase===`down`&&this._touch.moved;this.end(),this._openTail(e,e)},this.end=()=>{let e=this.host.getWindow();this._touch?.phase===`tail`&&e!=null&&e.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),n=()=>this.touchEnd();return e.addEventListener(`touchstart`,t,WF),e.addEventListener(`touchend`,n,WF),e.addEventListener(`touchcancel`,n,WF),()=>{e.removeEventListener(`touchstart`,t,WF),e.removeEventListener(`touchend`,n,WF),e.removeEventListener(`touchcancel`,n,WF),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(!VF()||n==null)return;this.end();let r={phase:`tail`,moved:e,awaitingFling:t,timerId:n.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(r.moved,r.awaitingFling):(this._touch=r.awaitingFling?{phase:`lateFling`,until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=r}}get touch(){return this._touch}},KF=e=>{let{clientWidth:t,clientHeight:n}=e;return{width:t,height:n}},qF=e=>{let t=new Set;return{schedule:n=>{let r=e.requestAnimationFrame(()=>{t.delete(r),n()});t.add(r)},cancel:()=>{t.forEach(t=>e.cancelAnimationFrame(t)),t.clear()}}},JF=e=>e,YF=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},XF=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(KF(n)),!r.ResizeObserver)return()=>{};let a=qF(r),o=new r.ResizeObserver(()=>{let t=()=>{i(KF(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(t):t()});return o.observe(n,{box:`content-box`}),()=>{o.unobserve(n),a.cancel()}},ZF={passive:!0},QF=typeof window>`u`||`onscrollend`in window,$F=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&QF,o=0,s=a?null:NF(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,ZF),a&&r.addEventListener(`scrollend`,u,ZF),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},eI=(e,t)=>$F(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),tI=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},nI=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},rI=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,iI=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function aI(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var oI=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new GF({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if(e?.phase!==`queued`||this.pendingWrite!==null)return!1;let t=this._readElementOffset();return t===null||this._lastElementOffset===null||Math.abs(t-this._lastElementOffset)<1?!1:(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;e?.phase===`queued`&&zF(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=null,n=()=>{if(e)return e;let n=this.targetWindow;if(!n||!n.ResizeObserver)return null;let i=t=qF(n);return e=new n.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(r)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?i.schedule(t):t()})},r=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t?.cancel(),e=null,t=null},observe:e=>n()?.observe(e,{box:`border-box`}),unobserve:e=>n()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:JF,rangeExtractor:YF,onChange:()=>{},measureElement:tI,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>OF(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||aI(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:s}=this.options,c=0;for(;c<a&&s(c)!==e;)c++;if(c<a){let e=n[c];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(o=n-this.scrollOffset,this.scrollOffset=n)}}}i?this.pendingScrollAnchor={kind:`follow`,behavior:i}:o!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:`anchor`,delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=AF(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(e=this._momentumStop)==null||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{let n=t?this._elementMaxScrollOffset():null,r=this._reportedOverscroll;this._reportedOverscroll=e<0||n!==null&&e>n+1;let i=e;this._lastElementOffset=i,e=this._toLayoutOffset(e);let a=this._classifyScrollEvent(e,t,n);if(a===`spurious`)return;a===`readBack`?e=this.pendingWrite.target:a===`clampedReadBack`&&this.scrollState?.index!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:IF({kind:a,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let o=this.getScrollOffset(),s=this.scrollDirection;this.scrollDirection=t?o===e?this.scrollDirection:o<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t;let c=this.scrollState;if(c?.phase===`queued`&&a===`external`&&t){if(r||this._reportedOverscroll)c.samples=[];else{let e=this.now();c.samples=[...(c.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:i}],(s!==null&&this.scrollDirection!==s||RF(c.samples))&&(this.scrollState=null)}}this._iosGesture.onScroll({isScrolling:t,ownReadBack:a===`readBack`,moved:e!==o,external:a===`external`&&this.scrollState?.phase!==`smooth`&&this.scrollState?.phase!==`smoothFinishing`})&&this.scrollState?.phase===`queued`&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled&&(t.kind===`anchor`?this._canWriteScroll()?iI(this.scrollState)&&!MF(this.getScrollOffset()-t.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(t.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=t.delta,this._followOffsetTarget(t.delta),this.notify(!1)):this.scrollToEnd({behavior:t.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,n)=>PF({offset:e,isScrolling:t,elementMax:n,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:this._clampedAdjustment?.maxAtWrite??null}),this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(e===null||e.phase!==`queued`)return;let{behavior:t}=e;this.getMeasurements();let n=this.getScrollStateTarget(e);e.lastTargetOffset=n,this._clampedAdjustment=null,e.phase=rI(t,e.index!=null&&MF(n,this.getScrollOffset())),this._scrollToOffset(n,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(e==null)return null;let{horizontal:t,isRtl:n}=this.options;return typeof e.scrollTop==`number`?t?e.scrollLeft*(n&&-1||1):e.scrollTop:typeof e.scrollY==`number`?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(VF()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||this.scrollState?.phase===`smooth`)return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let t=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(t),this._scrollToOffset(t)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=AF(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=AF(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=kF(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=AF(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=lI(e,t,n,r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=AF(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!iI(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!iI(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this._getLayoutTotalSize():0,u=this.getScrollOffset(),d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!iI(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=!1;if(this._awaitingCommandReadBack()||(o?p=this.applyScrollAdjustment(this._getLayoutTotalSize()-l):f&&(p=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=p);return}this.notify(p),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=AF(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,n)=>{let r=[];for(let i=0,a=e.length;i<a;i++){let a=t[e[i]];r.push(n===0?a:{...a,start:a.start-n,end:a.end-n})}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return jF(t[sI(0,t.length-1,r?e=>n[e*2]:e=>jF(t[e]).start,e)])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(e===null)return;let t=this.pendingWrite,n=Math.max(e,0)+this._holdOffset;if(n>=t.target)return;let r=t.lowMaxes??=[];r[r.length-1]!==n&&r.push(n)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{let t=e+this._holdOffset;return this.pendingScrollAnchor?.kind===`anchor`&&(t+=this.pendingScrollAnchor.delta),t},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(e===null)return null;if(`scrollHeight`in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if(`document`in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,n=this.targetWindow;if(t===null||n===null)return;let r=`document`in t?t.document.scrollingElement:t;if(!r?.style)return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:i}=r,a=this.options.horizontal?`overflow-x`:`overflow-y`,o=i.getPropertyValue(a),s=i.getPropertyPriority(a);i.setProperty(a,`hidden`,`important`);let c={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=c,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===c&&(this._momentumStop=null,c.restore()&&c.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(t===null)return null;let n=t+this._holdOffset;return e>n+.5?{target:e,maxAtWrite:n}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),n,`absolute`)},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r;this._startScroll({index:e,align:a},i,n,`absolute`)},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,`start`);this._startScroll({index:null,align:`start`},n,t,`relative`)},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:`end`,toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,`absolute`):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n}={})=>{let r={target:e+(t??0),smooth:n===`smooth`};return this.pendingWrite=r,this.options.scrollToFn(e-this._holdOffset,{behavior:n,adjustments:t},this),r},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(VF()&&this._iosGesture.dragging())&&e!==null&&!MF(e,this.getScrollOffset())},this._followOffsetTarget=e=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(e===0)return!1;if(this._followOffsetTarget(e),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+e);let r=this._scrollToOffset(n,{adjustments:e,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}return this._holdOffset+=e,this.scrollOffset!==null&&(this.scrollOffset+=e),!0}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase===`queued`){this.scheduleScrollReconcile();return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&MF(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=iI(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&&UF()){this._stopMomentum(()=>{this.scrollState?.phase!==`queued`||this._iosGesture.tail()!==`fling`||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:`queued`,behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:rI(n,e.index!=null&&MF(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},sI=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function cI(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function lI(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=cI(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=sI(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var uI=typeof document<`u`?C.useLayoutEffect:C.useEffect;function dI({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=C.useReducer(e=>e+1,0)[1],a=C.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=C.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,xt.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=C.useState(()=>{let e=new oI(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),uI(()=>d._didMount(),[]),uI(()=>(s(d),d._willUpdate())),uI(()=>{l(d)}),d}function fI(e){return dI({observeElementRect:XF,observeElementOffset:eI,scrollToFn:nI,...e})}var pI={astro:`astro`,bash:`shellscript`,bat:`bat`,c:`c`,cc:`cpp`,cjs:`javascript`,clj:`clojure`,cljs:`clojure`,cmake:`cmake`,cpp:`cpp`,cs:`csharp`,css:`css`,cts:`typescript`,cxx:`cpp`,dart:`dart`,diff:`diff`,dockerfile:`dockerfile`,edn:`clojure`,erl:`erlang`,ex:`elixir`,exs:`elixir`,fish:`shellscript`,fs:`fsharp`,fsx:`fsharp`,gleam:`gleam`,go:`go`,gql:`graphql`,gradle:`groovy`,graphql:`graphql`,groovy:`groovy`,h:`c`,hcl:`hcl`,hh:`cpp`,hpp:`cpp`,hrl:`erlang`,hs:`haskell`,htm:`html`,html:`html`,hxx:`cpp`,ini:`ini`,java:`java`,jl:`julia`,js:`javascript`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsx:`jsx`,kt:`kotlin`,kts:`kotlin`,less:`less`,lua:`lua`,m:`objective-c`,markdown:`markdown`,md:`markdown`,mdx:`mdx`,mjs:`javascript`,mk:`makefile`,ml:`ocaml`,mli:`ocaml`,mm:`objective-c`,mts:`typescript`,nix:`nix`,patch:`diff`,php:`php`,pl:`perl`,pm:`perl`,prisma:`prisma`,properties:`properties`,proto:`proto`,ps1:`powershell`,psm1:`powershell`,py:`python`,pyi:`python`,r:`r`,rake:`ruby`,rb:`ruby`,rs:`rust`,sass:`sass`,scala:`scala`,sc:`scala`,scss:`scss`,sh:`shellscript`,sql:`sql`,svelte:`svelte`,svg:`xml`,swift:`swift`,tf:`terraform`,tfvars:`terraform`,toml:`toml`,ts:`typescript`,tsx:`tsx`,vue:`vue`,xml:`xml`,xsd:`xml`,xsl:`xml`,yaml:`yaml`,yml:`yaml`,zig:`zig`,zsh:`shellscript`},mI={".babelrc":`jsonc`,".bash_profile":`shellscript`,".bashrc":`shellscript`,".editorconfig":`ini`,".env":`dotenv`,".eslintrc":`jsonc`,".gitconfig":`ini`,".npmrc":`ini`,".prettierrc":`json`,".profile":`shellscript`,".swcrc":`jsonc`,".zprofile":`shellscript`,".zshrc":`shellscript`,brewfile:`ruby`,"cmakelists.txt":`cmake`,containerfile:`dockerfile`,dockerfile:`dockerfile`,gemfile:`ruby`,gnumakefile:`makefile`,jenkinsfile:`groovy`,"jsconfig.json":`jsonc`,makefile:`makefile`,podfile:`ruby`,rakefile:`ruby`,"tsconfig.json":`jsonc`};function hI(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase(),n=mI[t];if(n)return n;if(t.startsWith(`dockerfile.`)||t.startsWith(`containerfile.`))return`dockerfile`;if(t.startsWith(`.env.`))return`dotenv`;if(t.startsWith(`tsconfig.`)&&t.endsWith(`.json`)||t.endsWith(`.json`)&&(e.startsWith(`.vscode/`)||e.includes(`/.vscode/`)))return`jsonc`;let r=t.lastIndexOf(`.`);return r<=0?null:pI[t.slice(r+1)]??null}function gI(e){return typeof e==`object`&&!!e&&`content`in e&&typeof e.content==`string`&&`color`in e&&(e.color===void 0||typeof e.color==`string`)&&`fontStyle`in e&&typeof e.fontStyle==`number`}function _I(e){return Array.isArray(e)&&e.every(e=>Array.isArray(e)&&e.every(gI))}function vI(e){return typeof e!=`object`||!e||!(`id`in e)||typeof e.id!=`number`?!1:`ok`in e&&e.ok===!0?`tokens`in e&&_I(e.tokens):`ok`in e&&e.ok===!1&&`error`in e&&typeof e.error==`string`}var yI=200,bI,xI=!1,SI=!1,CI=0,wI=new Map;function TI(...e){SI||(SI=!0,console.warn(`[highlight]`,...e))}function EI(e){TI(`syntax highlighting disabled:`,e),xI=!0,bI?.terminate(),bI=void 0;let t=Error(`highlight worker unavailable`);for(let e of wI.values())e.reject(t);wI.clear()}function DI(){if(bI)return bI;let e=new Worker(new URL(`/assets/highlight.worker-D2jBd466.js`,``+import.meta.url),{type:`module`});return e.addEventListener(`message`,e=>{let t=e.data;if(!vI(t)){EI(Error(`malformed worker message`));return}let n=wI.get(t.id);n&&(wI.delete(t.id),t.ok?n.resolve(t.tokens):n.reject(Error(t.error)))}),e.addEventListener(`error`,e=>EI(e.message||`worker error`)),e.addEventListener(`messageerror`,()=>EI(Error(`undeserializable worker message`))),bI=e,e}async function OI(e,t){if(xI)throw Error(`highlight worker unavailable`);let n=CI++,r=Promise.withResolvers();return wI.set(n,r),DI().postMessage({id:n,lang:e,lines:t}),r.promise}var kI=new Map,AI=new WeakMap;function jI(e){if(kI.delete(e.key),kI.set(e.key,e),!(kI.size<=yI))for(let[e,t]of kI){if(kI.size<=yI)break;t.listeners.size===0&&t.state!==`pending`&&kI.delete(e)}}function MI(e){e.state=`pending`;let t=t=>{e.tokens=t,e.state=`settled`;for(let t of e.listeners)t()};OI(e.lang,e.lines).then(t,e=>{TI(`highlighting failed:`,e),t(null)})}function NI(e,t,n){let r={key:e,lang:t,lines:n,tokens:null,state:`idle`,listeners:new Set,subscribe:e=>(r.listeners.add(e),jI(r),r.state===`idle`&&MI(r),()=>r.listeners.delete(e)),getSnapshot:()=>r.tokens};return r}function PI(e){let t=3735928559,n=1103547991,r=0;for(let i of e){if(r+=i.length+1,i.length>2e3||r>3e5)return null;for(let e=0;e<i.length;e++){let r=i.charCodeAt(e);t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677)}t=Math.imul(t^10,2654435761),n=Math.imul(n^10,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}function FI(e,t){let n=AI.get(t);n||(n=new Map,AI.set(t,n));let r=n.get(e);if(r!==void 0)return r;let i=hI(e),a=i===null?null:PI(t),o=null;if(i!==null&&a!==null){let n=`${i}\0${e}\0${t.length}\0${a}`;o=kI.get(n)??NI(n,i,t)}return n.set(e,o),o}var II=()=>()=>{},LI=()=>null;function RI(e,t){let n=t===null?null:FI(e,t);return(0,C.useSyncExternalStore)(n?.subscribe??II,n?.getSnapshot??LI)}function zI(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.type===`context`){t.push({left:r,right:r}),n++;continue}let i=[],a=[];for(;n<e.length&&e[n].type===`del`;)i.push(e[n++]);for(;n<e.length&&e[n].type===`add`;)a.push(e[n++]);for(let e=0;e<Math.max(i.length,a.length);e++)t.push({left:i[e]??null,right:a[e]??null})}return t}function BI(e,t,n){return`${t}:${n}:${e}`}function VI(e){let t=[],n=[],r=[],i=new Map,a=new Map,o=new Map;for(let t of e.threads){let e=o.get(t.path)??[];e.push(t),o.set(t.path,e)}let s=new Set,c=new Set(e.files.map(e=>e.path));for(let t of e.threads)if(t.line!==null&&t.subjectType===`LINE`&&e.anchorable(t.side)){let e=BI(t.path,t.side,t.line);a.set(e,[...a.get(e)??[],t.id])}let l=(e,n,r)=>{let a=n.filter(e=>!s.has(e));if(a.length!==0){for(let e of a)s.add(e),i.set(e,t.length);t.push({kind:`threads`,key:r,fileIdx:e,threadIds:a})}};if(e.files.forEach((c,u)=>{if(e.onlyFile!==null&&c.path!==e.onlyFile||(n[u]=t.length,t.push({kind:`file`,key:`f:${c.path}`,fileIdx:u}),e.collapsed.has(c.path)))return;let d=o.get(c.path)??[],f=d.filter(e=>e.subjectType===`FILE`).map(e=>e.id);l(u,f,`tf:${c.path}`),e.fileComposer===c.path&&t.push({kind:`composer`,key:`cf:${c.path}`,fileIdx:u,target:`file`}),c.binary?t.push({kind:`notice`,key:`n:${c.path}`,fileIdx:u,text:`Fichier binaire.`}):c.truncated?t.push({kind:`notice`,key:`n:${c.path}`,fileIdx:u,text:`Diff trop volumineux pour l’API GitHub : contenu à consulter sur GitHub.`}):c.hunks.length===0&&t.push({kind:`notice`,key:`n:${c.path}`,fileIdx:u,text:c.status===`renamed`?`Renommé sans modification.`:`Aucun changement de contenu (mode / fichier vide).`});let p=(t,n)=>e.composer!==null&&e.composer.path===c.path&&e.composer.side===t&&e.composer.end===n;c.hunks.forEach((n,i)=>{r.push({row:t.length,fileIdx:u,hunkIdx:i}),t.push({kind:`hunk`,key:`h:${c.path}:${i}`,fileIdx:u,hunkIdx:i});let o=(e,n,r)=>{let i=[],o=!1;n?.newNo!=null&&(i.push(...a.get(BI(c.path,`RIGHT`,n.newNo))??[]),o||=p(`RIGHT`,n.newNo)),e?.oldNo!=null&&(i.push(...a.get(BI(c.path,`LEFT`,e.oldNo))??[]),o||=p(`LEFT`,e.oldNo)),l(u,i,`t:${r}`),o&&t.push({kind:`composer`,key:`c:${r}`,fileIdx:u,target:`line`})};if(e.layout===`split`&&c.status!==`added`&&c.status!==`deleted`)for(let e of zI(n.lines)){let n=`${c.path}:${e.left?.oldNo??`-`}:${e.right?.newNo??`-`}`;t.push({kind:`split`,key:`s:${n}`,fileIdx:u,hunkIdx:i,left:e.left,right:e.right}),o(e.left,e.right,n)}else for(let e of n.lines){let n=`${c.path}:${e.oldNo??`-`}:${e.newNo??`-`}`;t.push({kind:`line`,key:`l:${n}`,fileIdx:u,hunkIdx:i,line:e}),o(e.type===`add`?null:e,e.type===`del`?null:e,n)}});let m=d.filter(e=>!s.has(e.id)).map(e=>e.id);if(m.length>0){for(let e of m)s.add(e),i.set(e,t.length);t.push({kind:`orphans`,key:`o:${c.path}`,fileIdx:u,threadIds:m,title:`Threads outdated ou hors de la plage affichée`})}}),e.onlyFile===null){let n=e.threads.filter(e=>!c.has(e.path)&&!s.has(e.id)).map(e=>e.id);if(n.length>0){for(let e of n)i.set(e,t.length);t.push({kind:`orphans`,key:`o:outside`,fileIdx:null,threadIds:n,title:`Threads sur des fichiers hors de la plage affichée`})}}return{rows:t,fileRow:n,hunkRows:r,threadRow:i}}function HI(e){let t=[],n=/```suggestion[^\n]*\n([\s\S]*?)```/g;for(let r=n.exec(e);r;r=n.exec(e))t.push(r[1]??``);return t}function UI({diffHunk:e}){let t=e.split(`
|
|
109
|
-
`).slice(1).slice(-8);return(0,W.jsx)(`div`,{className:`snippet`,children:t.map((e,t)=>(0,W.jsx)(`div`,{className:e.startsWith(`+`)?`c-add`:e.startsWith(`-`)?`c-del`:void 0,children:e||` `},t))})}function WI({thread:e,showPath:t=!1}){let n=SF(),r=wF(n.ref),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=n.focusedThread===e.id,c=e.comments.at(-1),l=e.lastReadCommentId?e.comments.findIndex(t=>t.id===e.lastReadCommentId):-1,u=(e,t)=>t>l&&e.author?.login!==n.me,d=r.markThreadsRead.mutate,f=c?.id;(0,C.useEffect)(()=>{let t=o.current;if(!t||!f||e.lastReadCommentId===f)return;let n,r=new IntersectionObserver(([t])=>{clearTimeout(n),t?.isIntersecting&&(n=setTimeout(()=>{d([{threadId:e.id,lastCommentId:f}]),r.disconnect()},1200))});return r.observe(t),()=>{clearTimeout(n),r.disconnect()}},[f,e.id,e.lastReadCommentId,d]);let p=n.detail.canWrite&&n.detail.pr.sameRepo&&n.detail.pr.state===`OPEN`&&!e.isOutdated&&e.side===`RIGHT`&&e.line!==null,m=n.pendingReviewId,h=e.subjectType===`FILE`?`commentaire sur le fichier`:e.isOutdated?`ligne ${e.originalLine??`?`} (version d’origine)`:e.startLine!==null&&e.startLine!==e.line?`lignes ${e.startLine}–${e.line}`:`ligne ${e.line}`;return(0,W.jsxs)(`div`,{ref:o,className:`thread`,"data-thread":e.id,"data-resolved":e.isResolved||void 0,"data-unread":e.unread>0||void 0,"data-focus":s||void 0,onClick:()=>n.setFocusedThread(e.id),children:[(0,W.jsxs)(`div`,{className:`thread-head`,children:[e.pending?(0,W.jsx)(Uf,{size:`xs`,color:`yellow`,variant:`light`,children:`en attente (review non soumise)`}):e.isResolved?(0,W.jsxs)(Uf,{size:`xs`,color:`green`,variant:`light`,children:[`✓ résolu`,e.resolvedBy?` par ${e.resolvedBy}`:``]}):(0,W.jsx)(Uf,{size:`xs`,color:`yellow`,variant:`outline`,children:`non résolu`}),e.isOutdated&&(0,W.jsx)(Uf,{size:`xs`,color:`gray`,variant:`outline`,children:`outdated`}),e.unread>0&&(0,W.jsxs)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:[e.unread,` nouveau`,e.unread>1?`x`:``]}),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,truncate:!0,children:[t?`${e.path} · `:``,h,e.subjectType===`LINE`?` · ${e.side===`LEFT`?`ancien code`:`nouveau code`}`:``]}),(0,W.jsx)(`div`,{style:{flex:1}}),(e.isResolved?e.canUnresolve:e.canResolve)&&(0,W.jsx)(Qf,{size:`compact-xs`,variant:`subtle`,color:`gray`,onClick:t=>{t.stopPropagation(),r.setResolved.mutate({threadId:e.id,resolved:!e.isResolved})},children:e.isResolved?`Rouvrir`:`Résoudre`}),e.comments[0]&&(0,W.jsx)(sf,{href:e.comments[0].url,target:`_blank`,size:`xs`,c:`dimmed`,children:`GitHub ↗`})]}),(e.isOutdated||e.line===null)&&e.diffHunk&&(0,W.jsx)(UI,{diffHunk:e.diffHunk}),e.comments.map((t,i)=>(0,W.jsxs)(`div`,{className:`comment`,"data-new":u(t,i)||void 0,children:[(0,W.jsx)(Bf,{src:t.author?.avatarUrl,size:24}),(0,W.jsxs)(`div`,{className:`comment-body`,children:[(0,W.jsxs)(ql,{gap:6,mb:2,children:[(0,W.jsx)(Z,{size:`sm`,fw:600,children:t.author?.login??`ghost`}),(0,W.jsx)(Jm,{label:new Date(t.createdAt).toLocaleString(`fr`),children:(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(t.createdAt)})}),u(t,i)&&(0,W.jsx)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:`nouveau`}),t.pending&&(0,W.jsx)(Uf,{size:`xs`,color:`yellow`,variant:`light`,children:`en attente`}),t.pending&&t.canDelete&&(0,W.jsx)(Qf,{size:`compact-xs`,variant:`subtle`,color:`red`,ml:`auto`,onClick:()=>r.deleteComment.mutate({commentId:t.id}),children:`Supprimer`})]}),(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:t.bodyHTML}}),p&&!t.pending&&HI(t.body).map((i,a)=>(0,W.jsx)(Qf,{mt:6,size:`compact-xs`,color:`green`,variant:`light`,loading:r.applySuggestion.isPending,onClick:()=>r.applySuggestion.mutate({ref:n.ref,branch:n.detail.pr.headRefName,expectedHeadOid:n.detail.pr.headRefOid,path:e.path,side:`RIGHT`,startLine:e.startLine??e.line,endLine:e.line,replacement:i,message:`Apply suggestion from @${t.author?.login??`reviewer`}\n\n${t.url}`}),children:`Appliquer la suggestion (commit)`},a))]})]},t.id)),e.canReply&&(i?(0,W.jsx)(bF,{draftKey:`reply:${e.id}`,repoContext:`${n.ref.owner}/${n.ref.repo}`,onCancel:()=>a(!1),placeholder:`Répondre…`,actions:[...e.canResolve&&!e.isResolved&&!m?[{label:`Répondre & résoudre`,variant:`default`,run:async t=>{await r.reply.mutateAsync({threadId:e.id,body:t,pendingReviewId:null}),await r.setResolved.mutateAsync({threadId:e.id,resolved:!0})}}]:[],{label:m?`Ajouter à la review`:`Répondre`,run:t=>r.reply.mutateAsync({threadId:e.id,body:t,pendingReviewId:m})}]}):(0,W.jsx)(ql,{p:8,gap:8,children:(0,W.jsx)(Qf,{"data-reply":!0,variant:`default`,size:`compact-sm`,style:{flex:1,justifyContent:`flex-start`},styles:{inner:{justifyContent:`flex-start`}},onClick:()=>a(!0),children:(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:`Répondre…`})})}))]})}function GI(e){let t={old:[],new:[],oldIndex:new Map,newIndex:new Map};for(let n of e.hunks)for(let e of n.lines)e.oldNo!==null&&(t.oldIndex.set(e.oldNo,t.old.length),t.old.push(e.content)),e.newNo!==null&&(t.newIndex.set(e.newNo,t.new.length),t.new.push(e.content));return t}var KI={file:52,hunk:28,split:20,line:20,threads:160,composer:230,notice:36,orphans:200};function qI(e,t,n){let r=e.hunks.filter(t=>n.has(`${e.path}\n${t.hash}`)).length;return{state:t===`VIEWED`?`viewed`:t===`DISMISSED`?`dismissed`:r>0?`partial`:`none`,seenHunks:r}}function JI(e){let t=SF();return qI(e,t.detail.files.find(t=>t.path===e.path)?.viewed,t.seenHunks)}function YI(){let e=SF(),t=wF(e.ref),n=(e,t)=>t.map(t=>({path:e.path,hash:t.hash}));return{toggleFile:(r,i)=>{t.setFileViewed.mutate({prId:e.detail.pr.id,path:r.path,viewed:i}),r.hunks.length>0&&t.setHunksSeen.mutate({ref:e.ref,hunks:n(r,r.hunks),seen:i})},toggleHunk:(r,i,a)=>{t.setHunksSeen.mutate({ref:e.ref,hunks:n(r,[i]),seen:a});let o=r.hunks.filter(e=>e!==i),s=a&&o.every(t=>e.seenHunks.has(`${r.path}\n${t.hash}`)),c=e.detail.files.find(e=>e.path===r.path)?.viewed;e.range.fullPr&&s&&c!==`VIEWED`?t.setFileViewed.mutate({prId:e.detail.pr.id,path:r.path,viewed:!0}):!a&&c===`VIEWED`&&t.setFileViewed.mutate({prId:e.detail.pr.id,path:r.path,viewed:!1})}}}function XI({state:e}){return(0,W.jsx)(`span`,{className:`vbox`,"data-state":e,children:e===`viewed`?`✓`:e===`dismissed`?`•`:``})}var ZI={added:{label:`ajouté`,color:`green`},deleted:{label:`supprimé`,color:`red`},renamed:{label:`renommé`,color:`blue`},modified:null};function QI(e){let{file:t}=e,n=SF(),r=YI(),{state:i,seenHunks:a}=JI(t),o=n.detail.threads.filter(e=>e.path===t.path),s=o.filter(e=>!e.isResolved).length,c=ZI[t.status];return(0,W.jsxs)(`div`,{className:`file-head`,"data-viewed":i===`viewed`||void 0,children:[(0,W.jsx)(Ll,{size:`sm`,variant:`subtle`,color:`gray`,onClick:e.onToggleCollapse,"aria-label":`Replier`,children:e.collapsed?`▸`:`▾`}),(0,W.jsx)(Jm,{label:t.status===`renamed`?`${t.oldPath} → ${t.path}`:t.path,openDelay:400,children:(0,W.jsxs)(`span`,{className:`file-path`,children:[t.status===`renamed`&&(0,W.jsxs)(Z,{span:!0,c:`dimmed`,inherit:!0,children:[t.oldPath,` →`,` `]}),t.path]})}),c&&(0,W.jsx)(Uf,{size:`xs`,variant:`light`,color:c.color,children:c.label}),i===`dismissed`&&(0,W.jsx)(Uf,{size:`xs`,variant:`light`,color:`orange`,children:`modifié depuis vu`}),(0,W.jsxs)(Z,{size:`xs`,span:!0,children:[(0,W.jsxs)(Z,{span:!0,c:`green.4`,inherit:!0,children:[`+`,t.additions]}),` `,(0,W.jsxs)(Z,{span:!0,c:`red.4`,inherit:!0,children:[`−`,t.deletions]})]}),t.hunks.length>1&&(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[a,`/`,t.hunks.length,` hunks vus`]}),o.length>0&&(0,W.jsxs)(Z,{size:`xs`,c:s>0?`yellow.4`:`dimmed`,children:[(0,W.jsx)(`i`,{className:`ico-c`}),s,`/`,o.length]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(sf,{size:`xs`,c:`dimmed`,target:`_blank`,href:`https://github.com/${n.ref.owner}/${n.ref.repo}/blob/${n.detail.pr.headRefOid}/${t.path}`,children:`fichier ↗`}),n.detail.pr.state===`OPEN`&&(0,W.jsx)(Jm,{label:`Commenter le fichier entier`,openDelay:300,children:(0,W.jsx)(Qf,{size:`compact-xs`,variant:`subtle`,color:`gray`,leftSection:(0,W.jsx)(`i`,{className:`ico-c`}),onClick:()=>{e.collapsed&&e.onToggleCollapse(),n.setFileComposer(t.path)},children:`Commenter`})}),(0,W.jsx)(Qf,{size:`compact-xs`,variant:i===`viewed`?`light`:`default`,color:i===`viewed`?`green`:`gray`,leftSection:(0,W.jsx)(XI,{state:i}),onClick:()=>{let e=i!==`viewed`;r.toggleFile(t,e),e&&n.advanceFrom(t.path)},children:`Vu`})]})}function $I({tokens:e,text:t}){return e?(0,W.jsx)(W.Fragment,{children:e.map((e,t)=>(0,W.jsx)(`span`,{style:{color:e.color,fontStyle:e.fontStyle&1?`italic`:void 0,fontWeight:e.fontStyle&2?600:void 0},children:e.content},t))}):(0,W.jsx)(W.Fragment,{children:t})}var eL={add:`c-add`,del:`c-del`,context:``},tL=(0,C.memo)(function(e){let{row:t,file:n,sources:r}=e,i=SF(),a=RI(n.path,r.old),o=RI(n.path,r.new),s=i.selection,c=(e,t)=>t!==null&&s!==null&&s.path===n.path&&s.side===e&&t>=s.start&&t<=s.end,l=(e,t)=>{if(t===`LEFT`){let t=e.oldNo===null?void 0:r.oldIndex.get(e.oldNo);return t===void 0?void 0:a?.[t]}let n=e.newNo===null?void 0:r.newIndex.get(e.newNo);return n===void 0?void 0:o?.[n]},u=(e,t,r)=>{t!==null&&i.canComment(e)&&(r.shiftKey&&s&&s.path===n.path&&s.side===e?i.setSelection({...s,start:Math.min(s.start,t),end:Math.max(s.end,t)}):i.setSelection({path:n.path,side:e,start:t,end:t}))},d=(e,t,n)=>(0,W.jsx)(`div`,{className:`ln ${n}`,"data-disabled":!i.canComment(e)||void 0,title:i.canComment(e)?`Commenter (Maj+clic : plage)`:void 0,onClick:n=>u(e,t,n),children:t??``}),f=(e,t,n)=>(0,W.jsxs)(`div`,{className:`tx ${n}`,children:[e&&(0,W.jsx)($I,{tokens:l(e,t),text:e.content}),e?.noNewline&&(0,W.jsx)(`span`,{className:`nonl`,children:`⏎̸ pas de fin de ligne`})]});if(t.kind===`split`){let n=t.left,r=t.right,i=n?n.type===`del`?eL.del:``:`c-empty`,a=r?r.type===`add`?eL.add:``:`c-empty`,o=c(`LEFT`,n?.oldNo??null)?` c-sel`:``,s=c(`RIGHT`,r?.newNo??null)?` c-sel`:``;return(0,W.jsx)(`div`,{className:`code${e.last?` last`:``}`,children:(0,W.jsxs)(`div`,{className:`code-row split`,"data-viewed":e.viewed||void 0,children:[d(`LEFT`,n?.oldNo??null,i+o),f(n,`LEFT`,i+o),d(`RIGHT`,r?.newNo??null,a+s),f(r,`RIGHT`,a+s)]})})}let p=t.line,m=eL[p.type],h=p.type===`del`?`LEFT`:`RIGHT`,g=c(h,h===`LEFT`?p.oldNo:p.newNo)?` c-sel`:``;return(0,W.jsx)(`div`,{className:`code${e.last?` last`:``}`,children:(0,W.jsxs)(`div`,{className:`code-row unified`,"data-viewed":e.viewed||void 0,children:[d(`LEFT`,p.oldNo,m+g),d(`RIGHT`,p.newNo,m+g),f(p,h,m+g)]})})});function nL(e){let t=SF(),n=YI(),r=t.seenHunks.has(`${e.file.path}\n${e.hunk.hash}`),i=e.hunk;return(0,W.jsxs)(`div`,{className:`hunk-head`,"data-current":e.current||void 0,"data-unseen":!r||void 0,children:[(0,W.jsxs)(`span`,{children:[`@@ -`,i.oldStart,`,`,i.oldLines,` +`,i.newStart,`,`,i.newLines,` @@ `,i.section]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(Qf,{size:`compact-xs`,variant:r?`light`:`subtle`,color:r?`green`:`gray`,onClick:()=>n.toggleHunk(e.file,e.hunk,!r),children:r?`✓ hunk vu`:`Marquer le hunk vu`})]})}function rL({file:e,target:t}){let n=SF(),r=wF(n.ref),i=n.selection;if(t===`line`&&!i)return null;let a,o,s=null,c;t===`file`||!i?(a=t=>({subjectType:`FILE`,path:e.path,body:t}),o=`sur le fichier`,c=()=>n.setFileComposer(null)):(a=e=>({subjectType:`LINE`,path:i.path,side:i.side,line:i.end,startLine:i.start===i.end?null:i.start,startSide:i.start===i.end?null:i.side,body:e}),o=`${i.start===i.end?`ligne ${i.end}`:`lignes ${i.start}–${i.end}`} · ${i.side===`LEFT`?`ancien code`:`nouveau code`}`,i.side===`RIGHT`&&(s=e.hunks.flatMap(e=>e.lines.filter(e=>e.newNo!==null&&e.newNo>=i.start&&e.newNo<=i.end).map(e=>e.content))),c=()=>n.setSelection(null));let l=n.pendingReviewId,u=(e,t)=>r.addThread.mutateAsync({prId:n.detail.pr.id,pendingReviewId:t===`review`?l:null,thread:a(e),mode:t});return(0,W.jsx)(`div`,{className:`diff-block`,children:(0,W.jsxs)(`div`,{className:`thread`,"data-focus":!0,children:[(0,W.jsxs)(`div`,{className:`thread-head`,children:[`Nouveau commentaire · `,o,l&&(0,W.jsx)(Uf,{size:`xs`,color:`yellow`,variant:`light`,ml:`auto`,children:`review en attente`})]}),(0,W.jsx)(bF,{draftKey:`new:${n.ref.owner}/${n.ref.repo}#${n.ref.number}`,repoContext:`${n.ref.owner}/${n.ref.repo}`,suggestionLines:s,onCancel:c,actions:[{label:`Commenter seul`,disabled:l!==null,run:e=>u(e,`single`)},{label:l?`Ajouter à la review`:`Démarrer une review`,run:e=>u(e,`review`)}]})]})})}function iL(e){let t=SF(),n=(0,C.useRef)(null),r=(0,C.useRef)({fileIdx:null,hunkIdx:null}),i=t.range.head===t.detail.pr.headRefOid,a=(0,C.useMemo)(()=>VI({files:e.files,layout:t.layout,threads:t.detail.threads,anchorable:e=>i&&(e===`RIGHT`||t.range.fullPr),collapsed:e.collapsed,composer:t.selection,fileComposer:t.fileComposer,onlyFile:e.onlyFile}),[e.files,t.layout,t.detail.threads,i,t.range.fullPr,e.collapsed,t.selection,t.fileComposer,e.onlyFile]),o=(0,C.useMemo)(()=>e.files.map(GI),[e.files]),s=a.rows,c=fI({count:s.length,getScrollElement:()=>n.current,estimateSize:e=>KI[s[e].kind],getItemKey:e=>s[e].key,overscan:30,onChange:t=>{let n=t.getVirtualItemForOffset((t.scrollOffset??0)+4),i=n?s[n.index]:void 0,o=null;if(n)for(let e=a.hunkRows.length-1;e>=0;e--){let t=a.hunkRows[e];if(t.row<=n.index&&t.fileIdx===i?.fileIdx){o=t.hunkIdx;break}}let c=i?.fileIdx??null;(c!==r.current.fileIdx||o!==r.current.hunkIdx)&&(r.current={fileIdx:c,hunkIdx:o},e.onCurrentChange(c,o))}}),l=e.onCurrentChange;(0,C.useImperativeHandle)(e.handleRef,()=>{let n=()=>c.getVirtualItemForOffset((c.scrollOffset??0)+4)?.index??0,i=e=>{e!==void 0&&c.scrollToIndex(e,{align:`start`})};return{scrollToFile:t=>{let n=e.files.findIndex(e=>e.path===t);i(a.fileRow[n]),n!==-1&&n!==r.current.fileIdx&&(r.current={fileIdx:n,hunkIdx:null},l(n,null))},scrollToThread:e=>{let t=a.threadRow.get(e);return t!==void 0&&(c.scrollToIndex(t,{align:`center`}),!0)},step:(e,r)=>{let o=n(),c;if(e===`file`)c=a.fileRow.filter(e=>e!==void 0);else if(e===`hunk`)c=a.hunkRows.map(e=>e.row);else{let e=new Set(t.detail.threads.filter(e=>!e.isResolved).map(e=>e.id));c=[...new Set([...a.threadRow].filter(([t])=>e.has(t)).map(([,e])=>e))].sort((e,t)=>e-t)}let l=r>0?c.find(e=>e>o):c.filter(e=>e<o).at(-1);if(i(l),e===`thread`&&l!==void 0){let e=s[l],n=e&&(e.kind===`threads`||e.kind===`orphans`)?e.threadIds.find(e=>!t.detail.threads.find(t=>t.id===e)?.isResolved):void 0;n&&t.setFocusedThread(n)}},current:()=>r.current}},[c,a,e.files,s,t,l]);let u=c.getVirtualItems(),d=c.getVirtualItemForOffset((c.scrollOffset??0)+4),f=d?s[d.index]:void 0,p=f&&f.kind!==`file`&&f.fileIdx!==null?e.files[f.fileIdx]:void 0,m=(0,C.useMemo)(()=>new Map(t.detail.threads.map(e=>[e.id,e])),[t.detail.threads]),h=(n,i)=>{let a=s[i+1],c=!a||a.kind===`file`,l=n.fileIdx===null?void 0:e.files[n.fileIdx];switch(n.kind){case`file`:return(0,W.jsx)(QI,{file:l,collapsed:e.collapsed.has(l.path),onToggleCollapse:()=>e.onToggleCollapse(l.path)});case`hunk`:return(0,W.jsx)(nL,{file:l,hunk:l.hunks[n.hunkIdx],current:r.current.fileIdx===n.fileIdx&&r.current.hunkIdx===n.hunkIdx});case`split`:case`line`:{let e=l.hunks[n.hunkIdx];return(0,W.jsx)(tL,{row:n,file:l,sources:o[n.fileIdx],viewed:t.seenHunks.has(`${l.path}\n${e.hash}`),last:c})}case`threads`:return(0,W.jsx)(`div`,{className:`diff-block${c?` last`:``}`,children:n.threadIds.map(e=>{let t=m.get(e);return t?(0,W.jsx)(WI,{thread:t},e):null})});case`composer`:return(0,W.jsx)(rL,{file:l,target:n.target});case`notice`:return(0,W.jsx)(`div`,{className:`diff-block${c?` last`:``}`,children:(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:n.text})});case`orphans`:return(0,W.jsxs)(`div`,{className:`diff-block${c?` last`:``}`,style:n.fileIdx===null?{marginTop:16,borderTop:`1px solid var(--br-border)`}:void 0,children:[(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,tt:`uppercase`,fw:600,mb:4,children:n.title}),n.threadIds.map(e=>{let t=m.get(e);return t?(0,W.jsx)(WI,{thread:t,showPath:n.fileIdx===null},e):null})]})}};return s.length===0?(0,W.jsx)(`div`,{className:`diff-scroll`,ref:n,children:(0,W.jsx)(Z,{c:`dimmed`,p:`lg`,children:`Aucun changement dans cette plage.`})}):(0,W.jsxs)(`div`,{className:`diff-scroll`,ref:n,children:[p&&(0,W.jsx)(`div`,{className:`sticky-file`,children:(0,W.jsx)(QI,{file:p,collapsed:e.collapsed.has(p.path),onToggleCollapse:()=>e.onToggleCollapse(p.path)})}),(0,W.jsx)(`div`,{className:`diff-inner`,style:{height:c.getTotalSize()+80},children:u.map(e=>(0,W.jsx)(`div`,{"data-index":e.index,ref:c.measureElement,className:`diff-row`,style:{transform:`translateY(${e.start}px)`},children:h(s[e.index],e.index)},e.key))}),(0,W.jsx)(ql,{className:`diff-end`,justify:`center`,p:`md`,children:(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[(0,W.jsx)(Bp,{size:`xs`,children:`j`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`k`}),` fichier · `,(0,W.jsx)(Bp,{size:`xs`,children:`n`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`p`}),` hunk · `,(0,W.jsx)(Bp,{size:`xs`,children:`]`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`[`}),` thread ouvert`]})})]})}var aL=e=>e.additions+e.deletions;function oL(e){let t=aL(e),n=t===0?.5:e.additions/t;return`hsl(${Math.round(n*130)} 45% 30%)`}function sL(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],additions:0,deletions:0,fileCount:0,viewedCount:0,openThreads:0}}function cL(e,t){let n=sL(``,``);for(let t of e){let e=t.path.split(`/`),r=n;for(let t of e.slice(0,-1)){let e=r.path?`${r.path}/${t}`:t,n=r.dirs.find(t=>t.path===e);n||(n=sL(t,e),r.dirs.push(n)),r=n}r.files.push({kind:`file`,name:e.at(-1),path:t.path,stat:t})}let r=(e,n)=>{let i=e;for(;!n&&i.files.length===0&&i.dirs.length===1;){let e=i.dirs[0];i={...e,name:`${i.name}/${e.name}`}}i.dirs=i.dirs.map(e=>r(e,!1)),i.additions=i.deletions=i.fileCount=i.viewedCount=i.openThreads=0;for(let e of i.dirs)i.additions+=e.additions,i.deletions+=e.deletions,i.fileCount+=e.fileCount,i.viewedCount+=e.viewedCount,i.openThreads+=e.openThreads;for(let e of i.files)i.additions+=e.stat.additions,i.deletions+=e.stat.deletions,i.fileCount+=1,i.viewedCount+=+(e.stat.state===`viewed`),i.openThreads+=e.stat.openThreads;if(t){let e=(e,t)=>e.name.localeCompare(t.name),n=(t,n)=>aL(n.kind===`dir`?n:n.stat)-aL(t.kind===`dir`?t:t.stat)||e(t,n);i.dirs.sort(t===`churn`?n:e),i.files.sort(t===`churn`?n:e)}return i};return r(n,!0)}function lL(e,t){let n=[],r=(e,i)=>{for(let a of e.dirs)n.push({...a,depth:i}),t.has(a.path)||r(a,i+1);for(let t of e.files)n.push({...t,depth:i})};return r(e,0),n}function uL(e,t,n){return t===`list`?n===`name`?e.map(e=>e.path):[...e].sort((e,t)=>aL(t)-aL(e)||e.path.localeCompare(t.path)).map(e=>e.path):lL(cL(e.map(e=>({...e,state:`none`,openThreads:0,unreadThreads:0})),n),new Set).flatMap(e=>e.kind===`file`?[e.path]:[])}var dL=Object.defineProperty,fL=(e,t,n)=>t in e?dL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pL=(e,t)=>{for(var n in t)dL(e,n,{get:t[n],enumerable:!0})},mL=(e,t,n)=>fL(e,typeof t==`symbol`?t:t+``,n),hL={};pL(hL,{Graph:()=>eR,alg:()=>OL});var gL=Object.defineProperty,_L=(e,t)=>{for(var n in t)gL(e,n,{get:t[n],enumerable:!0})},vL=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=xL(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=SL(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,yL(this._preds[a],i),yL(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?CL(this._isDirected,e):xL(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?CL(this._isDirected,e):xL(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?CL(this._isDirected,e):xL(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],bL(this._preds[t],e),bL(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function yL(e,t){e[t]?e[t]++:e[t]=1}function bL(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function xL(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function SL(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function CL(e,t){return xL(e,t.v,t.w,t.name)}_L({},{read:()=>DL,write:()=>wL});function wL(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:TL(e),edges:EL(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function TL(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function EL(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function DL(e){let t=new vL(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var OL={};_L(OL,{CycleException:()=>UL,bellmanFord:()=>AL,components:()=>ML,dijkstra:()=>FL,dijkstraAll:()=>LL,findCycles:()=>zL,floydWarshall:()=>VL,isAcyclic:()=>GL,postorder:()=>YL,preorder:()=>XL,prim:()=>ZL,shortestPaths:()=>QL,tarjan:()=>RL,topsort:()=>WL});var kL=()=>1;function AL(e,t,n,r){return jL(e,String(t),n||kL,r||function(t){return e.outEdges(t)??[]})}function jL(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+o<r.distance&&(i[e.w]={distance:t.distance+o,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function ML(e){let t={},n=[],r;function i(n){var a,o;n in t||(t[n]=!0,r.push(n),(a=e.successors(n))==null||a.forEach(i),(o=e.predecessors(n))==null||o.forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var NL=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},PL=()=>1;function FL(e,t,n,r){return IL(e,String(t),n||PL,r||function(t){return e.outEdges(t)??[]})}function IL(e,t,n,r){let i={},a=new NL,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function LL(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=FL(e,i,t,n),r},{})}function RL(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function zL(e){return RL(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var BL=()=>1;function VL(e,t,n){return HL(e,t||BL,n||function(t){return e.outEdges(t)??[]})}function HL(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e<o.distance&&(o.distance=e,o.predecessor=i.predecessor)}})})}),r}var UL=class extends Error{constructor(e){super(e),this.name=`CycleException`}};function WL(e){let t={},n={},r=[];function i(a){var o;if(a in n)throw new UL;a in t||(n[a]=!0,t[a]=!0,(o=e.predecessors(a))==null||o.forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new UL;return r}function GL(e){try{WL(e)}catch(e){if(e instanceof UL)return!1;throw e}return!0}function KL(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=qL(e,t,n===`post`,o,a,r,i)}),i}function qL(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=qL(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function JL(e,t,n){return KL(e,t,n,function(e,t){return e.push(t),e},[])}function YL(e,t){return JL(e,t,`post`)}function XL(e,t){return JL(e,t,`pre`)}function ZL(e,t){var n;let r=new vL,i={},a=new NL,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s<r&&(i[n]=o,a.decrease(n,s))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(e){a.add(e,1/0),r.setNode(e)});let c=e.nodes()[0];c!==void 0&&a.decrease(c,0);let l=!1;for(;a.size()>0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function QL(e,t,n,r){return $L(e,t,n,r??(t=>e.outEdges(t)??[]))}function $L(e,t,n,r){if(n===void 0)return FL(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=a[o];if(s===void 0)continue;let c=r(s);for(let e=0;e<c.length;e++){let t=c[e];if(!t)continue;let r=t.v===s?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return AL(e,t,n,r)}return FL(e,t,n,r)}var eR=vL;function tR(e,t,n,r){let i=r;for(;e.hasNode(i);)i=_R(r);return n.dummy=t,e.setNode(i,n),i}function nR(e){let t=new eR().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function rR(e){let t=new eR({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function iR(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function aR(e){let t=vR(fR(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function oR(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=dR(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function sR(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=dR(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function cR(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),tR(e,`border`,i,t)}function lR(e,t=uR){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var uR=65535;function dR(e,t){return t.length>uR?e(...lR(t).map(t=>e(...t))):e(...t)}function fR(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return dR(Math.max,t)}function pR(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function mR(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function hR(e,t){return t()}var gR=0;function _R(e){return e+(``+ ++gR)}function vR(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function yR(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function bR(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function xR(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var SR=`\0`;function CR(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var wR=`3.1.1`,TR=class{constructor(){mL(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return ER(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&ER(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,DR)),n=n._prev;return`[`+e.join(`, `)+`]`}};function ER(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function DR(e,t){if(e!==`_next`&&e!==`_prev`)return t}var OR=TR,kR=()=>1;function AR(e,t){if(e.nodeCount()<=1)return[];let n=NR(e,t||kR);return jR(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function jR(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)MR(e,t,n,o);for(;o=i.dequeue();)MR(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(MR(e,t,n,o,!0)||[]);break}}}return r}function MR(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,PR(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,PR(t,n,o)}),e.removeNode(r.v),o}function NR(e,t){let n=new eR,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=FR(i+r+3).map(()=>new OR),o=r+1;return n.nodes().forEach(e=>{PR(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function PR(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function FR(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function IR(e,t){(e.graph().acyclicer===`greedy`?AR(e,n(e)):LR(e,t??null)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,_R(`rev`))});function n(e){return t=>e.edge(t).weight}}function LR(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&zR(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function RR(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function zR(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function BR(e){e.graph().dummyChains=[],e.edges().forEach(t=>VR(e,t))}function VR(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=tR(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function HR(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function UR(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=dR(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function WR(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var GR=KR;function KR(e){let t=new eR({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;qR(t,e)<i&&(a=JR(t,e),a);)o=t.hasNode(a.v)?WR(e,a):-WR(e,a),YR(t,e,o);return t}function qR(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!WR(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function JR(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=WR(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function YR(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:XR,postorder:ZR}=OL,QR=$R;$R.initLowLimValues=rz,$R.initCutValues=ez,$R.calcCutValue=nz,$R.leaveEdge=az,$R.enterEdge=oz,$R.exchangeEdges=sz;function $R(e){e=nR(e),UR(e);let t=GR(e);rz(t),ez(t,e);let n,r;for(;n=az(t);)r=oz(t,e,n),sz(t,e,n,r)}function ez(e,t){let n=ZR(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>tz(e,t,n))}function tz(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=nz(e,t,n)}function nz(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,lz(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function rz(e,t){arguments.length<2&&(t=e.nodes()[0]),iz(e,{},1,t)}function iz(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=iz(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function az(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function oz(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===uz(e,e.node(t.v),s)&&c!==uz(e,e.node(t.w),s)).reduce((e,n)=>WR(t,n)<WR(t,e)?n:e)}function sz(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),rz(e),ez(e,t),cz(e,t)}function cz(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=XR(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function lz(e,t,n){return e.hasEdge(t,n)}function uz(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var dz=fz;function fz(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:hz(e);break;case`tight-tree`:mz(e);break;case`longest-path`:pz(e);break;case`none`:break;default:hz(e)}}var pz=UR;function mz(e){UR(e),GR(e)}function hz(e){QR(e)}var gz=_z;function _z(e){let t=yz(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=vz(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function vz(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function yz(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(SR).forEach(r),t}function bz(e){let t=tR(e,`root`,{},`_root`),n=Sz(e),r=Object.values(n),i=dR(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=Cz(e)+1;e.children(SR).forEach(r=>{xz(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function xz(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=cR(e,`_bt`),l=cR(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{xz(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function Sz(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(SR).forEach(e=>n(e,1)),t}function Cz(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function wz(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var Tz=Ez;function Ez(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)Dz(e,`borderLeft`,`_bl`,n,i,t),Dz(e,`borderRight`,`_br`,n,i,t)}}e.children(SR).forEach(t)}function Dz(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=tR(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Oz(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&Az(e)}function kz(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&Mz(e),(t===`lr`||t===`rl`)&&(Pz(e),Az(e))}function Az(e){e.nodes().forEach(t=>jz(e.node(t))),e.edges().forEach(t=>jz(e.edge(t)))}function jz(e){let t=e.width;e.width=e.height,e.height=t}function Mz(e){e.nodes().forEach(t=>Nz(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Nz),Object.hasOwn(r,`y`)&&Nz(r)})}function Nz(e){e.y=-e.y}function Pz(e){e.nodes().forEach(t=>Fz(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Fz),Object.hasOwn(r,`x`)&&Fz(r)})}function Fz(e){let t=e.x;e.x=e.y,e.y=t}function Iz(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=vR(dR(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return CR(t,e.node(n),e.node(r))}return a}function Lz(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Rz(e,t[r-1],t[r]);return n}function Rz(e,t,n){let r=xR(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function zz(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Bz(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Vz(Object.values(n).filter(e=>!e.indegree))}function Vz(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Hz(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>yR(e,[`vs`,`i`,`barycenter`,`weight`]))}function Hz(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Uz(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=pR(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(Gz(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=Wz(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=Wz(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function Wz(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Gz(e,t,n){return(r,i)=>{if(r.barycenter<i.barycenter)return-1;if(r.barycenter>i.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=CR(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function Kz(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=zz(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=Kz(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&Jz(t,r)}});let h=Bz(m,n);qz(h,p);let g={},_=!1;for(let t=0;t<h.length;t++)for(let n=t+1;n<h.length;n++)if(h[t]&&h[n]&&(a=h[t])!=null&&a.barycenter&&(o=h[n])!=null&&o.barycenter&&h[t]?.barycenter===h[n].barycenter){let r=h[t]?.vs[0]??``,i=h[n]?.vs[0]??``,a=e.node(r),o=e.node(i);if(a.dummy===`edge`&&o.dummy===`edge`&&a.edgeObj?.v===o.edgeObj?.v&&a.edgeObj?.w===o.edgeObj?.w){if(a.edgeLabel.reversed){g[i]=h[t],h.splice(t,1),t--;break}g[r]=h[n],h.splice(n,1),n--}else _=!0}let v=Uz(h,g,s,e,c);if(d&&f){v.vs=[d,v.vs,f].flat(1);let t=e.predecessors(d);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(f),i=e.node(r[0]);Object.hasOwn(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+n.order+i.order)/(v.weight+2),v.weight+=2}}return Object.defineProperty(v,"result",{value:v,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(v,"usedBias",{value:_,enumerable:!1,configurable:!0,writable:!0}),v}function qz(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function Jz(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Yz(e,t,n,r){r||=e.nodes();let i=Xz(e),a=new eR({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Xz(e){let t;for(;e.hasNode(t=_R(`_root`)););return t}function Zz(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function Qz(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,Qz);return}let r=fR(e),i=$z(e,vR(1,r+1),`inEdges`),a=$z(e,vR(r-1,-1,-1),`outEdges`),o=Iz(e,n);if(tB(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){eB(t%2?i:a,t%4>=2,l,n),o=aR(e);let u=Lz(e,o);u<s?(r=0,c=Object.assign({},o),s=u):u===s&&(c=structuredClone(o))}tB(e,c)}function $z(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return Yz(e,t,n,r.get(t)||[])})}function eB(e,t,n,r){let i=!0,a=new eR;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=Kz(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),Zz(e,a,s.vs)})}function tB(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function nB(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=iB(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&aB(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function rB(e,t){let n={};function r(t,r,i,a,o){vR(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&aB(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function iB(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function aB(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function oB(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function sB(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||gB(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>gB(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c<d&&s[i]!==l&&!oB(n,t,i)){let e=a[i];e!==void 0&&(o[i]=t,o[t]=a[t]=e,c=d,u&&=(c=-1,l=s[i]??-1,!1))}}}})}),{root:a,align:o}}function cB(e,t,n,r,i=!1){let a={},o=lB(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function lB(e,t,n,r){let i=new eR,a=e.graph(),o=mB(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function uB(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=hB(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function dB(e,t){let n=Object.values(t),r=dR(Math.min,n),i=dR(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-dR(Math.min,c);a!==`l`&&(l=i-dR(Math.max,c)),l&&(e[o]=bR(s,e=>e+l))})})}function fB(e,t=void 0){let n=e.ul;return n?bR(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function pB(e,t){let n=aR(e),r=Object.assign(nB(e,n),rB(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=sB(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=cB(e,a,s.root,s.align,n===`r`);n===`r`&&(c=bR(c,e=>-e)),i[o+n]=c})}),dB(i,uB(e,i)),fB(i,e.graph().align)}function mB(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function hB(e,t){return e.node(t).width}function gB(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function _B(e,t){e=rR(e),vB(e),Object.entries(pB(e,t)).forEach(([t,n])=>e.node(t).x=n)}function vB(e){let t=aR(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var yB=new WeakMap;function bB(e,t={}){return SB(e,hR,t),e}function xB(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function SB(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new eR({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=xB(e,t.v,r),i=xB(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),SB(o,t,n);let l=NB(o);CB(l,t,n,null),wB(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=NB(e),g=CB(h,t,n,yB.get(e)??null);yB.set(e,g),wB(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function CB(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>PB(e)),t(` removeSelfEdges`,()=>UB(e)),t(` acyclic`,()=>IR(e,s)),t(` nestingGraph.run`,()=>bz(e)),t(` rank`,()=>dz(rR(e))),t(` injectEdgeLabelProxies`,()=>FB(e)),t(` removeEmptyRanks`,()=>sR(e)),t(` nestingGraph.cleanup`,()=>wz(e)),t(` normalizeRanks`,()=>oR(e)),t(` assignRankMinMax`,()=>IB(e)),t(` removeEdgeLabelProxies`,()=>LB(e)),t(` normalize.run`,()=>BR(e)),t(` parentDummyChains`,()=>gz(e)),t(` addBorderSegments`,()=>Tz(e)),t(` order`,()=>Qz(e,n,c)),t(` insertSelfEdges`,()=>WB(e)),t(` adjustCoordinateSystem`,()=>Oz(e)),t(` position`,()=>_B(e,n.corePath)),t(` positionSelfEdges`,()=>GB(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>HB(e)),t(` normalize.undo`,()=>HR(e)),t(` fixupEdgeLabelCoords`,()=>BB(e)),t(` undoCoordinateSystem`,()=>kz(e)),t(` translateGraph`,()=>RB(e)),t(` assignNodeIntersects`,()=>zB(e)),t(` reversePoints`,()=>VB(e)),t(` acyclic.undo`,()=>RR(e)),{graph:e,rawNodes:l}}function wB(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var TB=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],EB={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},DB=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],OB=[`width`,`height`,`rank`],kB={width:0,height:0},AB=[`minlen`,`weight`,`width`,`height`,`labeloffset`],jB={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},MB=[`labelpos`];function NB(e){let t=new eR({multigraph:!0,compound:!0}),n=qB(e.graph());return t.setGraph(Object.assign({},EB,KB(n,TB),yR(n,DB))),e.nodes().forEach(n=>{let r=KB(qB(e.node(n)),OB);Object.keys(kB).forEach(e=>{r[e]===void 0&&(r[e]=kB[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=qB(e.edge(n));t.setEdge(n,Object.assign({},jB,KB(r,AB),yR(r,MB)))}),t}function PB(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function FB(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);tR(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function IB(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function LB(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function RB(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function zB(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(iR(r,a)),n.points.push(iR(i,o))})}function BB(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function VB(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function HB(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function UB(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function WB(e){aR(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{tR(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function GB(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function KB(e,t){return bR(yR(e,t),Number)}function qB(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function JB(e){let t=aR(e),n=new eR({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var YB={graphlib:hL,version:wR,layout:bB,debug:JB,util:{time:mR,notime:hR}},XB=7.2;function ZB(e){let t=e.split(`/`).at(-1)??e,n=e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``;return Math.min(300,Math.max(110,Math.max(t.length,Math.min(n.length,36)*.85)*XB+28))}function QB(e,t,n=[],r=null){let i=new YB.graphlib.Graph({multigraph:!0,compound:!0});i.setGraph({rankdir:`LR`,nodesep:n.length>0?44:16,ranksep:90,edgesep:10,marginx:24,marginy:24+(n.length>0?18:0)}),i.setDefaultEdgeLabel(()=>({}));for(let t of e)i.setNode(t,{width:ZB(t),height:38});let a=new Set(e),o=[];for(let e of n){let t=e.members.filter(e=>a.has(e));if(t.length===0)continue;let n=`cluster:${e.id}`;i.setNode(n,{width:0,height:0});for(let e of t)i.setParent(e,n);o.push({id:e.id,label:e.label,key:n})}let s=new Map(o.map(e=>[e.id,e.key])),c=e=>`package:${e}`;for(let e of r?.packages??[]){i.setNode(c(e.id),{width:Math.max(110,e.label.length*XB+32),height:26});let t=s.get(e.id);t&&i.setParent(c(e.id),t)}let l=(r?.edges??[]).filter(e=>i.hasNode(c(e.from))&&i.hasNode(c(e.to)));l.forEach((e,t)=>i.setEdge(c(e.to),c(e.from),{},`pkg:${t}`)),t.forEach((e,t)=>i.setEdge(e.to,e.from,{},`${e.kind}:${t}`)),YB.layout(i);let u=e=>{let t=i.node(e);return{x:(t.x??0)-t.width/2,y:(t.y??0)-t.height/2,width:t.width,height:t.height}},d=e.map(e=>({path:e,...u(e)})),f=o.map(({id:e,label:t,key:n})=>({id:e,label:t,...u(n)})),p=t.map((e,t)=>({edge:e,points:i.edge({v:e.to,w:e.from,name:`${e.kind}:${t}`}).points??[]})),m=new Set((r?.packages??[]).filter(e=>e.touched).map(e=>e.id)),h=(r?.packages??[]).map(e=>({...e,...u(c(e.id))})),g=l.map((e,t)=>({from:e.from,to:e.to,touched:m.has(e.from)&&m.has(e.to),points:i.edge({v:c(e.to),w:c(e.from),name:`pkg:${t}`}).points??[]})),_=i.graph();return{nodes:d,edges:p,clusters:f,packageNodes:h,packageEdges:g,width:_.width??0,height:_.height??0}}var $B=6,eV=34;function tV(e,t,n,r){let i=new Map;for(let r of e){let e=n===`from`?r.from:r.to;(n===`from`?r.to:r.from)===t&&e!==t&&i.set(e,[...i.get(e)??[],r])}let a=e=>+!e.some(e=>e.kind===`import`);return[...i].sort(([e,t],[n,i])=>r(e)-r(n)||a(t)-a(i)||e.localeCompare(n))}function nV(e,t,n,r=()=>0){let i=tV(t,e,`from`,r),a=tV(t,e,`to`,r),o=Math.max(1,i.length,a.length),s=Math.max(38,o*26+(o-1)*$B),c=Math.min(Math.max(100,n*.3),200),l=+(i.length>0)+ +(a.length>0),u=l===0?0:Math.max(60,(n-c-l*eV)/l),d=(e,t)=>{let n=e.length*26+Math.max(0,e.length-1)*$B,r=(s-n)/2;return e.map(([e,n],i)=>({path:e,x:t,y:r+i*32,width:u,height:26,edges:n}))},f=a.length>0?u+eV:l===0?(n-c)/2:0;return{center:{path:e,x:f,y:(s-38)/2,width:c,height:38},outgoing:d(a,0),incoming:d(i,f+c+eV),width:n,height:s}}var rV={typescript:`TS`,javascript:`JS`,python:`Py`,css:`CSS`,go:`Go`,java:`Java`,kotlin:`Kt`,c:`C`,cpp:`C++`,rust:`Rust`,ruby:`Rb`,vue:`Vue`,svelte:`Svelte`,markdown:`MD`},iV=e=>e.split(`/`).at(-1)??e,aV=e=>e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``;function oV(e){if(e.length===0)return``;let t=`M${e[0].x},${e[0].y}`;for(let n=0;n<e.length-1;n++){let r=e[n-1]??e[n],i=e[n],a=e[n+1],o=e[n+2]??a,s={x:i.x+(a.x-r.x)/6,y:i.y+(a.y-r.y)/6},c={x:a.x-(o.x-i.x)/6,y:a.y-(o.y-i.y)/6};t+=` C${s.x},${s.y} ${c.x},${c.y} ${a.x},${a.y}`}return t}function sV(e,t){let n=Math.max(3,Math.floor((t-14)/7.7));return e.length>n?`${e.slice(0,n-1)}…`:e}function cV(e,t,n,r){let i=(n-e)/2;return`M${e},${t} C${e+i},${t} ${n-i},${r} ${n},${r}`}var lV=`package:`;function uV(e){let{ref:t,width:n}=$e(),r=(0,C.useMemo)(()=>new Map(e.stats.map(e=>[e.path,e])),[e.stats]),i=e.packages,a=(0,C.useMemo)(()=>new Map(i?.context.packages.map(e=>[e.id,e])??[]),[i]),o=e.center,s=(0,C.useMemo)(()=>{if(!o||!i)return e.edges;let t=i.rootOf.get(o),n=new Set(e.edges.filter(e=>e.from===o).map(e=>i.rootOf.get(e.to))),r=new Set(e.edges.filter(e=>e.to===o).map(e=>i.rootOf.get(e.from))),a=[];for(let e of i.imports[o]??[])e!==t&&!n.has(e)&&a.push({from:o,to:lV+e,kind:`import`,detail:[]});if(t!==void 0)for(let e of i.context.edges)e.to===t&&e.from!==t&&!r.has(e.from)&&a.push({from:lV+e.from,to:o,kind:`import`,detail:[]});return[...e.edges,...a]},[o,i,e.edges]),c=o&&n>0?nV(o,s,n,e=>+!!e.startsWith(lV)):null,l=c?r.get(c.center.path):void 0,u=o&&i?a.get(i.rootOf.get(o)??``)?.label:void 0,d=(t,n)=>{let r=t.path.slice(8),s=a.get(r),c=i?.firstFile.get(r),l=s?.touched===!0&&c!==void 0,d=s?.label??(r||`(racine)`),f=n===`out`?`${iV(o??``)} importe le package ${d}`:`le package ${d} utilise ${u??`ce package`}`;return(0,W.jsxs)(`g`,{className:`link-pkg`,"data-touched":s?.touched||void 0,transform:`translate(${t.x} ${t.y})`,style:{cursor:l?`pointer`:`default`},onClick:()=>l&&e.onSelect(c),children:[(0,W.jsx)(`rect`,{width:t.width,height:t.height,rx:t.height/2}),(0,W.jsx)(`text`,{x:t.width/2,y:17,textAnchor:`middle`,children:sV(d,t.width+6)}),(0,W.jsx)(`title`,{children:`${f}${s?.touched?l?` · clic : ouvrir ses fichiers`:``:` · aucun fichier modifié`}`})]},`${n}:${t.path}`)},f=(t,n)=>{let s=r.get(t.path),c=t.edges.every(e=>e.kind===`mention`),l=n===`in`?c?`mentionne`:`importe`:c?`mentionné par`:`importé par`,d=[...new Set(t.edges.flatMap(e=>e.detail))].join(`, `),f=i?a.get(i.rootOf.get(t.path)??``)?.label:void 0;return(0,W.jsxs)(`g`,{className:`link-node`,"data-state":s?.state,transform:`translate(${t.x} ${t.y})`,onClick:()=>e.onSelect(t.path),children:[(0,W.jsx)(`rect`,{width:t.width,height:t.height,rx:5,fill:s?oL(s):`var(--br-surface)`}),(0,W.jsxs)(`text`,{x:7,y:17,className:`link-name`,children:[s?.state===`viewed`?`✓ `:``,sV(iV(t.path),t.width-(s?.state===`viewed`?14:0)),f&&f!==u&&(0,W.jsx)(`tspan`,{dx:6,className:`link-pkg-tag`,children:sV(f,t.width-(iV(t.path).length+2)*7.7)})]}),(0,W.jsx)(`title`,{children:`${t.path}${f?` (${f})`:``}\n${l} ${iV(o??``)}${d?` : ${d}`:``}`})]},`${n}:${t.path}`)},p=(e,t,n)=>{let r=t===`out`?cV(e.x+e.width,e.y+e.height/2,n.x,n.y+n.height/2):cV(n.x+n.width,n.y+n.height/2,e.x,e.y+e.height/2);if(e.path.startsWith(lV)){let n=a.get(e.path.slice(8))?.touched===!0;return(0,W.jsx)(`path`,{d:r,className:`link-pkg-edge`,"data-touched":n||void 0,markerEnd:n?`url(#ego-arrow-pkg)`:`url(#ego-arrow)`},`e:${t}:${e.path}`)}return(0,W.jsx)(`path`,{d:r,className:`link-edge`,"data-kind":e.edges.every(e=>e.kind===`mention`)?`mention`:`import`,markerEnd:`url(#ego-arrow)`},`e:${t}:${e.path}`)},m=(e,t)=>e.path.startsWith(lV)?d(e,t):f(e,t);return(0,W.jsxs)(`div`,{className:`ego`,ref:t,children:[(0,W.jsxs)(ql,{gap:6,py:4,wrap:`nowrap`,children:[(0,W.jsxs)(Z,{size:`xs`,fw:600,truncate:!0,style:{flex:1},children:[o?iV(o):``,u&&(0,W.jsx)(Z,{span:!0,size:`xs`,c:`violet.3`,fw:500,ml:6,children:u})]}),c&&(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`utilise `,c.outgoing.length,` · utilisé par `,c.incoming.length]})]}),!o&&(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,pb:8,children:`Ouvrez un fichier pour voir ce qui l’utilise et ce qu’il utilise.`}),c&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(ql,{justify:`space-between`,mb:2,children:[(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`ce qu’il utilise`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`ce qui l’utilise →`})]}),c.incoming.length+c.outgoing.length===0?(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[`Aucun lien avec les autres fichiers`,i?` ou packages`:``,` de la PR.`]}):(0,W.jsxs)(`svg`,{width:`100%`,viewBox:`0 0 ${c.width} ${c.height}`,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`marker`,{id:`ego-arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-gray-5)`})}),(0,W.jsx)(`marker`,{id:`ego-arrow-pkg`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-violet-4)`})})]}),c.incoming.map(e=>p(e,`in`,c.center)),c.outgoing.map(e=>p(e,`out`,c.center)),c.incoming.map(e=>m(e,`in`)),c.outgoing.map(e=>m(e,`out`)),(0,W.jsxs)(`g`,{className:`link-node`,"data-current":!0,"data-state":l?.state,transform:`translate(${c.center.x} ${c.center.y})`,children:[(0,W.jsx)(`rect`,{width:c.center.width,height:38,rx:6,fill:l?oL(l):`var(--br-surface)`}),(0,W.jsx)(`text`,{x:9,y:16,className:`link-name`,children:sV(iV(c.center.path),c.center.width)}),(0,W.jsx)(`text`,{x:9,y:30,className:`link-dir`,children:sV(aV(c.center.path)||`/`,c.center.width+10)}),(0,W.jsx)(`title`,{children:`${c.center.path}${u?` (${u})`:``}`})]})]})]})]})}function dV(e){let{ref:t,width:n,height:r}=$e(),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),c=(0,C.useRef)(null),l=(0,C.useMemo)(()=>new Map(e.stats.map(e=>[e.path,e])),[e.stats]),u=(0,C.useMemo)(()=>QB(e.stats.map(e=>e.path),e.edges,e.groups,e.context),[e.stats,e.edges,e.groups,e.context]),d=n>0&&u.width>0?Math.min(1.4,n/u.width,r/u.height):1,f=o??{k:d,x:(n-u.width*d)/2,y:(r-u.height*d)/2},p=new Map(u.packageNodes.map(e=>[e.id,e.label])),m=t=>i===null||t===i||e.edges.some(e=>e.from===i&&e.to===t||e.to===i&&e.from===t);return(0,W.jsxs)(`div`,{ref:t,className:`link-graph`,onWheel:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=Math.min(4,Math.max(.15,f.k*(e.deltaY<0?1.15:1/1.15)));s({k:i,x:n-(n-f.x)*i/f.k,y:r-(r-f.y)*i/f.k})},onMouseDown:e=>c.current={x:e.clientX-f.x,y:e.clientY-f.y},onMouseMove:e=>c.current&&s({k:f.k,x:e.clientX-c.current.x,y:e.clientY-c.current.y}),onMouseUp:()=>c.current=null,onMouseLeave:()=>c.current=null,children:[(0,W.jsxs)(`svg`,{width:n,height:r,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`marker`,{id:`arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-gray-5)`})}),(0,W.jsx)(`marker`,{id:`arrow-hl`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-blue-4)`})}),(0,W.jsx)(`marker`,{id:`arrow-pkg`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-violet-4)`})})]}),(0,W.jsxs)(`g`,{transform:`translate(${f.x} ${f.y}) scale(${f.k})`,children:[u.clusters.map(e=>(0,W.jsxs)(`g`,{className:`link-cluster`,transform:`translate(${e.x} ${e.y})`,children:[(0,W.jsx)(`rect`,{width:e.width,height:e.height,rx:10}),u.packageNodes.length===0&&(0,W.jsx)(`text`,{x:6,y:-6,children:e.label})]},e.id)),u.packageEdges.map(e=>{let t=i===`package:${e.from}`||i===`package:${e.to}`;return(0,W.jsx)(`path`,{d:oV(e.points),className:`link-pkg-edge`,"data-touched":e.touched||void 0,"data-active":t||void 0,markerEnd:e.touched?`url(#arrow-pkg)`:`url(#arrow)`,children:(0,W.jsx)(`title`,{children:`${p.get(e.from)??e.from} utilise ${p.get(e.to)??e.to}`})},`pkg:${e.from}:${e.to}`)}),u.packageNodes.map(e=>(0,W.jsxs)(`g`,{className:`link-pkg`,"data-touched":e.touched||void 0,transform:`translate(${e.x} ${e.y})`,onMouseEnter:()=>a(`package:${e.id}`),onMouseLeave:()=>a(null),children:[(0,W.jsx)(`rect`,{width:e.width,height:e.height,rx:e.height/2}),(0,W.jsx)(`text`,{x:e.width/2,y:17,textAnchor:`middle`,children:e.label}),(0,W.jsx)(`title`,{children:`${e.label} — ${e.id||`(racine)`}${e.touched?``:` · aucun fichier modifié`}`})]},`package:${e.id}`)),u.edges.map(({edge:e,points:t},n)=>{let r=i!==null&&(e.from===i||e.to===i),a=oV(t);return(0,W.jsx)(`path`,{d:a,className:`link-edge`,"data-kind":e.kind,"data-active":r||void 0,"data-dim":i!==null&&!r||void 0,markerEnd:r?`url(#arrow-hl)`:`url(#arrow)`,children:(0,W.jsxs)(`title`,{children:[e.from,` `,e.kind===`import`?`importe`:`mentionne`,` `,e.to,e.detail.length?` : ${e.detail.join(`, `)}`:``]})},n)}),u.nodes.map(t=>{let n=l.get(t.path);return(0,W.jsxs)(`g`,{className:`link-node`,"data-state":n?.state,"data-current":t.path===e.currentPath||void 0,"data-dim":!m(t.path)||void 0,transform:`translate(${t.x} ${t.y})`,onMouseEnter:()=>a(t.path),onMouseLeave:()=>a(null),onClick:()=>e.onSelect(t.path),children:[(0,W.jsx)(`rect`,{width:t.width,height:38,rx:6,fill:n?oL(n):`var(--br-surface)`}),(0,W.jsxs)(`text`,{x:10,y:16,className:`link-name`,children:[n?.state===`viewed`?`✓ `:``,iV(t.path)]}),(0,W.jsx)(`text`,{x:10,y:30,className:`link-dir`,children:aV(t.path)||`/`}),n&&n.openThreads>0&&(0,W.jsx)(`circle`,{cx:t.width-9,cy:9,r:4,className:`link-thread`,"data-unread":n.unreadThreads>0||void 0}),(0,W.jsx)(`title`,{children:`${t.path}\n+${n?.additions??0} −${n?.deletions??0}`})]},t.path)})]})]}),o&&(0,W.jsx)(Qf,{size:`compact-xs`,variant:`default`,className:`link-fit`,onClick:()=>s(null),children:`Recadrer`})]})}function fV(e){let t=mV(),[n,r]=Ge({key:`br:linksMentions`,defaultValue:!0}),[i,a]=Ge({key:`br:linksIsolated`,defaultValue:!1}),[o,s]=(0,C.useState)(!1),c=(0,C.useMemo)(()=>(t.data?.edges??[]).filter(e=>n||e.kind===`import`),[t.data,n]),l=(0,C.useMemo)(()=>new Set(e.stats.map(e=>e.path)),[e.stats]),u=(0,C.useMemo)(()=>(t.data?.packages??[]).map(e=>({id:e.root,label:e.name,members:e.files})),[t.data]),d=hV(t.data),[f,p]=Ge({key:`br:linksWorkspace`,defaultValue:!0}),m=(0,C.useMemo)(()=>c.filter(e=>l.has(e.from)&&l.has(e.to)),[c,l]),h=new Map,g=new Map;for(let e of c)h.set(e.from,(h.get(e.from)??0)+1),g.set(e.to,(g.get(e.to)??0)+1);let _=e=>(h.get(e)??0)+(g.get(e)??0),v=t.data?.packages??[],y=e.stats,b=y.filter(e=>_(e.path)>0),x=y.filter(e=>_(e.path)===0),S=new Map(v.flatMap(e=>e.files.map(t=>[t,e.root]))),w=new Map(v.map(e=>[e.root,e.name])),T=i?e.stats:e.stats.filter(e=>m.some(t=>t.from===e.path||t.to===e.path));if(t.isPending)return(0,W.jsx)(gV,{});if(t.isError)return(0,W.jsx)(_V,{message:t.error.message});let E=(n,r)=>{let i=t.data.languages[n.path],a=t.data.externalImports[n.path]??0;return(0,W.jsxs)(`div`,{className:`tree-node`,"data-current":n.path===e.currentPath||void 0,"data-viewed":n.state===`viewed`||void 0,title:n.path,onClick:()=>e.onSelect(n.path),children:[r!==void 0&&(0,W.jsx)(`span`,{className:`link-rank`,children:r}),(0,W.jsx)(XI,{state:n.state}),(0,W.jsxs)(`span`,{className:`tree-name`,children:[iV(n.path),(0,W.jsx)(Z,{span:!0,size:`xs`,c:`dimmed`,ml:6,children:aV(n.path)})]}),i&&(0,W.jsx)(Uf,{size:`xs`,variant:`outline`,color:`gray`,radius:`sm`,children:rV[i]??i}),(0,W.jsx)(Jm,{label:`importe / mentionne ${h.get(n.path)??0} · utilisé par ${g.get(n.path)??0}${a?` · ${a} import(s) hors PR`:``}`,children:(0,W.jsxs)(Z,{span:!0,size:`xs`,ff:`monospace`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`→`,h.get(n.path)??0,` ←`,g.get(n.path)??0]})})]},n.path)};return(0,W.jsxs)(`div`,{className:`links-view`,children:[(0,W.jsxs)(ql,{gap:6,px:10,pb:6,children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[c.length,` liens · `,b.length,` fichiers reliés`]}),(0,W.jsx)(Qf,{size:`compact-xs`,ml:`auto`,variant:`light`,onClick:()=>s(!0),disabled:T.length===0,children:`Graphe ⤢`})]}),(0,W.jsx)(kf,{size:`xs`,px:10,pb:6,label:`Inclure les mentions (noms ou chemins cités dans le texte)`,checked:n,onChange:e=>r(e.currentTarget.checked)}),t.data.unreadable.length>0&&(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,px:10,pb:4,children:[`Non analysés (binaires / trop gros) : `,t.data.unreadable.length]}),(0,W.jsxs)(`div`,{className:`file-nav-scroll`,children:[(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,px:10,pt:6,pb:2,children:v.length>0?`Ordre de lecture : packages les plus utilisés en premier, puis la base d’abord dans chaque package.`:`Ordre de lecture : la base d’abord (fichiers utilisés par les autres), puis ce qui les assemble.`}),v.length>0?(0,W.jsxs)(W.Fragment,{children:[v.map(e=>{let t=y.filter(t=>S.get(t.path)===e.root);if(t.length===0)return null;let n=e=>e.map(e=>w.get(e)??e).join(`, `);return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Jm,{multiline:!0,w:320,label:`${e.root||`(racine)`} · utilise : ${n(e.dependsOn)||`—`} · utilisé par : ${n(e.usedBy)||`—`}`,children:(0,W.jsxs)(`div`,{className:`pkg-head`,children:[(0,W.jsx)(Uf,{size:`xs`,variant:`light`,color:`violet`,radius:`sm`,children:e.ecosystem}),(0,W.jsx)(Z,{span:!0,size:`xs`,fw:700,truncate:!0,children:e.name}),(0,W.jsx)(Z,{span:!0,size:`xs`,c:`dimmed`,truncate:!0,style:{flex:1},children:e.root?`${e.root}/`:``}),(0,W.jsxs)(Z,{span:!0,size:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`utilisé par `,e.usedBy.length,` · utilise `,e.dependsOn.length]})]})}),t.map(e=>E(e,y.indexOf(e)+1))]},e.root)}),y.some(e=>!S.has(e.path))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`tree-dir`,children:`Hors des packages`}),y.filter(e=>!S.has(e.path)).map(e=>E(e,y.indexOf(e)+1))]})]}):(0,W.jsxs)(W.Fragment,{children:[b.map((e,t)=>E(e,t+1)),x.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`tree-dir`,children:[`Sans lien avec les autres fichiers de la PR (`,x.length,`)`]}),x.map(e=>E(e))]})]})]}),(0,W.jsx)(rm,{opened:o,onClose:()=>s(!1),fullScreen:!0,title:(0,W.jsxs)(ql,{gap:`md`,children:[(0,W.jsx)(Z,{fw:600,children:`Liens entre les fichiers modifiés`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`à gauche la base (fichiers utilisés par les autres), à droite ce qui les utilise · flèche = « est utilisé par » · trait plein = import, pointillé = mention · glisser pour déplacer, molette pour zoomer, clic pour ouvrir le fichier`})]}),styles:{body:{height:`calc(100vh - 60px)`,padding:0}},children:(0,W.jsxs)(nh,{gap:0,h:`100%`,children:[(0,W.jsxs)(ql,{gap:`lg`,px:`md`,py:6,children:[(0,W.jsx)(kf,{size:`xs`,label:`Mentions`,checked:n,onChange:e=>r(e.currentTarget.checked)}),(0,W.jsx)(kf,{size:`xs`,label:`Fichiers sans lien`,checked:i,onChange:e=>a(e.currentTarget.checked)}),d&&(0,W.jsx)(kf,{size:`xs`,label:`Autres packages du monorepo (${d.packages.filter(e=>!e.touched).length})`,checked:f,onChange:e=>p(e.currentTarget.checked)})]}),(0,W.jsx)(dV,{stats:T,groups:u,context:f?d:null,edges:m,currentPath:e.currentPath,onSelect:t=>{s(!1),e.onSelect(t)}})]})})]})}function pV(e){let t=mV(),[n,r]=Ge({key:`br:linksMentions`,defaultValue:!0}),i=(0,C.useMemo)(()=>(t.data?.edges??[]).filter(e=>n||e.kind===`import`),[t.data,n]),a=hV(t.data),o=(0,C.useMemo)(()=>{if(!t.data||!a)return null;let n=new Map(t.data.packages.flatMap(e=>e.files.map(t=>[t,e.root]))),r=new Map;for(let t of e.stats){let e=n.get(t.path);e!==void 0&&!r.has(e)&&r.set(e,t.path)}return{context:a,rootOf:n,firstFile:r,imports:t.data.packageImports}},[t.data,a,e.stats]);return t.isPending?(0,W.jsx)(gV,{}):t.isError?(0,W.jsx)(_V,{message:t.error.message}):(0,W.jsxs)(`div`,{className:`panel-body`,children:[(0,W.jsx)(kf,{size:`xs`,pb:6,label:`Inclure les mentions (noms ou chemins cités dans le texte)`,checked:n,onChange:e=>r(e.currentTarget.checked)}),(0,W.jsx)(uV,{center:e.currentPath,edges:i,stats:e.stats,onSelect:e.onSelect,packages:o})]})}function mV(){let e=SF();return fv({...TE().pr.links.queryOptions({ref:e.ref,base:e.range.base,head:e.range.head,fullPr:e.range.fullPr}),staleTime:1/0})}function hV(e){return(0,C.useMemo)(()=>e&&e.workspace.length>0?{packages:e.workspace.map(e=>({id:e.root,label:e.name,touched:e.touched})),edges:e.packageEdges}:null,[e])}function gV(){return(0,W.jsxs)(ql,{p:`md`,gap:`xs`,children:[(0,W.jsx)(kl,{size:`xs`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`Analyse des imports…`})]})}function _V({message:e}){return(0,W.jsx)($d,{color:`red`,m:`xs`,title:`Liens indisponibles`,children:e})}function vV(e){let t=e.width??48,n=aL(e),r=e.max>0?Math.max(n>0?2:0,n/e.max*t):0,i=n>0?e.additions/n*r:0;return(0,W.jsxs)(`span`,{className:`churn-bar`,style:{width:t},children:[(0,W.jsx)(`i`,{className:`add`,style:{width:i}}),(0,W.jsx)(`i`,{className:`del`,style:{width:r-i}})]})}function yV({additions:e,deletions:t}){return(0,W.jsxs)(Z,{span:!0,size:`xs`,ff:`monospace`,style:{whiteSpace:`nowrap`},children:[e>0&&(0,W.jsxs)(Z,{span:!0,c:`green.4`,inherit:!0,children:[`+`,e]}),` `,t>0&&(0,W.jsxs)(Z,{span:!0,c:`red.4`,inherit:!0,children:[`−`,t]})]})}function bV(e){let{stat:t}=e,n=(0,C.useRef)(null),r=e.current;return(0,C.useEffect)(()=>{r&&n.current?.scrollIntoView({block:`nearest`})},[r]),(0,W.jsxs)(`div`,{ref:n,className:`tree-node`,"data-current":r||void 0,"data-viewed":t.state===`viewed`||void 0,onClick:e.onSelect,title:t.path,style:{paddingLeft:10+e.depth*14},children:[(0,W.jsx)(XI,{state:t.state}),(0,W.jsxs)(`span`,{className:`tree-name`,children:[t.path.split(`/`).at(-1),e.dir&&(0,W.jsx)(Z,{span:!0,size:`xs`,c:`dimmed`,ml:6,children:e.dir})]}),t.openThreads>0&&(0,W.jsxs)(Z,{span:!0,size:`xs`,c:t.unreadThreads>0?`orange.4`:`yellow.4`,children:[(0,W.jsx)(`i`,{className:`ico-c`}),t.openThreads]}),(0,W.jsx)(vV,{additions:t.additions,deletions:t.deletions,max:e.maxChurn,width:36}),(0,W.jsx)(yV,{additions:t.additions,deletions:t.deletions})]})}function xV(e){let t=Math.max(0,...e.stats.map(aL));if(e.sort===`churn`)return(0,W.jsx)(W.Fragment,{children:e.stats.map(n=>(0,W.jsx)(bV,{stat:n,depth:0,dir:n.path.includes(`/`)?n.path.slice(0,n.path.lastIndexOf(`/`)):void 0,current:n.path===e.currentPath,maxChurn:t,onSelect:()=>e.onSelect(n.path)},n.path))});let n=[];for(let t of e.stats){let e=t.path.includes(`/`)?t.path.slice(0,t.path.lastIndexOf(`/`)):``,r=n.at(-1);r&&r.dir===e?r.stats.push(t):n.push({dir:e,stats:[t]})}return(0,W.jsx)(W.Fragment,{children:n.map((n,r)=>(0,W.jsxs)(`div`,{children:[n.dir&&(0,W.jsxs)(`div`,{className:`tree-dir`,children:[n.dir,`/`]}),n.stats.map(n=>(0,W.jsx)(bV,{stat:n,depth:1,current:n.path===e.currentPath,maxChurn:t,onSelect:()=>e.onSelect(n.path)},n.path))]},`${n.dir}:${r}`))})}function SV(e){let[t,n]=(0,C.useState)(new Set),r=lL(e.root,t),i=aL(e.root),a=Math.max(0,...r.flatMap(e=>e.kind===`file`?[aL(e.stat)]:[])),o=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,W.jsx)(W.Fragment,{children:r.map(n=>n.kind===`dir`?(0,W.jsxs)(`div`,{className:`tree-node tree-folder`,style:{paddingLeft:6+n.depth*14},onClick:()=>o(n.path),title:`${n.path}/ · ${n.fileCount} fichiers · ${n.viewedCount} vus`,children:[(0,W.jsx)(`span`,{className:`tree-chevron`,children:t.has(n.path)?`▸`:`▾`}),(0,W.jsxs)(`span`,{className:`tree-name`,children:[n.name,`/`]}),n.openThreads>0&&(0,W.jsxs)(Z,{span:!0,size:`xs`,c:`yellow.4`,children:[(0,W.jsx)(`i`,{className:`ico-c`}),n.openThreads]}),(0,W.jsxs)(Z,{span:!0,size:`xs`,c:n.viewedCount===n.fileCount?`green.5`:`dimmed`,children:[n.viewedCount,`/`,n.fileCount]}),(0,W.jsx)(vV,{additions:n.additions,deletions:n.deletions,max:i,width:36}),(0,W.jsx)(yV,{additions:n.additions,deletions:n.deletions})]},`d:${n.path}`):(0,W.jsx)(bV,{stat:n.stat,depth:n.depth+.6,current:n.path===e.currentPath,maxChurn:a,onSelect:()=>e.onSelect(n.path)},n.path))})}function CV(e){let{stats:t}=e,[n,r]=(0,C.useState)([]),[i,a]=(0,C.useState)(``),o=(0,C.useMemo)(()=>t.filter(e=>(!n.includes(`unviewed`)||e.state!==`viewed`)&&(!n.includes(`threads`)||e.openThreads>0)&&(i===``||e.path.toLowerCase().includes(i.toLowerCase()))),[t,n,i]),s=(0,C.useMemo)(()=>cL(o),[o]),c=t.filter(e=>e.state===`viewed`).length;return(0,W.jsxs)(`div`,{className:`file-nav`,children:[(0,W.jsx)(Qm,{size:`xs`,mx:10,mb:6,value:e.nav,onChange:t=>e.onNavChange(t===`list`||t===`links`?t:`tree`),data:[{value:`list`,label:`Liste`},{value:`tree`,label:`Arbre`},{value:`links`,label:`Liens`}]}),(0,W.jsxs)(ql,{gap:4,px:10,pb:6,children:[(0,W.jsxs)(op.Group,{multiple:!0,value:n,onChange:r,children:[(0,W.jsx)(op,{size:`xs`,value:`unviewed`,children:`Non vus`}),(0,W.jsx)(op,{size:`xs`,value:`threads`,children:`Threads ouverts`})]}),e.nav!==`links`&&(0,W.jsx)(Qm,{size:`xs`,ml:`auto`,value:e.sort,onChange:t=>e.onSortChange(t===`churn`?`churn`:`name`),data:[{value:`name`,label:`A→Z`},{value:`churn`,label:`Taille`}]})]}),(0,W.jsx)(Mh,{size:`xs`,px:10,pb:6,placeholder:`Filtrer les fichiers…`,value:i,onChange:e=>a(e.currentTarget.value)}),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,px:10,pb:4,children:[c,`/`,t.length,` fichiers vus · `,aL(s),` lignes modifiées`,o.length===t.length?``:` · ${o.length} affichés`]}),o.length===0?(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,px:10,children:`Aucun fichier.`}):e.nav===`links`?(0,W.jsx)(fV,{stats:o,currentPath:e.currentPath,onSelect:e.onSelect}):(0,W.jsx)(`div`,{className:`file-nav-scroll`,children:e.nav===`tree`?(0,W.jsx)(SV,{root:s,currentPath:e.currentPath,onSelect:e.onSelect}):(0,W.jsx)(xV,{stats:o,sort:e.sort,currentPath:e.currentPath,onSelect:e.onSelect})})]})}function wV(e){let t=SF(),n=iS({from:`/$owner/$repo/pull/$number`}),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),s=t.detail.commits,c=t.detail.myReview?.commitOid??null,l=e=>{n({search:t=>({...t,range:e})}),i(!1)},u=new Set;if(t.range.kind===`commits`){let e=s.findIndex(e=>e.parentOid===t.range.base),n=s.findIndex(e=>e.oid===t.range.head);if(e!==-1&&n>=e)for(let t of s.slice(e,n+1))u.add(t.oid)}let d=(e,t,n,r=!1)=>(0,W.jsx)(Pm,{value:e,disabled:r,label:(0,W.jsxs)(ql,{gap:8,justify:`space-between`,wrap:`nowrap`,w:380,children:[(0,W.jsx)(Z,{size:`sm`,children:t}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:n})]})},e);return(0,W.jsxs)(xl,{opened:r,onChange:i,position:`bottom-start`,shadow:`lg`,width:460,trapFocus:!0,children:[(0,W.jsx)(xl.Target,{children:(0,W.jsxs)(Qf,{size:`compact-sm`,variant:`light`,onClick:()=>i(e=>!e),rightSection:`▾`,children:[`Plage : `,t.range.label]})}),(0,W.jsxs)(xl.Dropdown,{p:`sm`,children:[(0,W.jsx)(Z,{size:`xs`,tt:`uppercase`,fw:600,c:`dimmed`,mb:6,children:`Plage de comparaison`}),(0,W.jsx)(Pm.Group,{value:t.range.kind===`commits`?``:t.range.kind,onChange:l,children:(0,W.jsxs)(nh,{gap:8,children:[d(`all`,`Tous les changements`,`${s.length} commits · ${t.detail.files.length} fichiers`),d(`visit`,`Depuis ma dernière visite`,e.visitAt?e.visitHead===t.detail.pr.headRefOid?`aucun nouveau commit`:new Date(e.visitAt).toLocaleString(`fr`):`jamais visitée`,!e.visitAt||e.visitHead===t.detail.pr.headRefOid),d(`review`,`Depuis ma dernière review`,c?c===t.detail.pr.headRefOid?`à jour`:c.slice(0,7):`jamais reviewée`,!c||c===t.detail.pr.headRefOid)]})}),(0,W.jsx)(_p,{my:`sm`}),(0,W.jsx)(Z,{size:`xs`,tt:`uppercase`,fw:600,c:`dimmed`,mb:6,children:`Commits (clic : un commit · Maj+clic : intervalle)`}),(0,W.jsx)(nh,{gap:2,mah:320,style:{overflow:`auto`},children:s.map((e,t)=>(0,W.jsxs)(ql,{gap:8,wrap:`nowrap`,px:4,py:2,style:{cursor:`pointer`,borderRadius:4,background:e.seen?void 0:`rgba(255,146,43,.08)`},onClick:e=>{let n=e.shiftKey&&a!==null?Math.min(a,t):t,r=e.shiftKey&&a!==null?Math.max(a,t):t;o(t);let i=s[n],c=s[r];i.parentOid&&l(`${i.parentOid}..${c.oid}`)},children:[(0,W.jsx)(kf,{size:`xs`,readOnly:!0,checked:u.has(e.oid)}),(0,W.jsx)(Z,{ff:`monospace`,size:`xs`,c:`dimmed`,children:e.shortOid}),(0,W.jsx)(Z,{size:`sm`,truncate:!0,style:{flex:1},children:e.headline}),!e.seen&&(0,W.jsx)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:`nouveau`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(e.date)})]},e.oid))}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,mt:`sm`,children:`Hors « tous les changements », seuls les commentaires côté nouveau code sont possibles (numéros de ligne de la PR).`})]})]})}function TV(e){let t=SF(),n=wF(t.ref),[r,i]=(0,C.useState)(``),a=t.detail.pr.author?.login===t.me,[o,s]=(0,C.useState)(`COMMENT`),c=t.detail.pendingReview,l=async()=>{await n.submitReview.mutateAsync({prId:t.detail.pr.id,pendingReviewId:c?.id??null,event:o,body:r}),i(``),e.onChange(!1)};return(0,W.jsxs)(xl,{opened:e.opened,onChange:e.onChange,position:`bottom-end`,shadow:`lg`,width:400,trapFocus:!0,children:[(0,W.jsx)(xl.Target,{children:(0,W.jsx)(Qf,{size:`compact-sm`,onClick:()=>e.onChange(!e.opened),rightSection:(0,W.jsx)(Bp,{size:`xs`,children:`⇧S`}),children:c?`Soumettre la review (${c.comments})`:`Review`})}),(0,W.jsxs)(xl.Dropdown,{children:[(0,W.jsx)(Z,{fw:600,mb:6,children:c?`Review en attente · ${c.comments} commentaire${c.comments>1?`s`:``}`:`Nouvelle review`}),(0,W.jsx)(Lp,{autosize:!0,minRows:3,placeholder:`Résumé (optionnel)`,value:r,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&l()}}),(0,W.jsx)(Pm.Group,{value:o,onChange:e=>s(e),my:`sm`,children:(0,W.jsxs)(nh,{gap:6,children:[(0,W.jsx)(Pm,{value:`COMMENT`,label:`Commenter`}),(0,W.jsx)(Jm,{label:`Impossible d’approuver sa propre PR`,disabled:!a,children:(0,W.jsx)(Pm,{value:`APPROVE`,label:`Approuver`,disabled:a})}),(0,W.jsx)(Jm,{label:`Impossible sur sa propre PR`,disabled:!a,children:(0,W.jsx)(Pm,{value:`REQUEST_CHANGES`,label:`Demander des changements`,disabled:a})})]})}),(0,W.jsxs)(ql,{justify:`flex-end`,gap:6,children:[c&&(0,W.jsx)(Qf,{size:`compact-sm`,variant:`subtle`,color:`red`,loading:n.discardReview.isPending,onClick:()=>n.discardReview.mutate({reviewId:c.id}),children:`Abandonner la review`}),(0,W.jsx)(Qf,{size:`compact-sm`,color:o===`APPROVE`?`green`:o===`REQUEST_CHANGES`?`red`:`blue`,loading:n.submitReview.isPending,disabled:!c&&o===`COMMENT`&&r.trim()===``,onClick:()=>void l(),children:`Soumettre`})]})]})]})}function EV(e){let t=SF(),{pr:n,checks:r,reviewers:i,requestedTeams:a}=t.detail,o=r?FE[r.state]:null;return(0,W.jsxs)(`div`,{className:`pr-head`,children:[(0,W.jsxs)(ql,{gap:8,wrap:`nowrap`,align:`baseline`,children:[(0,W.jsxs)(zh,{order:3,fw:600,style:{minWidth:0},lineClamp:1,children:[n.title,` `,(0,W.jsxs)(Z,{span:!0,c:`dimmed`,fw:400,inherit:!0,children:[n.owner,`/`,n.repo,` #`,n.number]})]}),(0,W.jsx)(sf,{href:n.url,target:`_blank`,size:`sm`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:`GitHub ↗`})]}),(0,W.jsxs)(ql,{gap:8,mt:4,wrap:`wrap`,children:[(0,W.jsx)(Uf,{color:n.state===`OPEN`?n.isDraft?`gray`:`green`:n.state===`MERGED`?`violet`:`red`,variant:`light`,children:n.isDraft?`Brouillon`:n.state===`OPEN`?`Ouverte`:n.state===`MERGED`?`Mergée`:`Fermée`}),(0,W.jsx)(Bf,{src:n.author?.avatarUrl,size:20}),(0,W.jsxs)(Z,{size:`sm`,c:`dimmed`,children:[n.author?.login??`ghost`,` · `,t.detail.commits.length,` commits de`,` `,(0,W.jsx)(Z,{span:!0,ff:`monospace`,c:`blue.4`,inherit:!0,children:n.headRefName}),` `,`vers`,` `,(0,W.jsx)(Z,{span:!0,ff:`monospace`,c:`blue.4`,inherit:!0,children:n.baseRefName}),` `,`· ouverte `,ME(n.createdAt)]}),o&&r&&(0,W.jsxs)(xl,{position:`bottom`,shadow:`md`,width:360,children:[(0,W.jsx)(xl.Target,{children:(0,W.jsxs)(Uf,{color:o.color,variant:`light`,style:{cursor:`pointer`},children:[o.label,` · `,r.contexts.length]})}),(0,W.jsx)(xl.Dropdown,{children:(0,W.jsx)(nh,{gap:4,children:r.contexts.map(e=>(0,W.jsxs)(ql,{gap:6,wrap:`nowrap`,children:[(0,W.jsx)(Uf,{size:`xs`,color:/SUCCESS/.test(e.state)?`green`:/FAIL|ERROR/.test(e.state)?`red`:`yellow`,children:e.state.toLowerCase()}),e.url?(0,W.jsx)(sf,{href:e.url,target:`_blank`,size:`sm`,truncate:!0,children:e.name}):(0,W.jsx)(Z,{size:`sm`,children:e.name})]},e.name))})})]}),n.mergeable===`CONFLICTING`&&(0,W.jsx)(Uf,{color:`red`,variant:`light`,children:`conflits`}),i.map(e=>(0,W.jsxs)(Uf,{variant:`outline`,color:PE[e.state]?.color??`gray`,leftSection:(0,W.jsx)(Bf,{src:e.avatarUrl,size:14}),children:[e.login,` : `,PE[e.state]?.label??e.state]},e.login)),a.map(e=>(0,W.jsxs)(Uf,{variant:`outline`,color:`yellow`,children:[`@`,e,` : demandé`]},e))]}),(0,W.jsxs)(`div`,{className:`pr-bar`,children:[(0,W.jsx)(wV,{visitAt:e.visitAt,visitHead:e.visitHead}),e.children]})]})}function DV(){let e=zV.useParams(),t=(0,C.useMemo)(()=>({owner:e.owner,repo:e.repo,number:Number(e.number)}),[e.owner,e.repo,e.number]),n=TE(),r=Gg(),i=fv(n.pr.get.queryOptions(t));return bE(n.pr.onChange.subscriptionOptions(t,{onData:()=>void r.invalidateQueries({queryKey:n.pr.get.queryKey(t)})})),i.isPending?(0,W.jsx)(ep,{style:{flex:1},children:(0,W.jsx)(kl,{})}):i.isError?(0,W.jsx)($d,{color:`red`,m:`lg`,title:`PR introuvable ou inaccessible`,children:i.error.message}):(0,W.jsx)(kV,{ref_:t,detail:i.data},`${t.owner}/${t.repo}#${t.number}`)}function OV(e,t,n){let{baseRefOid:r,headRefOid:i}=t.pr,a={kind:`all`,base:r,head:i,fullPr:!0,label:`Tous les changements`};if(e===`visit`&&n&&n!==i)return{kind:`visit`,base:n,head:i,fullPr:!1,label:`Depuis ma dernière visite`};let o=t.myReview?.commitOid;if(e===`review`&&o&&o!==i)return{kind:`review`,base:o,head:i,fullPr:!1,label:`Depuis ma dernière review`};let s=/^([0-9a-f]{7,40})\.\.([0-9a-f]{7,40})$/.exec(e);if(s){let[,e,n]=s,r=t.commits.find(t=>t.parentOid===e),i=t.commits.find(e=>e.oid===n);return{kind:`commits`,base:e,head:n,fullPr:!1,label:r&&i&&r.oid===i.oid?`Commit ${i.shortOid}`:`Commits ${r?.shortOid??e.slice(0,7)}…${i?.shortOid??n.slice(0,7)}`}}return a}function kV({ref_:e,detail:t}){let n=TE(),r=iS({from:`/$owner/$repo/pull/$number`}),i=zV.useSearch(),a=wF(e),[o]=(0,C.useState)(()=>Date.now()),[s]=(0,C.useState)(()=>t.pr.headRefOid),[c,l]=Ge({key:`br:layout`,defaultValue:`split`}),[u,d]=Ge({key:`br:panel`,defaultValue:!0}),[f,p]=Ge({key:`br:panelTab`,defaultValue:`conversations`}),m=e=>{u&&f===e?d(!1):(p(e),d(!0))},[h,g]=Ge({key:`br:tree`,defaultValue:!0}),[_,v]=Ge({key:`br:nav`,defaultValue:`tree`}),y=_===`list`||_===`links`?_:`tree`,[b,x]=Ge({key:`br:navSort`,defaultValue:`name`}),[S]=Ge({key:`br:linksMentions`,defaultValue:!0}),[w,T]=(0,C.useState)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(new Set),[M,N]=(0,C.useState)({fileIdx:null,hunkIdx:null}),[ee,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(!1),L=(0,C.useRef)(null),R=t.pr.headRefOid,te=t.visits.find(e=>e.visitedAt<o)??null,ne=te?.headOid??null,re=ne&&ne!==R?`visit`:`all`,ie=OV(i.range??re,t,ne),ae=i.mode??`continuous`,oe=fv({...n.pr.diff.queryOptions({ref:e,base:ie.base,head:ie.head,fullPr:ie.fullPr}),staleTime:1/0}),se=fv({...n.pr.links.queryOptions({ref:e,base:ie.base,head:ie.head,fullPr:ie.fullPr}),staleTime:1/0,enabled:y===`links`}),ce=(0,C.useMemo)(()=>{let e=oe.data?.files??[],t=new Map(e.map(e=>[e.path,e])),n;if(y!==`links`)n=uL(e,y,b);else if(se.data){let t=se.data.edges.filter(e=>S||e.kind===`import`),r=e.map(e=>e.path);n=se.data.packages.length>0?yF(se.data.packages.map(e=>({items:e.files})),r,t):vF(r,t)}else return e;return n.flatMap(e=>t.get(e)??[])},[oe.data,y,b,se.data,S]),le=a.visit.mutate,z=(0,C.useRef)(!1);(0,C.useEffect)(()=>{z.current||(z.current=!0,le({ref:e,headOid:R,commitOids:t.commits.map(e=>e.oid)}))},[le,e,R,t.commits]);let B=(0,C.useMemo)(()=>new Set(t.seenHunks),[t.seenHunks]),V=(0,C.useMemo)(()=>{let e=new Map(t.files.map(e=>[e.path,e.viewed]));return ce.map(n=>{let r=t.threads.filter(e=>e.path===n.path&&!e.isResolved);return{path:n.path,additions:n.additions,deletions:n.deletions,state:qI(n,e.get(n.path),B).state,openThreads:r.length,unreadThreads:r.filter(e=>e.unread>0).length}})},[ce,t.files,t.threads,B]),ue=ae===`focus`?ce.find(e=>e.path===i.file)??ce.find(e=>t.files.find(t=>t.path===e.path)?.viewed!==`VIEWED`)??ce[0]??null:null,de=ae===`focus`?ue?.path??null:ce[M.fileIdx??-1]?.path??null,fe={ref:e,detail:t,diff:oe.data??null,me:t.viewer.login,range:ie,layout:c,mode:ae,pendingReviewId:t.pendingReview?.id??null,seenHunks:B,selection:w,setSelection:e=>{T(e),e&&D(null)},fileComposer:E,setFileComposer:e=>{D(e),e&&T(null)},focusedThread:O,setFocusedThread:k,canComment:e=>t.pr.state===`OPEN`&&ie.head===R&&(e===`RIGHT`||ie.fullPr),scrollToThread:e=>{k(e);let n=t.threads.find(t=>t.id===e);ae===`focus`&&n&&n.path!==ue?.path&&ce.some(e=>e.path===n.path)?(r({search:e=>({...e,file:n.path})}),requestAnimationFrame(()=>L.current?.scrollToThread(e))):L.current?.scrollToThread(e)},scrollToFile:e=>{ae===`focus`?r({search:t=>({...t,file:e})}):L.current?.scrollToFile(e)},advanceFrom:e=>{if(ae===`focus`){let n=AV(ce,t,e);n&&r({search:e=>({...e,file:n.path})});return}let n=ce[ce.findIndex(t=>t.path===e)+1];n&&L.current?.scrollToFile(n.path)}},pe=t.files.filter(e=>e.viewed===`VIEWED`).length,H=ce.reduce((e,t)=>e+t.hunks.length,0),me=ce.reduce((e,t)=>e+t.hunks.filter(e=>B.has(`${t.path}\n${e.hash}`)).length,0);return(0,W.jsx)(xF,{value:fe,children:(0,W.jsxs)(`div`,{className:`pr-page`,children:[(0,W.jsxs)(EV,{visitAt:te?.visitedAt??null,visitHead:ne,children:[(0,W.jsx)(Qm,{size:`xs`,value:ae,onChange:e=>void r({search:t=>({...t,mode:e===`focus`?`focus`:`continuous`})}),data:[{value:`continuous`,label:`Continu`},{value:`focus`,label:`Focus`}]}),(0,W.jsx)(Qm,{size:`xs`,value:c,onChange:e=>l(e===`unified`?`unified`:`split`),data:[{value:`split`,label:`Côte à côte`},{value:`unified`,label:`Unifié`}]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(Jm,{label:`${me}/${H} hunks vus dans la plage`,children:(0,W.jsxs)(ql,{gap:6,children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[`Vu `,pe,`/`,t.files.length,` fichiers`]}),(0,W.jsx)(ym,{w:90,size:`sm`,color:`green`,value:t.files.length?pe/t.files.length*100:0})]})}),(0,W.jsx)(Qf,{size:`compact-sm`,variant:h?`light`:`default`,onClick:()=>g(!h),children:`Fichiers`}),(0,W.jsx)(Qf,{size:`compact-sm`,variant:u&&f===`description`?`light`:`default`,onClick:()=>m(`description`),children:`Description`}),(0,W.jsxs)(Qf,{size:`compact-sm`,variant:u&&f===`conversations`?`light`:`default`,onClick:()=>m(`conversations`),children:[`Conversations `,t.threads.filter(e=>!e.isResolved).length]}),(0,W.jsx)(Qf,{size:`compact-sm`,variant:u&&f===`neighbors`?`light`:`default`,onClick:()=>m(`neighbors`),children:`Voisinage`}),(0,W.jsx)(TV,{opened:ee,onChange:P})]}),s!==R&&ie.base!==s&&(0,W.jsx)($d,{color:`orange`,variant:`light`,radius:0,py:6,children:(0,W.jsxs)(ql,{gap:`sm`,children:[(0,W.jsx)(Z,{size:`sm`,children:`Nouveaux commits poussés pendant votre lecture.`}),(0,W.jsx)(Qf,{size:`compact-xs`,variant:`light`,color:`orange`,onClick:()=>void r({search:e=>({...e,range:`${s}..${R}`})}),children:`Voir uniquement ces changements`})]})}),ae===`focus`&&ue&&(0,W.jsx)(jV,{files:ce,current:ue}),(0,W.jsxs)(`div`,{className:`pr-body`,"data-tree":h?`open`:`closed`,"data-panel":u?`open`:`closed`,children:[h&&(0,W.jsx)(`aside`,{className:`pr-tree`,children:(0,W.jsx)(CV,{stats:V,nav:y,onNavChange:v,sort:b,onSortChange:x,currentPath:de,onSelect:fe.scrollToFile})}),(0,W.jsxs)(`main`,{style:{minWidth:0,minHeight:0},children:[oe.isPending&&(0,W.jsx)(ep,{h:`100%`,children:(0,W.jsx)(kl,{})}),oe.isError&&(0,W.jsxs)($d,{color:`red`,m:`md`,title:`Diff indisponible pour cette plage`,children:[oe.error.message,(0,W.jsx)(Qf,{mt:`sm`,size:`xs`,onClick:()=>void r({search:e=>({...e,range:`all`})}),children:`Revenir à tous les changements`})]}),oe.data&&(0,W.jsx)(iL,{files:ce,onlyFile:ue?.path??null,collapsed:A,onToggleCollapse:e=>j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onCurrentChange:(e,t)=>N({fileIdx:e,hunkIdx:t}),handleRef:L})]}),u&&(0,W.jsxs)(`aside`,{className:`pr-panel`,children:[(0,W.jsx)(Qm,{className:`panel-tabs`,size:`xs`,fullWidth:!0,value:f,onChange:e=>p(e===`description`||e===`neighbors`?e:`conversations`),data:[{value:`conversations`,label:`Conversations ${t.threads.filter(e=>!e.isResolved).length}`},{value:`description`,label:`Description`},{value:`neighbors`,label:`Voisinage`}]}),(0,W.jsx)(`div`,{className:`panel-scroll`,children:f===`description`?(0,W.jsx)(DF,{}):f===`neighbors`?(0,W.jsx)(pV,{stats:V,currentPath:de,onSelect:fe.scrollToFile}):(0,W.jsx)(EF,{})})]})]}),(0,W.jsx)(MV,{files:ce,focusFile:ue,current:M,listRef:L,onToggleReview:()=>P(e=>!e),onToggleConversations:()=>m(`conversations`),onToggleDescription:()=>m(`description`),onToggleTree:()=>g(!h),onToggleLayout:()=>l(c===`split`?`unified`:`split`),onHelp:()=>I(!0)}),(0,W.jsx)(PV,{opened:F,onClose:()=>I(!1)})]})})}function AV(e,t,n){let r=e.findIndex(e=>e.path===n);return[...e.slice(r+1),...e.slice(0,r)].find(e=>t.files.find(t=>t.path===e.path)?.viewed!==`VIEWED`)}function jV({files:e,current:t}){let n=iS({from:`/$owner/$repo/pull/$number`}),r=YI(),i=SF(),a=e.indexOf(t),o=e=>e&&void n({search:t=>({...t,file:e.path})}),s=e.filter(e=>i.detail.files.find(t=>t.path===e.path)?.viewed!==`VIEWED`).length;return(0,W.jsxs)(ql,{className:`focus-bar`,gap:`sm`,px:`md`,py:6,children:[(0,W.jsxs)(Qf,{size:`compact-xs`,variant:`default`,onClick:()=>o(e[a-1]),disabled:a<=0,children:[`←`,` `,(0,W.jsx)(Bp,{size:`xs`,ml:4,children:`k`})]}),(0,W.jsx)(Z,{ff:`monospace`,fw:600,size:`sm`,children:t.path}),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[`fichier `,a+1,`/`,e.length,` · `,s,` non vu`,s>1?`s`:``]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(`div`,{className:`steps`,children:e.map(e=>{let n=i.detail.files.find(t=>t.path===e.path)?.viewed;return(0,W.jsx)(`i`,{title:e.path,"data-state":e===t?`current`:n===`VIEWED`?`viewed`:`none`,onClick:()=>o(e)},e.path)})}),(0,W.jsx)(Qf,{size:`compact-xs`,color:`green`,onClick:()=>{r.toggleFile(t,!0),i.advanceFrom(t.path)},rightSection:(0,W.jsx)(Bp,{size:`xs`,children:`v`}),children:`✓ Vu, suivant non vu`}),(0,W.jsxs)(Qf,{size:`compact-xs`,variant:`default`,onClick:()=>o(e[a+1]),disabled:a>=e.length-1,children:[(0,W.jsx)(Bp,{size:`xs`,mr:4,children:`j`}),` `,`→`]})]})}function MV(e){let t=SF(),n=wF(t.ref),r=YI(),i=iS({from:`/$owner/$repo/pull/$number`}),{files:a,focusFile:o,listRef:s}=e,c=o??a[e.current.fileIdx??-1]??null,l=c&&e.current.hunkIdx!==null?c.hunks[e.current.hunkIdx]:void 0,u=e=>{if(o){let t=a[a.indexOf(o)+e];t&&i({search:e=>({...e,file:t.path})})}else s.current?.step(`file`,e)},d=t.detail.threads.find(e=>e.id===t.focusedThread);return lt([[`j`,()=>u(1)],[`k`,()=>u(-1)],[`n`,()=>s.current?.step(`hunk`,1)],[`p`,()=>s.current?.step(`hunk`,-1)],[`]`,()=>s.current?.step(`thread`,1)],[`v`,()=>{if(!c)return;let e=t.detail.files.find(e=>e.path===c.path)?.viewed===`VIEWED`;r.toggleFile(c,!e),e||t.advanceFrom(c.path)}],[`h`,()=>{c&&l&&(r.toggleHunk(c,l,!t.seenHunks.has(`${c.path}\n${l.hash}`)),s.current?.step(`hunk`,1))}],[`r`,()=>{document.querySelector(`[data-thread="${t.focusedThread}"] [data-reply]`)?.click()}],[`x`,()=>d&&(d.isResolved?d.canUnresolve:d.canResolve)&&n.setResolved.mutate({threadId:d.id,resolved:!d.isResolved})],[`m`,()=>void i({search:e=>({...e,mode:t.mode===`focus`?`continuous`:`focus`})})],[`u`,e.onToggleLayout],[`t`,e.onToggleConversations],[`d`,e.onToggleDescription],[`f`,e.onToggleTree],[`shift+S`,e.onToggleReview],[`i`,()=>void i({to:`/`})],[`Escape`,()=>{t.setSelection(null),t.setFileComposer(null)}],[`shift+?`,e.onHelp]]),(0,W.jsxs)(`div`,{className:`statusbar`,children:[(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`j`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`k`}),` fichier`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`n`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`p`}),` hunk`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`]`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`[`}),` thread ouvert`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`v`}),` fichier vu · `,(0,W.jsx)(Bp,{size:`xs`,children:`h`}),` hunk vu`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`r`}),` répondre · `,(0,W.jsx)(Bp,{size:`xs`,children:`x`}),` résoudre`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`?`}),` aide`]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsxs)(`span`,{children:[c?c.path:``,c&&l?` · hunk ${(e.current.hunkIdx??0)+1}/${c.hunks.length}`:``]})]})}var NV=[[`j / k`,`fichier suivant / précédent`],[`n / p`,`hunk suivant / précédent`],[`] / [`,`thread non résolu suivant / précédent`],[`v`,`marquer le fichier vu, puis fichier suivant (focus : fichier non vu suivant)`],[`h`,`marquer le hunk courant vu, puis hunk suivant`],[`r`,`répondre au thread sélectionné`],[`x`,`résoudre / rouvrir le thread sélectionné`],[`clic n° de ligne`,`commenter (Maj+clic : plage)`],[`m`,`mode continu / focus`],[`u`,`côte à côte / unifié`],[`t`,`panneau conversations`],[`d`,`description de la PR`],[`f`,`arbre des fichiers`],[`Maj+S`,`soumettre la review`],[`i`,`retour à l’inbox`],[`Ctrl+K`,`aller à une PR`],[`Échap`,`fermer le commentaire en cours`]];function PV(e){return(0,W.jsx)(rm,{opened:e.opened,onClose:e.onClose,title:`Raccourcis clavier`,size:`md`,children:(0,W.jsx)(xh,{children:(0,W.jsx)(xh.Tbody,{children:NV.map(([e,t])=>(0,W.jsxs)(xh.Tr,{children:[(0,W.jsx)(xh.Td,{children:(0,W.jsx)(Bp,{children:e})}),(0,W.jsx)(xh.Td,{children:t})]},e))})})})}function FV(){let e=TE(),t=Gg(),n=fv(e.config.get.queryOptions()),[r,i]=(0,C.useState)(`repo`),[a,o]=(0,C.useState)(``),s=()=>{t.invalidateQueries({queryKey:e.config.get.queryKey()}),t.invalidateQueries({queryKey:e.inbox.get.queryKey()})},c=hv(e.config.add.mutationOptions({onSuccess:()=>{o(``),s()},onError:e=>ng.show({color:`red`,title:`Ajout impossible`,message:e.message})})),l=hv(e.config.remove.mutationOptions({onSuccess:s})),u=[...n.data?.orgs.map(e=>({kind:`org`,name:e}))??[],...n.data?.repos.map(e=>({kind:`repo`,name:e}))??[]];return(0,W.jsxs)(pp,{size:`sm`,py:`xl`,children:[(0,W.jsx)(zh,{order:2,mb:`xs`,children:`Repos et orgs suivis`}),(0,W.jsx)(Z,{c:`dimmed`,size:`sm`,mb:`lg`,children:`L’inbox ne montre que les PR de cette liste. Une org (ou un compte) suivie inclut tous ses repos. Le fichier de config peut aussi être édité à la main : les modifications sont prises en compte à chaud.`}),(0,W.jsx)(`form`,{onSubmit:e=>{e.preventDefault();let t=a.trim();t&&c.mutate({kind:r,name:t})},children:(0,W.jsxs)(ql,{align:`flex-end`,mb:`lg`,children:[(0,W.jsx)(Qm,{value:r,onChange:e=>i(e===`org`?`org`:`repo`),data:[{value:`repo`,label:`Repo`},{value:`org`,label:`Org / compte`}]}),(0,W.jsx)(Mh,{style:{flex:1},placeholder:r===`repo`?`owner/repo`:`nom-de-l-org`,value:a,onChange:e=>o(e.currentTarget.value),"data-autofocus":!0}),(0,W.jsx)(Qf,{type:`submit`,loading:c.isPending,children:`Suivre`})]})}),(0,W.jsxs)(nh,{gap:`xs`,children:[u.length===0&&(0,W.jsx)(Z,{c:`dimmed`,children:`Aucun repo suivi pour l’instant.`}),u.map(e=>(0,W.jsx)(Nc,{withBorder:!0,p:`xs`,px:`sm`,children:(0,W.jsxs)(ql,{justify:`space-between`,children:[(0,W.jsxs)(ql,{gap:`xs`,children:[(0,W.jsx)(Uf,{variant:`light`,color:e.kind===`org`?`violet`:`blue`,children:e.kind===`org`?`org`:`repo`}),(0,W.jsx)(Z,{ff:`monospace`,size:`sm`,children:e.name})]}),(0,W.jsx)(Ll,{variant:`subtle`,color:`red`,"aria-label":`Ne plus suivre ${e.name}`,onClick:()=>l.mutate(e),children:`✕`})]})},`${e.kind}:${e.name}`))]})]})}var IV=wS({component:kE}),LV=SS({getParentRoute:()=>IV,path:`/`,validateSearch:e=>typeof e.section==`string`?{section:e.section}:{},component:zE}),RV=SS({getParentRoute:()=>IV,path:`/settings`,component:FV}),zV=SS({getParentRoute:()=>IV,path:`/$owner/$repo/pull/$number`,validateSearch:e=>({...typeof e.range==`string`?{range:e.range}:{},...e.mode===`focus`||e.mode===`continuous`?{mode:e.mode}:{},...typeof e.file==`string`?{file:e.file}:{}}),component:DV}),BV=BS({routeTree:IV.addChildren([LV,RV,zV]),defaultPreload:`intent`,scrollRestoration:!1}),VV=tr({primaryColor:`blue`,defaultRadius:`sm`,fontFamilyMonospace:`ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace`,cursorType:`pointer`});(0,WC.createRoot)(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsxs)(er,{theme:VV,defaultColorScheme:`dark`,forceColorScheme:`dark`,children:[(0,W.jsx)(Ug,{position:`bottom-left`,limit:4}),(0,W.jsx)(Kg,{client:DE,children:(0,W.jsx)(wE,{trpcClient:OE,queryClient:DE,children:(0,W.jsx)(US,{router:BV})})})]})}));
|
|
109
|
+
`:``)+t+n.slice(o)),a(`write`),requestAnimationFrame(()=>i?.focus())},children:`± suggestion`})]}),(0,W.jsx)(jh.Panel,{value:`write`,pt:6,children:(0,W.jsx)(Lp,{ref:c,autosize:!0,minRows:3,maxRows:18,autoFocus:e.autoFocus??!0,placeholder:e.placeholder??`Laisser un commentaire (Markdown)…`,value:n,onChange:e=>r(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),u(e.actions.length-1)):t.key===`Escape`&&(t.preventDefault(),e.onCancel?.())},styles:{input:{fontFamily:`var(--mantine-font-family-monospace)`,fontSize:13}}})}),(0,W.jsx)(jh.Panel,{value:`preview`,pt:6,children:(0,W.jsxs)(J,{mih:70,p:6,children:[n.trim()===``&&(0,W.jsx)(Z,{c:`dimmed`,children:`Rien à prévisualiser.`}),l.isFetching&&(0,W.jsx)(kl,{size:`xs`}),l.data&&(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:l.data}})]})})]}),(0,W.jsxs)(ql,{gap:6,mt:6,justify:`flex-end`,children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,mr:`auto`,children:[`brouillon conservé localement · `,(0,W.jsx)(Bp,{size:`xs`,children:`Ctrl ↵`}),` envoyer · `,(0,W.jsx)(Bp,{size:`xs`,children:`Esc`}),` `,`fermer`]}),e.onCancel&&(0,W.jsx)(Qf,{size:`compact-sm`,variant:`subtle`,color:`gray`,onClick:e.onCancel,children:`Annuler`}),e.actions.map((t,r)=>(0,W.jsx)(Qf,{size:`compact-sm`,variant:t.variant??(r===e.actions.length-1?`filled`:`default`),color:t.color,disabled:t.disabled||n.trim()===``,loading:o===r,onClick:()=>void u(r),children:t.label},t.label))]})]})}var xF=(0,C.createContext)(null);function SF(){let e=(0,C.useContext)(xF);if(!e)throw Error(`usePrView must be used inside <PrViewContext>`);return e}function CF(e){return t=>ng.show({color:`red`,title:e,message:t.message})}function wF(e){let t=TE(),n=Gg(),r=t.pr.get.queryKey(e),i=e=>n.setQueryData(r,t=>t&&e(t)),a=()=>n.invalidateQueries({queryKey:r}),o=()=>{a(),n.invalidateQueries({queryKey:t.inbox.get.queryKey()})},s=async e=>{await n.cancelQueries({queryKey:r}),i(e),o()},c=(e,t,n)=>({id:t,comments:(e.pendingReview?.id===t?e.pendingReview.comments:0)+n});return{setFileViewed:hv(t.pr.setFileViewed.mutationOptions({onMutate:({path:e,viewed:t})=>i(n=>({...n,files:n.files.map(n=>n.path===e?{...n,viewed:t?`VIEWED`:`UNVIEWED`}:n)})),onError:e=>{CF(`Marquage « vu » impossible`)(e),a()}})),setHunksSeen:hv(t.pr.setHunksSeen.mutationOptions({onMutate:({hunks:e,seen:t})=>i(n=>{let r=new Set(n.seenHunks);for(let n of e){let e=`${n.path}\n${n.hash}`;t?r.add(e):r.delete(e)}return{...n,seenHunks:[...r]}}),onError:CF(`Marquage du hunk impossible`)})),markThreadsRead:hv(t.pr.markThreadsRead.mutationOptions()),visit:hv(t.pr.visit.mutationOptions()),reply:hv(t.pr.reply.mutationOptions({onSuccess:(e,{threadId:t,pendingReviewId:n})=>s(r=>({...r,threads:r.threads.map(n=>n.id===t?{...n,comments:[...n.comments,e],lastReadCommentId:e.id}:n),pendingReview:e.pending&&n?c(r,n,1):r.pendingReview})),onError:CF(`Réponse non envoyée`)})),setResolved:hv(t.pr.setResolved.mutationOptions({onMutate:({threadId:e,resolved:t})=>i(n=>({...n,threads:n.threads.map(n=>n.id===e?{...n,isResolved:t}:n)})),onSettled:o,onError:CF(`Changement de statut impossible`)})),addThread:hv(t.pr.addThread.mutationOptions({onSuccess:({thread:e,pendingReviewId:t})=>s(n=>({...n,threads:[...n.threads,e],pendingReview:t?c(n,t,1):n.pendingReview})),onError:CF(`Commentaire non envoyé`)})),submitReview:hv(t.pr.submitReview.mutationOptions({onSuccess:()=>{ng.show({color:`green`,message:`Review envoyée.`}),o()},onError:CF(`Review non envoyée`)})),discardReview:hv(t.pr.discardReview.mutationOptions({onSuccess:o,onError:CF(`Abandon impossible`)})),comment:hv(t.pr.comment.mutationOptions({onSuccess:e=>s(t=>({...t,timeline:[...t.timeline,e]})),onError:CF(`Commentaire non envoyé`)})),deleteComment:hv(t.pr.deleteComment.mutationOptions({onSuccess:o,onError:CF(`Suppression impossible`)})),updateComment:hv(t.pr.updateComment.mutationOptions({onSuccess:o,onError:CF(`Modification impossible`)})),applySuggestion:hv(t.pr.applySuggestion.mutationOptions({onSuccess:e=>{ng.show({color:`green`,message:`Suggestion appliquée (commit ${e.slice(0,7)}).`}),o()},onError:CF(`Suggestion non appliquée`)}))}}function TF(e,t,n){let r=e.comments.at(-1);return e.isResolved||!r||r.author?.login===t?!1:n===t||e.comments.some(e=>e.author?.login===t)}function EF(){let e=SF(),t=wF(e.ref),[n,r]=(0,C.useState)(`open`),i=e.me,a=e.detail.pr.author?.login,o=e.detail.threads,s={open:o.filter(e=>!e.isResolved).length,mine:o.filter(e=>TF(e,i,a)).length,unread:o.filter(e=>e.unread>0).length,all:o.length},c=o.filter(e=>n===`open`?!e.isResolved:n===`mine`?TF(e,i,a):n!==`unread`||e.unread>0);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{padding:`10px 12px`,borderBottom:`1px solid var(--br-border)`,position:`sticky`,top:0,background:`var(--br-bg)`,zIndex:1},children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,mb:6,children:[o.length,` threads · `,e.detail.timeline.length,` messages généraux`]}),(0,W.jsx)(Qm,{size:`xs`,fullWidth:!0,value:n,onChange:e=>r(e),data:[{value:`open`,label:`Ouverts ${s.open}`},{value:`mine`,label:`Ma réponse ${s.mine}`},{value:`unread`,label:`Non lus ${s.unread}`},{value:`all`,label:`Tous ${s.all}`}]})]}),c.map(t=>{let n=t.comments.at(-1);return(0,W.jsxs)(`div`,{className:`conv-item`,"data-state":t.pending?`pending`:t.isResolved?`resolved`:`open`,"data-current":e.focusedThread===t.id||void 0,onClick:()=>e.scrollToThread(t.id),children:[(0,W.jsxs)(ql,{gap:6,wrap:`nowrap`,children:[t.pending?(0,W.jsx)(Uf,{size:`sm`,color:`grape`,variant:`filled`,children:`En attente`}):t.isResolved?(0,W.jsx)(Uf,{size:`sm`,color:`green`,variant:`filled`,children:`✓ Résolu`}):(0,W.jsx)(Uf,{size:`sm`,color:`yellow`,variant:`filled`,autoContrast:!0,children:`● Non résolu`}),(0,W.jsxs)(Z,{size:`xs`,ff:`monospace`,c:`dimmed`,truncate:!0,style:{flex:1},children:[t.path,t.subjectType===`FILE`?` · fichier`:t.line===null?``:`:${t.line}`,t.isOutdated?` · outdated`:``]}),t.unread>0&&(0,W.jsxs)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:[t.unread,` nouveau`,t.unread>1?`x`:``]})]}),n&&(0,W.jsxs)(Z,{size:`sm`,className:`clamp2`,my:2,children:[(0,W.jsx)(`b`,{children:n.author?.login??`ghost`}),` :`,` `,n.body.replace(/```suggestion[\s\S]*?```/g,`[suggestion]`)]}),(0,W.jsxs)(ql,{gap:4,children:[[...new Map(t.comments.map(e=>[e.author?.login,e.author])).values()].map(e=>(0,W.jsx)(Bf,{src:e?.avatarUrl,size:16},e?.login??`ghost`)),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[t.comments.length,` message`,t.comments.length>1?`s`:``,TF(t,i,a)?` · attend ma réponse`:``]})]})]},t.id)}),c.length===0&&(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,p:`md`,children:`Aucun thread pour ce filtre.`}),(0,W.jsx)(Z,{size:`xs`,tt:`uppercase`,fw:600,c:`dimmed`,px:12,pt:`md`,pb:4,children:`Conversation générale`}),(0,W.jsx)(nh,{gap:0,children:e.detail.timeline.map(e=>(0,W.jsxs)(`div`,{className:`comment`,"data-new":e.unread||void 0,children:[(0,W.jsx)(Bf,{src:e.author?.avatarUrl,size:22}),(0,W.jsxs)(`div`,{className:`comment-body`,children:[(0,W.jsxs)(ql,{gap:6,mb:2,children:[(0,W.jsx)(Z,{size:`sm`,fw:600,children:e.author?.login??`ghost`}),e.kind===`review`&&(0,W.jsxs)(Uf,{size:`xs`,variant:`light`,color:PE[e.state]?.color??`gray`,children:[`review : `,PE[e.state]?.label??e.state]}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(e.createdAt)}),e.unread&&(0,W.jsx)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:`nouveau`})]}),e.bodyHTML?(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:e.bodyHTML}}):(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:`(sans message)`})]})]},e.id))}),(0,W.jsx)(bF,{draftKey:`general:${e.ref.owner}/${e.ref.repo}#${e.ref.number}`,repoContext:`${e.ref.owner}/${e.ref.repo}`,placeholder:`Commentaire général sur la PR…`,autoFocus:!1,actions:[{label:`Commenter`,run:n=>t.comment.mutateAsync({prId:e.detail.pr.id,body:n})}]})]})}function DF(){let{pr:e}=SF().detail;return(0,W.jsxs)(`div`,{className:`panel-body`,children:[(0,W.jsxs)(ql,{gap:8,mb:`sm`,children:[(0,W.jsx)(Bf,{src:e.author?.avatarUrl,size:22}),(0,W.jsx)(Z,{size:`sm`,fw:600,children:e.author?.login??`ghost`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(e.createdAt)}),(0,W.jsx)(sf,{href:e.url,target:`_blank`,size:`xs`,c:`dimmed`,ml:`auto`,children:`modifier sur GitHub ↗`})]}),e.bodyHTML?(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:e.bodyHTML}}):(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:`Pas de description.`})]})}function OF(e){return typeof e==`object`?e.key:e}function kF(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function AF(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function jF(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var MF=(e,t)=>Math.abs(e-t)<1.01,NF=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})};function PF({offset:e,isScrolling:t,elementMax:n,holdOffset:r,scrollOffset:i,pendingWrite:a,clampedMaxAtWrite:o}){return t&&a===null&&e===i?`spurious`:a!==null&&Math.abs(e-a.target)<1.5?`readBack`:a!==null&&!a.smooth&&n!==null&&a.target>n+r+.5&&Math.abs(e-(n+r))<1.5||a!==null&&!a.smooth&&a.lowMaxes?.some(t=>Math.abs(e-t)<1.5)?`clampedReadBack`:o!==null&&Math.abs(e-o)<1.5?`clampedEcho`:`external`}var FF=e=>e===`smooth`||e===`smoothFinishing`;function IF({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!FF(n.phase)&&!MF(t,n.lastTargetOffset)&&!MF(t,r())&&e!==`clampedEcho`}var LF=40;function RF(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<LF;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<LF;)i--;if(i<0)return!1;let a=e[i],o=(t.offset-r.offset)/(t.t-r.t),s=(r.offset-a.offset)/(r.t-a.t);return o*s>=0&&Math.abs(o)>=2*Math.abs(s)&&Math.abs(o)-Math.abs(s)>=.8}function zF(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<LF;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var BF,VF=()=>{if(BF!==void 0)return BF;if(typeof navigator>`u`)return BF=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return BF=!0;let e=navigator.maxTouchPoints;return BF=navigator.platform===`MacIntel`&&e!==void 0&&e>0},HF,UF=()=>HF===void 0?HF=VF()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):HF,WF={capture:!0,passive:!0},GF=class{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!==`lateFling`,this.dragging=()=>this._touch?.phase===`down`&&this._touch.moved,this.tail=()=>this._touch?.phase===`tail`?this._touch.moved?`fling`:`tap`:null,this.onScroll=({isScrolling:e,ownReadBack:t,moved:n,external:r})=>(e&&this._touch?.phase===`tail`?this._openTail(this._touch.moved||!t,!1):this._touch?.phase===`lateFling`&&(this.host.now()>this._touch.until?this._touch=null:r&&e&&n&&this._openTail(!0,!1)),!t&&e&&n&&this._touch?.phase===`down`?(this._touch.moved=!0,!0):!1),this.touchStart=()=>{this.end(),this._touch={phase:`down`,moved:!1}},this.touchEnd=()=>{let e=this._touch?.phase===`down`&&this._touch.moved;this.end(),this._openTail(e,e)},this.end=()=>{let e=this.host.getWindow();this._touch?.phase===`tail`&&e!=null&&e.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),n=()=>this.touchEnd();return e.addEventListener(`touchstart`,t,WF),e.addEventListener(`touchend`,n,WF),e.addEventListener(`touchcancel`,n,WF),()=>{e.removeEventListener(`touchstart`,t,WF),e.removeEventListener(`touchend`,n,WF),e.removeEventListener(`touchcancel`,n,WF),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(!VF()||n==null)return;this.end();let r={phase:`tail`,moved:e,awaitingFling:t,timerId:n.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(r.moved,r.awaitingFling):(this._touch=r.awaitingFling?{phase:`lateFling`,until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=r}}get touch(){return this._touch}},KF=e=>{let{clientWidth:t,clientHeight:n}=e;return{width:t,height:n}},qF=e=>{let t=new Set;return{schedule:n=>{let r=e.requestAnimationFrame(()=>{t.delete(r),n()});t.add(r)},cancel:()=>{t.forEach(t=>e.cancelAnimationFrame(t)),t.clear()}}},JF=e=>e,YF=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},XF=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(KF(n)),!r.ResizeObserver)return()=>{};let a=qF(r),o=new r.ResizeObserver(()=>{let t=()=>{i(KF(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(t):t()});return o.observe(n,{box:`content-box`}),()=>{o.unobserve(n),a.cancel()}},ZF={passive:!0},QF=typeof window>`u`||`onscrollend`in window,$F=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&QF,o=0,s=a?null:NF(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,ZF),a&&r.addEventListener(`scrollend`,u,ZF),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},eI=(e,t)=>$F(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),tI=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},nI=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},rI=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,iI=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function aI(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var oI=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new GF({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if(e?.phase!==`queued`||this.pendingWrite!==null)return!1;let t=this._readElementOffset();return t===null||this._lastElementOffset===null||Math.abs(t-this._lastElementOffset)<1?!1:(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;e?.phase===`queued`&&zF(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=null,n=()=>{if(e)return e;let n=this.targetWindow;if(!n||!n.ResizeObserver)return null;let i=t=qF(n);return e=new n.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(r)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?i.schedule(t):t()})},r=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t?.cancel(),e=null,t=null},observe:e=>n()?.observe(e,{box:`border-box`}),unobserve:e=>n()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:JF,rangeExtractor:YF,onChange:()=>{},measureElement:tI,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>OF(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||aI(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:s}=this.options,c=0;for(;c<a&&s(c)!==e;)c++;if(c<a){let e=n[c];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(o=n-this.scrollOffset,this.scrollOffset=n)}}}i?this.pendingScrollAnchor={kind:`follow`,behavior:i}:o!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:`anchor`,delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=AF(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(e=this._momentumStop)==null||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{let n=t?this._elementMaxScrollOffset():null,r=this._reportedOverscroll;this._reportedOverscroll=e<0||n!==null&&e>n+1;let i=e;this._lastElementOffset=i,e=this._toLayoutOffset(e);let a=this._classifyScrollEvent(e,t,n);if(a===`spurious`)return;a===`readBack`?e=this.pendingWrite.target:a===`clampedReadBack`&&this.scrollState?.index!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:IF({kind:a,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let o=this.getScrollOffset(),s=this.scrollDirection;this.scrollDirection=t?o===e?this.scrollDirection:o<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t;let c=this.scrollState;if(c?.phase===`queued`&&a===`external`&&t){if(r||this._reportedOverscroll)c.samples=[];else{let e=this.now();c.samples=[...(c.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:i}],(s!==null&&this.scrollDirection!==s||RF(c.samples))&&(this.scrollState=null)}}this._iosGesture.onScroll({isScrolling:t,ownReadBack:a===`readBack`,moved:e!==o,external:a===`external`&&this.scrollState?.phase!==`smooth`&&this.scrollState?.phase!==`smoothFinishing`})&&this.scrollState?.phase===`queued`&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled&&(t.kind===`anchor`?this._canWriteScroll()?iI(this.scrollState)&&!MF(this.getScrollOffset()-t.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(t.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=t.delta,this._followOffsetTarget(t.delta),this.notify(!1)):this.scrollToEnd({behavior:t.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,n)=>PF({offset:e,isScrolling:t,elementMax:n,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:this._clampedAdjustment?.maxAtWrite??null}),this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(e===null||e.phase!==`queued`)return;let{behavior:t}=e;this.getMeasurements();let n=this.getScrollStateTarget(e);e.lastTargetOffset=n,this._clampedAdjustment=null,e.phase=rI(t,e.index!=null&&MF(n,this.getScrollOffset())),this._scrollToOffset(n,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(e==null)return null;let{horizontal:t,isRtl:n}=this.options;return typeof e.scrollTop==`number`?t?e.scrollLeft*(n&&-1||1):e.scrollTop:typeof e.scrollY==`number`?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(VF()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||this.scrollState?.phase===`smooth`)return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let t=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(t),this._scrollToOffset(t)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=AF(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=AF(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=kF(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=AF(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=lI(e,t,n,r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=AF(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!iI(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!iI(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this._getLayoutTotalSize():0,u=this.getScrollOffset(),d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!iI(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=!1;if(this._awaitingCommandReadBack()||(o?p=this.applyScrollAdjustment(this._getLayoutTotalSize()-l):f&&(p=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=p);return}this.notify(p),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=AF(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,n)=>{let r=[];for(let i=0,a=e.length;i<a;i++){let a=t[e[i]];r.push(n===0?a:{...a,start:a.start-n,end:a.end-n})}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return jF(t[sI(0,t.length-1,r?e=>n[e*2]:e=>jF(t[e]).start,e)])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(e===null)return;let t=this.pendingWrite,n=Math.max(e,0)+this._holdOffset;if(n>=t.target)return;let r=t.lowMaxes??=[];r[r.length-1]!==n&&r.push(n)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{let t=e+this._holdOffset;return this.pendingScrollAnchor?.kind===`anchor`&&(t+=this.pendingScrollAnchor.delta),t},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(e===null)return null;if(`scrollHeight`in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if(`document`in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,n=this.targetWindow;if(t===null||n===null)return;let r=`document`in t?t.document.scrollingElement:t;if(!r?.style)return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:i}=r,a=this.options.horizontal?`overflow-x`:`overflow-y`,o=i.getPropertyValue(a),s=i.getPropertyPriority(a);i.setProperty(a,`hidden`,`important`);let c={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=c,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===c&&(this._momentumStop=null,c.restore()&&c.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(t===null)return null;let n=t+this._holdOffset;return e>n+.5?{target:e,maxAtWrite:n}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),n,`absolute`)},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r;this._startScroll({index:e,align:a},i,n,`absolute`)},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,`start`);this._startScroll({index:null,align:`start`},n,t,`relative`)},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:`end`,toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,`absolute`):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n}={})=>{let r={target:e+(t??0),smooth:n===`smooth`};return this.pendingWrite=r,this.options.scrollToFn(e-this._holdOffset,{behavior:n,adjustments:t},this),r},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(VF()&&this._iosGesture.dragging())&&e!==null&&!MF(e,this.getScrollOffset())},this._followOffsetTarget=e=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(e===0)return!1;if(this._followOffsetTarget(e),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+e);let r=this._scrollToOffset(n,{adjustments:e,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}return this._holdOffset+=e,this.scrollOffset!==null&&(this.scrollOffset+=e),!0}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase===`queued`){this.scheduleScrollReconcile();return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&MF(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=iI(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&&UF()){this._stopMomentum(()=>{this.scrollState?.phase!==`queued`||this._iosGesture.tail()!==`fling`||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:`queued`,behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:rI(n,e.index!=null&&MF(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},sI=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function cI(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function lI(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=cI(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=sI(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var uI=typeof document<`u`?C.useLayoutEffect:C.useEffect;function dI({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=C.useReducer(e=>e+1,0)[1],a=C.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=C.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,xt.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=C.useState(()=>{let e=new oI(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),uI(()=>d._didMount(),[]),uI(()=>(s(d),d._willUpdate())),uI(()=>{l(d)}),d}function fI(e){return dI({observeElementRect:XF,observeElementOffset:eI,scrollToFn:nI,...e})}function pI(e){return e.slice(e.lastIndexOf(`/`)+1)}var mI=class{#e=new Map;#t=new Map;#n=[];constructor(e){let t=new Map;for(let n of e){let{id:e,extensions:r,filenames:i=[]}=n.info;if(this.#e.has(e))throw Error(`Langage déclaré deux fois : ${e}`);this.#e.set(e,n);for(let e of i)hI(this.#t,e.toLowerCase(),n);for(let e of r)hI(t,e.toLowerCase(),n)}this.#n=[...t].sort(([e],[t])=>t.length-e.length)}all(){return[...this.#e.values()]}byId(e){return this.#e.get(e)}detect(e){let t=pI(e).toLowerCase(),n=this.#t.get(t);if(n!==void 0)return n;for(let[e,n]of this.#n)if(t.length>e.length&&t.endsWith(e))return n;return null}};function hI(e,t,n){let r=e.get(t);if(r!==void 0&&r!==n)throw Error(`« ${t} » revendiqué par ${r.info.id} et ${n.info.id}`);e.set(t,n)}var gI={id:`css`,label:`CSS`,extensions:[`.css`]},_I={id:`scss`,label:`SCSS`,extensions:[`.scss`]},vI={id:`sass`,label:`Sass`,extensions:[`.sass`]},yI={id:`less`,label:`Less`,extensions:[`.less`]},bI=`modulepreload`,xI=function(e){return`/`+e},SI={},CI=function(e){return e.pathname.endsWith(`.css`)},wI=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},TI=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=xI(t,n);let r=s(t),i=CI(r);return wI(SI,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:bI,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},EI={info:gI,grammars:{css:()=>TI(()=>import(`./css-DgaLhXQH.js`),__vite__mapDeps([0,1]))},grammarFor:()=>`css`},DI={info:_I,grammars:{scss:()=>TI(()=>import(`./scss-8bKmll0B.js`),__vite__mapDeps([2,1]))},grammarFor:()=>`scss`},OI={info:vI,grammars:{sass:()=>TI(()=>import(`./sass-DXrisJhu.js`),[])},grammarFor:()=>`sass`},kI={info:yI,grammars:{less:()=>TI(()=>import(`./less-DVTAwKKz.js`),[])},grammarFor:()=>`less`},AI={info:{id:`html`,label:`HTML`,extensions:[`.html`,`.htm`]},grammars:{html:()=>TI(()=>import(`./html-BHZv6uqE.js`),__vite__mapDeps([3,1,4]))},grammarFor:()=>`html`},jI={id:`json`,label:`JSON`,extensions:[`.json`,`.jsonc`],filenames:[`.babelrc`,`.eslintrc`,`.prettierrc`,`.swcrc`]},MI=new Set([`.babelrc`,`.eslintrc`,`.swcrc`]);function NI(e){let t=pI(e).toLowerCase();return t.endsWith(`.jsonc`)||MI.has(t)||(t.startsWith(`tsconfig.`)||t.startsWith(`jsconfig.`))&&t.endsWith(`.json`)?!0:t.endsWith(`.json`)&&(e.startsWith(`.vscode/`)||e.includes(`/.vscode/`))}var PI={info:jI,grammars:{json:()=>TI(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>TI(()=>import(`./jsonc-CYpm1nAK.js`),[])},grammarFor:e=>NI(e)?`jsonc`:`json`},FI={info:{id:`markdown`,label:`MD`,extensions:[`.md`,`.markdown`]},grammars:{markdown:()=>TI(()=>import(`./markdown-BYOwaDjH.js`),[])},grammarFor:()=>`markdown`},II={info:{id:`text`,label:`TXT`,extensions:[`.txt`]},grammars:{},grammarFor:()=>null},LI={id:`typescript`,label:`TS`,extensions:[`.ts`,`.tsx`,`.mts`,`.cts`]},RI={id:`javascript`,label:`JS`,extensions:[`.js`,`.jsx`,`.mjs`,`.cjs`]},zI=e=>e.toLowerCase(),BI=new mI([{info:LI,grammars:{typescript:()=>TI(()=>import(`./typescript-bsJCZSQ-.js`),[]),tsx:()=>TI(()=>import(`./tsx-udAQXfEw.js`),[])},grammarFor:e=>zI(e).endsWith(`.tsx`)?`tsx`:`typescript`},{info:RI,grammars:{javascript:()=>TI(()=>import(`./javascript-CpIGwZ_Y.js`),__vite__mapDeps([5,4])),jsx:()=>TI(()=>import(`./jsx-Bz0zcwM4.js`),[])},grammarFor:e=>zI(e).endsWith(`.jsx`)?`jsx`:`javascript`},AI,EI,DI,OI,kI,FI,PI,II]);new Map(BI.all().flatMap(e=>Object.entries(e.grammars)));function VI(e){return BI.detect(e)?.grammarFor(e)??null}function HI(e){return BI.byId(e)?.info.label??e}function UI(e){return typeof e==`object`&&!!e&&`content`in e&&typeof e.content==`string`&&`color`in e&&(e.color===void 0||typeof e.color==`string`)&&`fontStyle`in e&&typeof e.fontStyle==`number`}function WI(e){return Array.isArray(e)&&e.every(e=>Array.isArray(e)&&e.every(UI))}function GI(e){return typeof e!=`object`||!e||!(`id`in e)||typeof e.id!=`number`?!1:`ok`in e&&e.ok===!0?`tokens`in e&&WI(e.tokens):`ok`in e&&e.ok===!1&&`error`in e&&typeof e.error==`string`}var KI=200,qI,JI=!1,YI=!1,XI=0,ZI=new Map;function QI(...e){YI||(YI=!0,console.warn(`[highlight]`,...e))}function $I(e){QI(`syntax highlighting disabled:`,e),JI=!0,qI?.terminate(),qI=void 0;let t=Error(`highlight worker unavailable`);for(let e of ZI.values())e.reject(t);ZI.clear()}function eL(){if(qI)return qI;let e=new Worker(new URL(`/assets/highlight.worker-BOqhB448.js`,``+import.meta.url),{type:`module`});return e.addEventListener(`message`,e=>{let t=e.data;if(!GI(t)){$I(Error(`malformed worker message`));return}let n=ZI.get(t.id);n&&(ZI.delete(t.id),t.ok?n.resolve(t.tokens):n.reject(Error(t.error)))}),e.addEventListener(`error`,e=>$I(e.message||`worker error`)),e.addEventListener(`messageerror`,()=>$I(Error(`undeserializable worker message`))),qI=e,e}async function tL(e,t){if(JI)throw Error(`highlight worker unavailable`);let n=XI++,r=Promise.withResolvers();return ZI.set(n,r),eL().postMessage({id:n,lang:e,lines:t}),r.promise}var nL=new Map,rL=new WeakMap;function iL(e){if(nL.delete(e.key),nL.set(e.key,e),!(nL.size<=KI))for(let[e,t]of nL){if(nL.size<=KI)break;t.listeners.size===0&&t.state!==`pending`&&nL.delete(e)}}function aL(e){e.state=`pending`;let t=t=>{e.tokens=t,e.state=`settled`;for(let t of e.listeners)t()};tL(e.lang,e.lines).then(t,e=>{QI(`highlighting failed:`,e),t(null)})}function oL(e,t,n){let r={key:e,lang:t,lines:n,tokens:null,state:`idle`,listeners:new Set,subscribe:e=>(r.listeners.add(e),iL(r),r.state===`idle`&&aL(r),()=>r.listeners.delete(e)),getSnapshot:()=>r.tokens};return r}function sL(e){let t=3735928559,n=1103547991,r=0;for(let i of e){if(r+=i.length+1,i.length>2e3||r>3e5)return null;for(let e=0;e<i.length;e++){let r=i.charCodeAt(e);t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677)}t=Math.imul(t^10,2654435761),n=Math.imul(n^10,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}function cL(e,t){let n=rL.get(t);n||(n=new Map,rL.set(t,n));let r=n.get(e);if(r!==void 0)return r;let i=VI(e),a=i===null?null:sL(t),o=null;if(i!==null&&a!==null){let n=`${i}\0${e}\0${t.length}\0${a}`;o=nL.get(n)??oL(n,i,t)}return n.set(e,o),o}var lL=()=>()=>{},uL=()=>null;function dL(e,t){let n=t===null?null:cL(e,t);return(0,C.useSyncExternalStore)(n?.subscribe??lL,n?.getSnapshot??uL)}function fL(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.type===`context`){t.push({left:r,right:r}),n++;continue}let i=[],a=[];for(;n<e.length&&e[n].type===`del`;)i.push(e[n++]);for(;n<e.length&&e[n].type===`add`;)a.push(e[n++]);for(let e=0;e<Math.max(i.length,a.length);e++)t.push({left:i[e]??null,right:a[e]??null})}return t}function pL(e,t,n){return`${t}:${n}:${e}`}function mL(e){let t=[],n=[],r=[],i=new Map,a=new Map,o=new Map;for(let t of e.threads){let e=o.get(t.path)??[];e.push(t),o.set(t.path,e)}let s=new Set,c=new Set(e.files.map(e=>e.path));for(let t of e.threads)if(t.line!==null&&t.subjectType===`LINE`&&e.anchorable(t.side)){let e=pL(t.path,t.side,t.line);a.set(e,[...a.get(e)??[],t.id])}let l=(e,n,r)=>{let a=n.filter(e=>!s.has(e));if(a.length!==0){for(let e of a)s.add(e),i.set(e,t.length);t.push({kind:`threads`,key:r,fileIdx:e,threadIds:a})}};if(e.files.forEach((c,u)=>{if(e.onlyFile!==null&&c.path!==e.onlyFile||(n[u]=t.length,t.push({kind:`file`,key:`f:${c.path}`,fileIdx:u}),e.collapsed.has(c.path)))return;let d=o.get(c.path)??[],f=d.filter(e=>e.subjectType===`FILE`).map(e=>e.id);l(u,f,`tf:${c.path}`),e.fileComposer===c.path&&t.push({kind:`composer`,key:`cf:${c.path}`,fileIdx:u,target:`file`}),c.binary?t.push({kind:`notice`,key:`n:${c.path}`,fileIdx:u,text:`Fichier binaire.`}):c.truncated?t.push({kind:`notice`,key:`n:${c.path}`,fileIdx:u,text:`Diff trop volumineux pour l’API GitHub : contenu à consulter sur GitHub.`}):c.hunks.length===0&&t.push({kind:`notice`,key:`n:${c.path}`,fileIdx:u,text:c.status===`renamed`?`Renommé sans modification.`:`Aucun changement de contenu (mode / fichier vide).`});let p=(t,n)=>e.composer!==null&&e.composer.path===c.path&&e.composer.side===t&&e.composer.end===n;c.hunks.forEach((n,i)=>{r.push({row:t.length,fileIdx:u,hunkIdx:i}),t.push({kind:`hunk`,key:`h:${c.path}:${i}`,fileIdx:u,hunkIdx:i});let o=(e,n,r)=>{let i=[],o=!1;n?.newNo!=null&&(i.push(...a.get(pL(c.path,`RIGHT`,n.newNo))??[]),o||=p(`RIGHT`,n.newNo)),e?.oldNo!=null&&(i.push(...a.get(pL(c.path,`LEFT`,e.oldNo))??[]),o||=p(`LEFT`,e.oldNo)),l(u,i,`t:${r}`),o&&t.push({kind:`composer`,key:`c:${r}`,fileIdx:u,target:`line`})};if(e.layout===`split`&&c.status!==`added`&&c.status!==`deleted`)for(let e of fL(n.lines)){let n=`${c.path}:${e.left?.oldNo??`-`}:${e.right?.newNo??`-`}`;t.push({kind:`split`,key:`s:${n}`,fileIdx:u,hunkIdx:i,left:e.left,right:e.right}),o(e.left,e.right,n)}else for(let e of n.lines){let n=`${c.path}:${e.oldNo??`-`}:${e.newNo??`-`}`;t.push({kind:`line`,key:`l:${n}`,fileIdx:u,hunkIdx:i,line:e}),o(e.type===`add`?null:e,e.type===`del`?null:e,n)}});let m=d.filter(e=>!s.has(e.id)).map(e=>e.id);if(m.length>0){for(let e of m)s.add(e),i.set(e,t.length);t.push({kind:`orphans`,key:`o:${c.path}`,fileIdx:u,threadIds:m,title:`Threads outdated ou hors de la plage affichée`})}}),e.onlyFile===null){let n=e.threads.filter(e=>!c.has(e.path)&&!s.has(e.id)).map(e=>e.id);if(n.length>0){for(let e of n)i.set(e,t.length);t.push({kind:`orphans`,key:`o:outside`,fileIdx:null,threadIds:n,title:`Threads sur des fichiers hors de la plage affichée`})}}return{rows:t,fileRow:n,hunkRows:r,threadRow:i}}function hL(e){let t=[],n=/```suggestion[^\n]*\n([\s\S]*?)```/g;for(let r=n.exec(e);r;r=n.exec(e))t.push(r[1]??``);return t}function gL(e,t){let n={lines:[],index:new Map};for(let r of e.hunks)for(let e of r.lines){let r=e[t];r!==null&&(n.index.set(r,n.lines.length),n.lines.push(e.content))}return n}function _L(e,t,n){if(n==null||n.length>3e5)return gL(e,t);let r=n.split(`
|
|
110
|
+
`);if(r.some(e=>e.length>2e3))return gL(e,t);let i=new Map;for(let n of e.hunks)for(let a of n.lines){let n=a[t];if(n!==null){if(r[n-1]!==a.content)return gL(e,t);i.set(n,n-1)}}return{lines:r,index:i}}function vL({diffHunk:e}){let t=e.split(`
|
|
111
|
+
`).slice(1).slice(-8);return(0,W.jsx)(`div`,{className:`snippet`,children:t.map((e,t)=>(0,W.jsx)(`div`,{className:e.startsWith(`+`)?`c-add`:e.startsWith(`-`)?`c-del`:void 0,children:e||` `},t))})}function yL({thread:e,showPath:t=!1}){let n=SF(),r=wF(n.ref),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=n.focusedThread===e.id,c=e.comments.at(-1),l=e.lastReadCommentId?e.comments.findIndex(t=>t.id===e.lastReadCommentId):-1,u=(e,t)=>t>l&&e.author?.login!==n.me,d=r.markThreadsRead.mutate,f=c?.id;(0,C.useEffect)(()=>{let t=o.current;if(!t||!f||e.lastReadCommentId===f)return;let n,r=new IntersectionObserver(([t])=>{clearTimeout(n),t?.isIntersecting&&(n=setTimeout(()=>{d([{threadId:e.id,lastCommentId:f}]),r.disconnect()},1200))});return r.observe(t),()=>{clearTimeout(n),r.disconnect()}},[f,e.id,e.lastReadCommentId,d]);let p=n.detail.canWrite&&n.detail.pr.sameRepo&&n.detail.pr.state===`OPEN`&&!e.isOutdated&&e.side===`RIGHT`&&e.line!==null,m=n.pendingReviewId,h=e.subjectType===`FILE`?`commentaire sur le fichier`:e.isOutdated?`ligne ${e.originalLine??`?`} (version d’origine)`:e.startLine!==null&&e.startLine!==e.line?`lignes ${e.startLine}–${e.line}`:`ligne ${e.line}`,g=e.pending?`pending`:e.isResolved?`resolved`:`open`,_=e.isResolved?e.canUnresolve:e.canResolve;return(0,W.jsxs)(`div`,{ref:o,className:`thread`,"data-thread":e.id,"data-state":g,"data-unread":e.unread>0||void 0,"data-focus":s||void 0,onClick:()=>n.setFocusedThread(e.id),children:[(0,W.jsxs)(`div`,{className:`thread-head`,children:[g===`pending`?(0,W.jsx)(Uf,{size:`md`,color:`grape`,variant:`filled`,children:`En attente · review non soumise`}):g===`resolved`?(0,W.jsxs)(Uf,{size:`md`,color:`green`,variant:`filled`,children:[`✓ Résolu`,e.resolvedBy?` par ${e.resolvedBy}`:``]}):(0,W.jsx)(Uf,{size:`md`,color:`yellow`,variant:`filled`,autoContrast:!0,children:`● Non résolu`}),e.isOutdated&&(0,W.jsx)(Uf,{size:`sm`,color:`gray`,variant:`outline`,children:`outdated`}),e.unread>0&&(0,W.jsxs)(Uf,{size:`sm`,color:`orange`,variant:`light`,children:[e.unread,` nouveau`,e.unread>1?`x`:``]}),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,truncate:!0,children:[t?`${e.path} · `:``,h,e.subjectType===`LINE`?` · ${e.side===`LEFT`?`ancien code`:`nouveau code`}`:``]}),(0,W.jsx)(`div`,{style:{flex:1}}),e.comments[0]&&(0,W.jsx)(sf,{href:e.comments[0].url,target:`_blank`,size:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`,flex:`none`},children:`GitHub ↗`})]}),(e.isOutdated||e.line===null)&&e.diffHunk&&(0,W.jsx)(vL,{diffHunk:e.diffHunk}),e.comments.map((t,i)=>(0,W.jsxs)(`div`,{className:`comment`,"data-new":u(t,i)||void 0,children:[(0,W.jsx)(Bf,{src:t.author?.avatarUrl,size:24}),(0,W.jsxs)(`div`,{className:`comment-body`,children:[(0,W.jsxs)(ql,{gap:6,mb:2,children:[(0,W.jsx)(Z,{size:`sm`,fw:600,children:t.author?.login??`ghost`}),(0,W.jsx)(Jm,{label:new Date(t.createdAt).toLocaleString(`fr`),children:(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(t.createdAt)})}),u(t,i)&&(0,W.jsx)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:`nouveau`}),t.pending&&(0,W.jsx)(Uf,{size:`xs`,color:`yellow`,variant:`light`,children:`en attente`}),t.pending&&t.canDelete&&(0,W.jsx)(Qf,{size:`compact-xs`,variant:`subtle`,color:`red`,ml:`auto`,onClick:()=>r.deleteComment.mutate({commentId:t.id}),children:`Supprimer`})]}),(0,W.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:t.bodyHTML}}),p&&!t.pending&&hL(t.body).map((i,a)=>(0,W.jsx)(Qf,{mt:6,size:`compact-xs`,color:`green`,variant:`light`,loading:r.applySuggestion.isPending,onClick:()=>r.applySuggestion.mutate({ref:n.ref,branch:n.detail.pr.headRefName,expectedHeadOid:n.detail.pr.headRefOid,path:e.path,side:`RIGHT`,startLine:e.startLine??e.line,endLine:e.line,replacement:i,message:`Apply suggestion from @${t.author?.login??`reviewer`}\n\n${t.url}`}),children:`Appliquer la suggestion (commit)`},a))]})]},t.id)),i&&e.canReply?(0,W.jsx)(bF,{draftKey:`reply:${e.id}`,repoContext:`${n.ref.owner}/${n.ref.repo}`,onCancel:()=>a(!1),placeholder:`Répondre…`,actions:[...e.canResolve&&!e.isResolved&&!m?[{label:`Répondre & résoudre`,variant:`default`,run:async t=>{await r.reply.mutateAsync({threadId:e.id,body:t,pendingReviewId:null}),await r.setResolved.mutateAsync({threadId:e.id,resolved:!0})}}]:[],{label:m?`Ajouter à la review`:`Répondre`,run:t=>r.reply.mutateAsync({threadId:e.id,body:t,pendingReviewId:m})}]}):(e.canReply||_)&&(0,W.jsxs)(ql,{className:`thread-foot`,p:8,gap:8,children:[e.canReply&&(0,W.jsx)(Qf,{"data-reply":!0,variant:`default`,size:`compact-sm`,style:{flex:1,justifyContent:`flex-start`},styles:{inner:{justifyContent:`flex-start`}},onClick:()=>a(!0),children:(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:`Répondre…`})}),_&&(0,W.jsx)(Qf,{size:`compact-sm`,ml:`auto`,color:e.isResolved?`yellow`:`green`,variant:e.isResolved?`light`:`filled`,onClick:t=>{t.stopPropagation(),r.setResolved.mutate({threadId:e.id,resolved:!e.isResolved})},children:e.isResolved?`Rouvrir la conversation`:`✓ Résoudre la conversation`})]})]})}var bL=new WeakMap;function xL(e){let t=SF(),n=TE(),r=[e.oldBlob,e.newBlob].filter(e=>e!==null),i=fv({...n.pr.blobs.queryOptions({ref:t.ref,oids:r}),staleTime:1/0,enabled:r.length>0&&!e.binary});if(i.isPending&&r.length>0&&!e.binary)return{old:null,new:null};let a=bL.get(e);if(a&&a.data===i.data)return a.sources;let o=e=>e===null?null:i.data?.[e],s={old:_L(e,`oldNo`,o(e.oldBlob)),new:_L(e,`newNo`,o(e.newBlob))};return bL.set(e,{data:i.data,sources:s}),s}var SL={file:52,hunk:28,split:20,line:20,threads:160,composer:230,notice:36,orphans:200};function CL(e,t,n){let r=e.hunks.filter(t=>n.has(`${e.path}\n${t.hash}`)).length;return{state:t===`VIEWED`?`viewed`:t===`DISMISSED`?`dismissed`:r>0?`partial`:`none`,seenHunks:r}}function wL(e){let t=SF();return CL(e,t.detail.files.find(t=>t.path===e.path)?.viewed,t.seenHunks)}var TL=40;function EL(){let e=SF(),t=wF(e.ref),n=(e,t)=>t.map(t=>({path:e.path,hash:t.hash}));return{toggleFile:(r,i)=>{t.setFileViewed.mutate({prId:e.detail.pr.id,path:r.path,viewed:i}),r.hunks.length>0&&t.setHunksSeen.mutate({ref:e.ref,hunks:n(r,r.hunks),seen:i})},toggleHunk:(r,i,a)=>{t.setHunksSeen.mutate({ref:e.ref,hunks:n(r,[i]),seen:a});let o=r.hunks.filter(e=>e!==i),s=a&&o.every(t=>e.seenHunks.has(`${r.path}\n${t.hash}`)),c=e.detail.files.find(e=>e.path===r.path)?.viewed;e.range.fullPr&&s&&c!==`VIEWED`?t.setFileViewed.mutate({prId:e.detail.pr.id,path:r.path,viewed:!0}):!a&&c===`VIEWED`&&t.setFileViewed.mutate({prId:e.detail.pr.id,path:r.path,viewed:!1})}}}function DL({state:e}){return(0,W.jsx)(`span`,{className:`vbox`,"data-state":e,children:e===`viewed`?`✓`:e===`dismissed`?`•`:``})}var OL={added:{label:`ajouté`,color:`green`},deleted:{label:`supprimé`,color:`red`},renamed:{label:`renommé`,color:`blue`},modified:null};function kL(e){let{file:t}=e,n=SF(),r=EL(),{state:i,seenHunks:a}=wL(t),o=n.detail.threads.filter(e=>e.path===t.path),s=o.filter(e=>!e.isResolved).length,c=OL[t.status];return(0,W.jsxs)(`div`,{className:`file-head`,"data-viewed":i===`viewed`||void 0,children:[(0,W.jsx)(Ll,{size:`sm`,variant:`subtle`,color:`gray`,onClick:e.onToggleCollapse,"aria-label":`Replier`,children:e.collapsed?`▸`:`▾`}),(0,W.jsx)(Jm,{label:t.status===`renamed`?`${t.oldPath} → ${t.path}`:t.path,openDelay:400,children:(0,W.jsxs)(`span`,{className:`file-path`,children:[t.status===`renamed`&&(0,W.jsxs)(Z,{span:!0,c:`dimmed`,inherit:!0,children:[t.oldPath,` →`,` `]}),t.path]})}),c&&(0,W.jsx)(Uf,{size:`xs`,variant:`light`,color:c.color,children:c.label}),i===`dismissed`&&(0,W.jsx)(Uf,{size:`xs`,variant:`light`,color:`orange`,children:`modifié depuis vu`}),(0,W.jsxs)(Z,{size:`xs`,span:!0,children:[(0,W.jsxs)(Z,{span:!0,c:`green.4`,inherit:!0,children:[`+`,t.additions]}),` `,(0,W.jsxs)(Z,{span:!0,c:`red.4`,inherit:!0,children:[`−`,t.deletions]})]}),t.hunks.length>1&&(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[a,`/`,t.hunks.length,` hunks vus`]}),o.length>0&&(0,W.jsxs)(Z,{size:`xs`,c:s>0?`yellow.4`:`dimmed`,children:[(0,W.jsx)(`i`,{className:`ico-c`}),s,`/`,o.length]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(sf,{size:`xs`,c:`dimmed`,target:`_blank`,href:`https://github.com/${n.ref.owner}/${n.ref.repo}/blob/${n.detail.pr.headRefOid}/${t.path}`,children:`fichier ↗`}),n.detail.pr.state===`OPEN`&&(0,W.jsx)(Jm,{label:`Commenter le fichier entier`,openDelay:300,children:(0,W.jsx)(Qf,{size:`compact-xs`,variant:`subtle`,color:`gray`,leftSection:(0,W.jsx)(`i`,{className:`ico-c`}),onClick:()=>{e.collapsed&&e.onToggleCollapse(),n.setFileComposer(t.path)},children:`Commenter`})}),(0,W.jsx)(Qf,{size:`compact-xs`,variant:i===`viewed`?`light`:`default`,color:i===`viewed`?`green`:`gray`,leftSection:(0,W.jsx)(DL,{state:i}),onClick:()=>{let e=i!==`viewed`;r.toggleFile(t,e),e&&n.advanceFrom(t.path)},children:`Vu`})]})}function AL({tokens:e,text:t}){return e?(0,W.jsx)(W.Fragment,{children:e.map((e,t)=>(0,W.jsx)(`span`,{style:{color:e.color,fontStyle:e.fontStyle&1?`italic`:void 0,fontWeight:e.fontStyle&2?600:void 0},children:e.content},t))}):(0,W.jsx)(W.Fragment,{children:t})}var jL={add:`c-add`,del:`c-del`,context:``},ML=(0,C.memo)(function(e){let{row:t,file:n}=e,r=SF(),i=xL(n),a=dL(n.path,i.old?.lines??null),o=dL(n.path,i.new?.lines??null),s=r.selection,c=(e,t)=>t!==null&&s!==null&&s.path===n.path&&s.side===e&&t>=s.start&&t<=s.end,l=(e,t)=>{if(t===`LEFT`){let t=e.oldNo===null?void 0:i.old?.index.get(e.oldNo);return t===void 0?void 0:a?.[t]}let n=e.newNo===null?void 0:i.new?.index.get(e.newNo);return n===void 0?void 0:o?.[n]},u=(e,t,i)=>{t!==null&&r.canComment(e)&&(i.shiftKey&&s&&s.path===n.path&&s.side===e?r.setSelection({...s,start:Math.min(s.start,t),end:Math.max(s.end,t)}):r.setSelection({path:n.path,side:e,start:t,end:t}))},d=(e,t,n)=>(0,W.jsx)(`div`,{className:`ln ${n}`,"data-disabled":!r.canComment(e)||void 0,title:r.canComment(e)?`Commenter (Maj+clic : plage)`:void 0,onClick:n=>u(e,t,n),children:t??``}),f=(e,t,n)=>(0,W.jsxs)(`div`,{className:`tx ${n}`,children:[e&&(0,W.jsx)(AL,{tokens:l(e,t),text:e.content}),e?.noNewline&&(0,W.jsx)(`span`,{className:`nonl`,children:`⏎̸ pas de fin de ligne`})]});if(t.kind===`split`){let n=t.left,r=t.right,i=n?n.type===`del`?jL.del:``:`c-empty`,a=r?r.type===`add`?jL.add:``:`c-empty`,o=c(`LEFT`,n?.oldNo??null)?` c-sel`:``,s=c(`RIGHT`,r?.newNo??null)?` c-sel`:``;return(0,W.jsx)(`div`,{className:`code${e.last?` last`:``}`,children:(0,W.jsxs)(`div`,{className:`code-row split`,"data-viewed":e.viewed||void 0,children:[d(`LEFT`,n?.oldNo??null,i+o),f(n,`LEFT`,i+o),d(`RIGHT`,r?.newNo??null,a+s),f(r,`RIGHT`,a+s)]})})}let p=t.line,m=jL[p.type],h=p.type===`del`?`LEFT`:`RIGHT`,g=c(h,h===`LEFT`?p.oldNo:p.newNo)?` c-sel`:``;return(0,W.jsx)(`div`,{className:`code${e.last?` last`:``}`,children:(0,W.jsxs)(`div`,{className:`code-row unified`,"data-viewed":e.viewed||void 0,children:[d(`LEFT`,p.oldNo,m+g),d(`RIGHT`,p.newNo,m+g),f(p,h,m+g)]})})});function NL(e){let t=SF(),n=EL(),r=t.seenHunks.has(`${e.file.path}\n${e.hunk.hash}`),i=e.hunk;return(0,W.jsxs)(`div`,{className:`hunk-head`,"data-current":e.current||void 0,"data-unseen":!r||void 0,children:[(0,W.jsxs)(`span`,{children:[`@@ -`,i.oldStart,`,`,i.oldLines,` +`,i.newStart,`,`,i.newLines,` @@ `,i.section]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(Qf,{size:`compact-xs`,variant:r?`light`:`subtle`,color:r?`green`:`gray`,onClick:()=>n.toggleHunk(e.file,e.hunk,!r),children:r?`✓ hunk vu`:`Marquer le hunk vu`})]})}function PL({file:e,target:t}){let n=SF(),r=wF(n.ref),i=n.selection;if(t===`line`&&!i)return null;let a,o,s=null,c;t===`file`||!i?(a=t=>({subjectType:`FILE`,path:e.path,body:t}),o=`sur le fichier`,c=()=>n.setFileComposer(null)):(a=e=>({subjectType:`LINE`,path:i.path,side:i.side,line:i.end,startLine:i.start===i.end?null:i.start,startSide:i.start===i.end?null:i.side,body:e}),o=`${i.start===i.end?`ligne ${i.end}`:`lignes ${i.start}–${i.end}`} · ${i.side===`LEFT`?`ancien code`:`nouveau code`}`,i.side===`RIGHT`&&(s=e.hunks.flatMap(e=>e.lines.filter(e=>e.newNo!==null&&e.newNo>=i.start&&e.newNo<=i.end).map(e=>e.content))),c=()=>n.setSelection(null));let l=n.pendingReviewId,u=(e,t)=>r.addThread.mutateAsync({prId:n.detail.pr.id,pendingReviewId:t===`review`?l:null,thread:a(e),mode:t});return(0,W.jsx)(`div`,{className:`diff-block`,children:(0,W.jsxs)(`div`,{className:`thread`,"data-focus":!0,children:[(0,W.jsxs)(`div`,{className:`thread-head`,children:[`Nouveau commentaire · `,o,l&&(0,W.jsx)(Uf,{size:`xs`,color:`yellow`,variant:`light`,ml:`auto`,children:`review en attente`})]}),(0,W.jsx)(bF,{draftKey:`new:${n.ref.owner}/${n.ref.repo}#${n.ref.number}`,repoContext:`${n.ref.owner}/${n.ref.repo}`,suggestionLines:s,onCancel:c,actions:[{label:`Commenter seul`,disabled:l!==null,run:e=>u(e,`single`)},{label:l?`Ajouter à la review`:`Démarrer une review`,run:e=>u(e,`review`)}]})]})})}function FL(e){let t=SF(),n=(0,C.useRef)(null),r=(0,C.useRef)({fileIdx:null,hunkIdx:null}),i=t.range.head===t.detail.pr.headRefOid,a=(0,C.useMemo)(()=>mL({files:e.files,layout:t.layout,threads:t.detail.threads,anchorable:e=>i&&(e===`RIGHT`||t.range.fullPr),collapsed:e.collapsed,composer:t.selection,fileComposer:t.fileComposer,onlyFile:e.onlyFile}),[e.files,t.layout,t.detail.threads,i,t.range.fullPr,e.collapsed,t.selection,t.fileComposer,e.onlyFile]),o=a.rows,s=fI({count:o.length,getScrollElement:()=>n.current,estimateSize:e=>SL[o[e].kind],getItemKey:e=>o[e].key,overscan:30,onChange:t=>{let n=t.getVirtualItemForOffset((t.scrollOffset??0)+TL+4),i=n?o[n.index]:void 0,s=null;if(n)for(let e=a.hunkRows.length-1;e>=0;e--){let t=a.hunkRows[e];if(t.row<=n.index&&t.fileIdx===i?.fileIdx){s=t.hunkIdx;break}}let c=i?.fileIdx??null;(c!==r.current.fileIdx||s!==r.current.hunkIdx)&&(r.current={fileIdx:c,hunkIdx:s},e.onCurrentChange(c,s))}}),c=e.onCurrentChange;(0,C.useImperativeHandle)(e.handleRef,()=>{let n=()=>s.getVirtualItemForOffset((s.scrollOffset??0)+TL+4)?.index??0,i=e=>{if(e===void 0)return;if(o[e]?.kind===`file`){s.scrollToIndex(e,{align:`start`});return}let t=s.getOffsetForIndex(e,`start`)?.[0];t!==void 0&&s.scrollToOffset(Math.max(0,t-TL))};return{scrollToFile:t=>{let n=e.files.findIndex(e=>e.path===t);i(a.fileRow[n]),n!==-1&&n!==r.current.fileIdx&&(r.current={fileIdx:n,hunkIdx:null},c(n,null))},scrollToThread:e=>{let t=a.threadRow.get(e);return t!==void 0&&(s.scrollToIndex(t,{align:`center`}),!0)},step:(e,r)=>{let s=n(),c;if(e===`file`)c=a.fileRow.filter(e=>e!==void 0);else if(e===`hunk`)c=a.hunkRows.map(e=>e.row);else{let e=new Set(t.detail.threads.filter(e=>!e.isResolved).map(e=>e.id));c=[...new Set([...a.threadRow].filter(([t])=>e.has(t)).map(([,e])=>e))].sort((e,t)=>e-t)}let l=r>0?c.find(e=>e>s):c.filter(e=>e<s).at(-1);if(i(l),e===`thread`&&l!==void 0){let e=o[l],n=e&&(e.kind===`threads`||e.kind===`orphans`)?e.threadIds.find(e=>!t.detail.threads.find(t=>t.id===e)?.isResolved):void 0;n&&t.setFocusedThread(n)}},current:()=>r.current}},[s,a,e.files,o,t,c]);let l=s.getVirtualItems(),u=s.getVirtualItemForOffset((s.scrollOffset??0)+4),d=u?o[u.index]:void 0,f=d&&d.kind!==`file`&&d.fileIdx!==null?e.files[d.fileIdx]:void 0,p=(0,C.useMemo)(()=>new Map(t.detail.threads.map(e=>[e.id,e])),[t.detail.threads]),m=(n,i)=>{let a=o[i+1],s=!a||a.kind===`file`,c=n.fileIdx===null?void 0:e.files[n.fileIdx];switch(n.kind){case`file`:return(0,W.jsx)(kL,{file:c,collapsed:e.collapsed.has(c.path),onToggleCollapse:()=>e.onToggleCollapse(c.path)});case`hunk`:return(0,W.jsx)(NL,{file:c,hunk:c.hunks[n.hunkIdx],current:r.current.fileIdx===n.fileIdx&&r.current.hunkIdx===n.hunkIdx});case`split`:case`line`:{let e=c.hunks[n.hunkIdx];return(0,W.jsx)(ML,{row:n,file:c,viewed:t.seenHunks.has(`${c.path}\n${e.hash}`),last:s})}case`threads`:return(0,W.jsx)(`div`,{className:`diff-block${s?` last`:``}`,children:n.threadIds.map(e=>{let t=p.get(e);return t?(0,W.jsx)(yL,{thread:t},e):null})});case`composer`:return(0,W.jsx)(PL,{file:c,target:n.target});case`notice`:return(0,W.jsx)(`div`,{className:`diff-block${s?` last`:``}`,children:(0,W.jsx)(Z,{size:`sm`,c:`dimmed`,children:n.text})});case`orphans`:return(0,W.jsxs)(`div`,{className:`diff-block${s?` last`:``}`,style:n.fileIdx===null?{marginTop:16,borderTop:`1px solid var(--br-border)`}:void 0,children:[(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,tt:`uppercase`,fw:600,mb:4,children:n.title}),n.threadIds.map(e=>{let t=p.get(e);return t?(0,W.jsx)(yL,{thread:t,showPath:n.fileIdx===null},e):null})]})}};return o.length===0?(0,W.jsx)(`div`,{className:`diff-scroll`,ref:n,children:(0,W.jsx)(Z,{c:`dimmed`,p:`lg`,children:`Aucun changement dans cette plage.`})}):(0,W.jsxs)(`div`,{className:`diff-scroll`,ref:n,children:[f&&(0,W.jsx)(`div`,{className:`sticky-file`,children:(0,W.jsx)(kL,{file:f,collapsed:e.collapsed.has(f.path),onToggleCollapse:()=>e.onToggleCollapse(f.path)})}),(0,W.jsx)(`div`,{className:`diff-inner`,style:{height:s.getTotalSize()+80},children:l.map(e=>(0,W.jsx)(`div`,{"data-index":e.index,ref:s.measureElement,className:`diff-row`,style:{transform:`translateY(${e.start}px)`},children:m(o[e.index],e.index)},e.key))}),(0,W.jsx)(ql,{className:`diff-end`,justify:`center`,p:`md`,children:(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[(0,W.jsx)(Bp,{size:`xs`,children:`j`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`k`}),` fichier · `,(0,W.jsx)(Bp,{size:`xs`,children:`n`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`p`}),` hunk · `,(0,W.jsx)(Bp,{size:`xs`,children:`]`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`[`}),` thread ouvert`]})})]})}var IL=e=>e.additions+e.deletions;function LL(e){let t=IL(e),n=t===0?.5:e.additions/t;return`hsl(${Math.round(n*130)} 45% 30%)`}function RL(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],additions:0,deletions:0,fileCount:0,viewedCount:0,openThreads:0}}function zL(e,t){let n=RL(``,``);for(let t of e){let e=t.path.split(`/`),r=n;for(let t of e.slice(0,-1)){let e=r.path?`${r.path}/${t}`:t,n=r.dirs.find(t=>t.path===e);n||(n=RL(t,e),r.dirs.push(n)),r=n}r.files.push({kind:`file`,name:e.at(-1),path:t.path,stat:t})}let r=(e,n)=>{let i=e;for(;!n&&i.files.length===0&&i.dirs.length===1;){let e=i.dirs[0];i={...e,name:`${i.name}/${e.name}`}}i.dirs=i.dirs.map(e=>r(e,!1)),i.additions=i.deletions=i.fileCount=i.viewedCount=i.openThreads=0;for(let e of i.dirs)i.additions+=e.additions,i.deletions+=e.deletions,i.fileCount+=e.fileCount,i.viewedCount+=e.viewedCount,i.openThreads+=e.openThreads;for(let e of i.files)i.additions+=e.stat.additions,i.deletions+=e.stat.deletions,i.fileCount+=1,i.viewedCount+=+(e.stat.state===`viewed`),i.openThreads+=e.stat.openThreads;if(t){let e=(e,t)=>e.name.localeCompare(t.name),n=(t,n)=>IL(n.kind===`dir`?n:n.stat)-IL(t.kind===`dir`?t:t.stat)||e(t,n);i.dirs.sort(t===`churn`?n:e),i.files.sort(t===`churn`?n:e)}return i};return r(n,!0)}function BL(e,t){let n=[],r=(e,i)=>{for(let a of e.dirs)n.push({...a,depth:i}),t.has(a.path)||r(a,i+1);for(let t of e.files)n.push({...t,depth:i})};return r(e,0),n}function VL(e,t,n){return t===`list`?n===`name`?e.map(e=>e.path):[...e].sort((e,t)=>IL(t)-IL(e)||e.path.localeCompare(t.path)).map(e=>e.path):BL(zL(e.map(e=>({...e,state:`none`,openThreads:0,unreadThreads:0})),n),new Set).flatMap(e=>e.kind===`file`?[e.path]:[])}var HL=Object.defineProperty,UL=(e,t,n)=>t in e?HL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WL=(e,t)=>{for(var n in t)HL(e,n,{get:t[n],enumerable:!0})},GL=(e,t,n)=>UL(e,typeof t==`symbol`?t:t+``,n),KL={};WL(KL,{Graph:()=>jR,alg:()=>aR});var qL=Object.defineProperty,JL=(e,t)=>{for(var n in t)qL(e,n,{get:t[n],enumerable:!0})},YL=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=QL(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=$L(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,XL(this._preds[a],i),XL(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?eR(this._isDirected,e):QL(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?eR(this._isDirected,e):QL(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?eR(this._isDirected,e):QL(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],ZL(this._preds[t],e),ZL(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function XL(e,t){e[t]?e[t]++:e[t]=1}function ZL(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function QL(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function $L(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function eR(e,t){return QL(e,t.v,t.w,t.name)}JL({},{read:()=>iR,write:()=>tR});function tR(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:nR(e),edges:rR(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function nR(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function rR(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function iR(e){let t=new YL(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var aR={};JL(aR,{CycleException:()=>bR,bellmanFord:()=>sR,components:()=>lR,dijkstra:()=>fR,dijkstraAll:()=>mR,findCycles:()=>gR,floydWarshall:()=>vR,isAcyclic:()=>SR,postorder:()=>ER,preorder:()=>DR,prim:()=>OR,shortestPaths:()=>kR,tarjan:()=>hR,topsort:()=>xR});var oR=()=>1;function sR(e,t,n,r){return cR(e,String(t),n||oR,r||function(t){return e.outEdges(t)??[]})}function cR(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+o<r.distance&&(i[e.w]={distance:t.distance+o,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function lR(e){let t={},n=[],r;function i(n){var a,o;n in t||(t[n]=!0,r.push(n),(a=e.successors(n))==null||a.forEach(i),(o=e.predecessors(n))==null||o.forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var uR=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},dR=()=>1;function fR(e,t,n,r){return pR(e,String(t),n||dR,r||function(t){return e.outEdges(t)??[]})}function pR(e,t,n,r){let i={},a=new uR,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function mR(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=fR(e,i,t,n),r},{})}function hR(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function gR(e){return hR(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var _R=()=>1;function vR(e,t,n){return yR(e,t||_R,n||function(t){return e.outEdges(t)??[]})}function yR(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e<o.distance&&(o.distance=e,o.predecessor=i.predecessor)}})})}),r}var bR=class extends Error{constructor(e){super(e),this.name=`CycleException`}};function xR(e){let t={},n={},r=[];function i(a){var o;if(a in n)throw new bR;a in t||(n[a]=!0,t[a]=!0,(o=e.predecessors(a))==null||o.forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new bR;return r}function SR(e){try{xR(e)}catch(e){if(e instanceof bR)return!1;throw e}return!0}function CR(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=wR(e,t,n===`post`,o,a,r,i)}),i}function wR(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=wR(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function TR(e,t,n){return CR(e,t,n,function(e,t){return e.push(t),e},[])}function ER(e,t){return TR(e,t,`post`)}function DR(e,t){return TR(e,t,`pre`)}function OR(e,t){var n;let r=new YL,i={},a=new uR,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s<r&&(i[n]=o,a.decrease(n,s))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(e){a.add(e,1/0),r.setNode(e)});let c=e.nodes()[0];c!==void 0&&a.decrease(c,0);let l=!1;for(;a.size()>0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function kR(e,t,n,r){return AR(e,t,n,r??(t=>e.outEdges(t)??[]))}function AR(e,t,n,r){if(n===void 0)return fR(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=a[o];if(s===void 0)continue;let c=r(s);for(let e=0;e<c.length;e++){let t=c[e];if(!t)continue;let r=t.v===s?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return sR(e,t,n,r)}return fR(e,t,n,r)}var jR=YL;function MR(e,t,n,r){let i=r;for(;e.hasNode(i);)i=JR(r);return n.dummy=t,e.setNode(i,n),i}function NR(e){let t=new jR().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function PR(e){let t=new jR({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function FR(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function IR(e){let t=YR(UR(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function LR(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=HR(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function RR(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=HR(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function zR(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),MR(e,`border`,i,t)}function BR(e,t=VR){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var VR=65535;function HR(e,t){return t.length>VR?e(...BR(t).map(t=>e(...t))):e(...t)}function UR(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return HR(Math.max,t)}function WR(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function GR(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function KR(e,t){return t()}var qR=0;function JR(e){return e+(``+ ++qR)}function YR(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function XR(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function ZR(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function QR(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var $R=`\0`;function ez(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var tz=`3.1.1`,nz=class{constructor(){GL(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return rz(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&rz(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,iz)),n=n._prev;return`[`+e.join(`, `)+`]`}};function rz(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function iz(e,t){if(e!==`_next`&&e!==`_prev`)return t}var az=nz,oz=()=>1;function sz(e,t){if(e.nodeCount()<=1)return[];let n=uz(e,t||oz);return cz(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function cz(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)lz(e,t,n,o);for(;o=i.dequeue();)lz(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(lz(e,t,n,o,!0)||[]);break}}}return r}function lz(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,dz(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,dz(t,n,o)}),e.removeNode(r.v),o}function uz(e,t){let n=new jR,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=fz(i+r+3).map(()=>new az),o=r+1;return n.nodes().forEach(e=>{dz(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function dz(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function fz(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function pz(e,t){(e.graph().acyclicer===`greedy`?sz(e,n(e)):mz(e,t??null)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,JR(`rev`))});function n(e){return t=>e.edge(t).weight}}function mz(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&gz(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function hz(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function gz(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function _z(e){e.graph().dummyChains=[],e.edges().forEach(t=>vz(e,t))}function vz(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=MR(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function yz(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function bz(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=HR(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function xz(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Sz=Cz;function Cz(e){let t=new jR({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;wz(t,e)<i&&(a=Tz(t,e),a);)o=t.hasNode(a.v)?xz(e,a):-xz(e,a),Ez(t,e,o);return t}function wz(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!xz(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Tz(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=xz(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function Ez(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:Dz,postorder:Oz}=aR,kz=Az;Az.initLowLimValues=Pz,Az.initCutValues=jz,Az.calcCutValue=Nz,Az.leaveEdge=Iz,Az.enterEdge=Lz,Az.exchangeEdges=Rz;function Az(e){e=NR(e),bz(e);let t=Sz(e);Pz(t),jz(t,e);let n,r;for(;n=Iz(t);)r=Lz(t,e,n),Rz(t,e,n,r)}function jz(e,t){let n=Oz(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>Mz(e,t,n))}function Mz(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=Nz(e,t,n)}function Nz(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,Bz(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function Pz(e,t){arguments.length<2&&(t=e.nodes()[0]),Fz(e,{},1,t)}function Fz(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=Fz(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Iz(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Lz(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===Vz(e,e.node(t.v),s)&&c!==Vz(e,e.node(t.w),s)).reduce((e,n)=>xz(t,n)<xz(t,e)?n:e)}function Rz(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Pz(e),jz(e,t),zz(e,t)}function zz(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=Dz(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Bz(e,t,n){return e.hasEdge(t,n)}function Vz(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Hz=Uz;function Uz(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:Kz(e);break;case`tight-tree`:Gz(e);break;case`longest-path`:Wz(e);break;case`none`:break;default:Kz(e)}}var Wz=bz;function Gz(e){bz(e),Sz(e)}function Kz(e){kz(e)}var qz=Jz;function Jz(e){let t=Xz(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=Yz(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function Yz(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function Xz(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children($R).forEach(r),t}function Zz(e){let t=MR(e,`root`,{},`_root`),n=$z(e),r=Object.values(n),i=HR(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=eB(e)+1;e.children($R).forEach(r=>{Qz(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function Qz(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=zR(e,`_bt`),l=zR(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{Qz(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function $z(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children($R).forEach(e=>n(e,1)),t}function eB(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function tB(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var nB=rB;function rB(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)iB(e,`borderLeft`,`_bl`,n,i,t),iB(e,`borderRight`,`_br`,n,i,t)}}e.children($R).forEach(t)}function iB(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=MR(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function aB(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&sB(e)}function oB(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&lB(e),(t===`lr`||t===`rl`)&&(dB(e),sB(e))}function sB(e){e.nodes().forEach(t=>cB(e.node(t))),e.edges().forEach(t=>cB(e.edge(t)))}function cB(e){let t=e.width;e.width=e.height,e.height=t}function lB(e){e.nodes().forEach(t=>uB(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(uB),Object.hasOwn(r,`y`)&&uB(r)})}function uB(e){e.y=-e.y}function dB(e){e.nodes().forEach(t=>fB(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(fB),Object.hasOwn(r,`x`)&&fB(r)})}function fB(e){let t=e.x;e.x=e.y,e.y=t}function pB(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=YR(HR(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return ez(t,e.node(n),e.node(r))}return a}function mB(e,t){let n=0;for(let r=1;r<t.length;++r)n+=hB(e,t[r-1],t[r]);return n}function hB(e,t,n){let r=QR(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function gB(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function _B(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),vB(Object.values(n).filter(e=>!e.indegree))}function vB(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&yB(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>XR(e,[`vs`,`i`,`barycenter`,`weight`]))}function yB(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function bB(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=WR(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(SB(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=xB(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=xB(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function xB(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function SB(e,t,n){return(r,i)=>{if(r.barycenter<i.barycenter)return-1;if(r.barycenter>i.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=ez(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function CB(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=gB(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=CB(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&TB(t,r)}});let h=_B(m,n);wB(h,p);let g={},_=!1;for(let t=0;t<h.length;t++)for(let n=t+1;n<h.length;n++)if(h[t]&&h[n]&&(a=h[t])!=null&&a.barycenter&&(o=h[n])!=null&&o.barycenter&&h[t]?.barycenter===h[n].barycenter){let r=h[t]?.vs[0]??``,i=h[n]?.vs[0]??``,a=e.node(r),o=e.node(i);if(a.dummy===`edge`&&o.dummy===`edge`&&a.edgeObj?.v===o.edgeObj?.v&&a.edgeObj?.w===o.edgeObj?.w){if(a.edgeLabel.reversed){g[i]=h[t],h.splice(t,1),t--;break}g[r]=h[n],h.splice(n,1),n--}else _=!0}let v=bB(h,g,s,e,c);if(d&&f){v.vs=[d,v.vs,f].flat(1);let t=e.predecessors(d);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(f),i=e.node(r[0]);Object.hasOwn(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+n.order+i.order)/(v.weight+2),v.weight+=2}}return Object.defineProperty(v,"result",{value:v,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(v,"usedBias",{value:_,enumerable:!1,configurable:!0,writable:!0}),v}function wB(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function TB(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function EB(e,t,n,r){r||=e.nodes();let i=DB(e),a=new jR({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function DB(e){let t;for(;e.hasNode(t=JR(`_root`)););return t}function OB(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function kB(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,kB);return}let r=UR(e),i=AB(e,YR(1,r+1),`inEdges`),a=AB(e,YR(r-1,-1,-1),`outEdges`),o=pB(e,n);if(MB(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){jB(t%2?i:a,t%4>=2,l,n),o=IR(e);let u=mB(e,o);u<s?(r=0,c=Object.assign({},o),s=u):u===s&&(c=structuredClone(o))}MB(e,c)}function AB(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return EB(e,t,n,r.get(t)||[])})}function jB(e,t,n,r){let i=!0,a=new jR;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=CB(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),OB(e,a,s.vs)})}function MB(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function NB(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=FB(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&IB(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function PB(e,t){let n={};function r(t,r,i,a,o){YR(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&IB(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function FB(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function IB(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function LB(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function RB(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||qB(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>qB(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c<d&&s[i]!==l&&!LB(n,t,i)){let e=a[i];e!==void 0&&(o[i]=t,o[t]=a[t]=e,c=d,u&&=(c=-1,l=s[i]??-1,!1))}}}})}),{root:a,align:o}}function zB(e,t,n,r,i=!1){let a={},o=BB(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function BB(e,t,n,r){let i=new jR,a=e.graph(),o=GB(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function VB(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=KB(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function HB(e,t){let n=Object.values(t),r=HR(Math.min,n),i=HR(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-HR(Math.min,c);a!==`l`&&(l=i-HR(Math.max,c)),l&&(e[o]=ZR(s,e=>e+l))})})}function UB(e,t=void 0){let n=e.ul;return n?ZR(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function WB(e,t){let n=IR(e),r=Object.assign(NB(e,n),PB(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=RB(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=zB(e,a,s.root,s.align,n===`r`);n===`r`&&(c=ZR(c,e=>-e)),i[o+n]=c})}),HB(i,VB(e,i)),UB(i,e.graph().align)}function GB(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function KB(e,t){return e.node(t).width}function qB(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function JB(e,t){e=PR(e),YB(e),Object.entries(WB(e,t)).forEach(([t,n])=>e.node(t).x=n)}function YB(e){let t=IR(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var XB=new WeakMap;function ZB(e,t={}){return $B(e,KR,t),e}function QB(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function $B(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new jR({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=QB(e,t.v,r),i=QB(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),$B(o,t,n);let l=uV(o);eV(l,t,n,null),tV(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=uV(e),g=eV(h,t,n,XB.get(e)??null);XB.set(e,g),tV(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function eV(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>dV(e)),t(` removeSelfEdges`,()=>bV(e)),t(` acyclic`,()=>pz(e,s)),t(` nestingGraph.run`,()=>Zz(e)),t(` rank`,()=>Hz(PR(e))),t(` injectEdgeLabelProxies`,()=>fV(e)),t(` removeEmptyRanks`,()=>RR(e)),t(` nestingGraph.cleanup`,()=>tB(e)),t(` normalizeRanks`,()=>LR(e)),t(` assignRankMinMax`,()=>pV(e)),t(` removeEdgeLabelProxies`,()=>mV(e)),t(` normalize.run`,()=>_z(e)),t(` parentDummyChains`,()=>qz(e)),t(` addBorderSegments`,()=>nB(e)),t(` order`,()=>kB(e,n,c)),t(` insertSelfEdges`,()=>xV(e)),t(` adjustCoordinateSystem`,()=>aB(e)),t(` position`,()=>JB(e,n.corePath)),t(` positionSelfEdges`,()=>SV(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>yV(e)),t(` normalize.undo`,()=>yz(e)),t(` fixupEdgeLabelCoords`,()=>_V(e)),t(` undoCoordinateSystem`,()=>oB(e)),t(` translateGraph`,()=>hV(e)),t(` assignNodeIntersects`,()=>gV(e)),t(` reversePoints`,()=>vV(e)),t(` acyclic.undo`,()=>hz(e)),{graph:e,rawNodes:l}}function tV(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var nV=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],rV={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},iV=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],aV=[`width`,`height`,`rank`],oV={width:0,height:0},sV=[`minlen`,`weight`,`width`,`height`,`labeloffset`],cV={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},lV=[`labelpos`];function uV(e){let t=new jR({multigraph:!0,compound:!0}),n=wV(e.graph());return t.setGraph(Object.assign({},rV,CV(n,nV),XR(n,iV))),e.nodes().forEach(n=>{let r=CV(wV(e.node(n)),aV);Object.keys(oV).forEach(e=>{r[e]===void 0&&(r[e]=oV[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=wV(e.edge(n));t.setEdge(n,Object.assign({},cV,CV(r,sV),XR(r,lV)))}),t}function dV(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function fV(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);MR(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function pV(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function mV(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function hV(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function gV(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(FR(r,a)),n.points.push(FR(i,o))})}function _V(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function vV(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function yV(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function bV(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function xV(e){IR(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{MR(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function SV(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function CV(e,t){return ZR(XR(e,t),Number)}function wV(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function TV(e){let t=IR(e),n=new jR({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var EV={graphlib:KL,version:tz,layout:ZB,debug:TV,util:{time:GR,notime:KR}},DV=7.2;function OV(e){let t=e.split(`/`).at(-1)??e,n=e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``;return Math.min(300,Math.max(110,Math.max(t.length,Math.min(n.length,36)*.85)*DV+28))}function kV(e,t,n=[],r=null){let i=new EV.graphlib.Graph({multigraph:!0,compound:!0});i.setGraph({rankdir:`LR`,nodesep:n.length>0?44:16,ranksep:90,edgesep:10,marginx:24,marginy:24+(n.length>0?18:0)}),i.setDefaultEdgeLabel(()=>({}));for(let t of e)i.setNode(t,{width:OV(t),height:38});let a=new Set(e),o=[];for(let e of n){let t=e.members.filter(e=>a.has(e));if(t.length===0)continue;let n=`cluster:${e.id}`;i.setNode(n,{width:0,height:0});for(let e of t)i.setParent(e,n);o.push({id:e.id,label:e.label,key:n})}let s=new Map(o.map(e=>[e.id,e.key])),c=e=>`package:${e}`;for(let e of r?.packages??[]){i.setNode(c(e.id),{width:Math.max(110,e.label.length*DV+32),height:26});let t=s.get(e.id);t&&i.setParent(c(e.id),t)}let l=(r?.edges??[]).filter(e=>i.hasNode(c(e.from))&&i.hasNode(c(e.to)));l.forEach((e,t)=>i.setEdge(c(e.to),c(e.from),{},`pkg:${t}`)),t.forEach((e,t)=>i.setEdge(e.to,e.from,{},`${e.kind}:${t}`)),EV.layout(i);let u=e=>{let t=i.node(e);return{x:(t.x??0)-t.width/2,y:(t.y??0)-t.height/2,width:t.width,height:t.height}},d=e.map(e=>({path:e,...u(e)})),f=o.map(({id:e,label:t,key:n})=>({id:e,label:t,...u(n)})),p=t.map((e,t)=>({edge:e,points:i.edge({v:e.to,w:e.from,name:`${e.kind}:${t}`}).points??[]})),m=new Set((r?.packages??[]).filter(e=>e.touched).map(e=>e.id)),h=(r?.packages??[]).map(e=>({...e,...u(c(e.id))})),g=l.map((e,t)=>({from:e.from,to:e.to,touched:m.has(e.from)&&m.has(e.to),points:i.edge({v:c(e.to),w:c(e.from),name:`pkg:${t}`}).points??[]})),_=i.graph();return{nodes:d,edges:p,clusters:f,packageNodes:h,packageEdges:g,width:_.width??0,height:_.height??0}}var AV=6,jV=34;function MV(e,t,n,r){let i=new Map;for(let r of e){let e=n===`from`?r.from:r.to;(n===`from`?r.to:r.from)===t&&e!==t&&i.set(e,[...i.get(e)??[],r])}let a=e=>+!e.some(e=>e.kind===`import`);return[...i].sort(([e,t],[n,i])=>r(e)-r(n)||a(t)-a(i)||e.localeCompare(n))}function NV(e,t,n,r=()=>0){let i=MV(t,e,`from`,r),a=MV(t,e,`to`,r),o=Math.max(1,i.length,a.length),s=Math.max(38,o*26+(o-1)*AV),c=Math.min(Math.max(100,n*.3),200),l=+(i.length>0)+ +(a.length>0),u=l===0?0:Math.max(60,(n-c-l*jV)/l),d=(e,t)=>{let n=e.length*26+Math.max(0,e.length-1)*AV,r=(s-n)/2;return e.map(([e,n],i)=>({path:e,x:t,y:r+i*32,width:u,height:26,edges:n}))},f=a.length>0?u+jV:l===0?(n-c)/2:0;return{center:{path:e,x:f,y:(s-38)/2,width:c,height:38},outgoing:d(a,0),incoming:d(i,f+c+jV),width:n,height:s}}var PV=e=>e.split(`/`).at(-1)??e,FV=e=>e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``;function IV(e){if(e.length===0)return``;let t=`M${e[0].x},${e[0].y}`;for(let n=0;n<e.length-1;n++){let r=e[n-1]??e[n],i=e[n],a=e[n+1],o=e[n+2]??a,s={x:i.x+(a.x-r.x)/6,y:i.y+(a.y-r.y)/6},c={x:a.x-(o.x-i.x)/6,y:a.y-(o.y-i.y)/6};t+=` C${s.x},${s.y} ${c.x},${c.y} ${a.x},${a.y}`}return t}function LV(e,t){let n=Math.max(3,Math.floor((t-14)/7.7));return e.length>n?`${e.slice(0,n-1)}…`:e}function RV(e,t,n,r){let i=(n-e)/2;return`M${e},${t} C${e+i},${t} ${n-i},${r} ${n},${r}`}var zV=`package:`;function BV(e){let{ref:t,width:n}=$e(),r=(0,C.useMemo)(()=>new Map(e.stats.map(e=>[e.path,e])),[e.stats]),i=e.packages,a=(0,C.useMemo)(()=>new Map(i?.context.packages.map(e=>[e.id,e])??[]),[i]),o=e.center,s=(0,C.useMemo)(()=>{if(!o||!i)return e.edges;let t=i.rootOf.get(o),n=new Set(e.edges.filter(e=>e.from===o).map(e=>i.rootOf.get(e.to))),r=new Set(e.edges.filter(e=>e.to===o).map(e=>i.rootOf.get(e.from))),a=[];for(let e of i.imports[o]??[])e!==t&&!n.has(e)&&a.push({from:o,to:zV+e,kind:`import`,detail:[]});if(t!==void 0)for(let e of i.context.edges)e.to===t&&e.from!==t&&!r.has(e.from)&&a.push({from:zV+e.from,to:o,kind:`import`,detail:[]});return[...e.edges,...a]},[o,i,e.edges]),c=o&&n>0?NV(o,s,n,e=>+!!e.startsWith(zV)):null,l=c?r.get(c.center.path):void 0,u=o&&i?a.get(i.rootOf.get(o)??``)?.label:void 0,d=(t,n)=>{let r=t.path.slice(8),s=a.get(r),c=i?.firstFile.get(r),l=s?.touched===!0&&c!==void 0,d=s?.label??(r||`(racine)`),f=n===`out`?`${PV(o??``)} importe le package ${d}`:`le package ${d} utilise ${u??`ce package`}`;return(0,W.jsxs)(`g`,{className:`link-pkg`,"data-touched":s?.touched||void 0,transform:`translate(${t.x} ${t.y})`,style:{cursor:l?`pointer`:`default`},onClick:()=>l&&e.onSelect(c),children:[(0,W.jsx)(`rect`,{width:t.width,height:t.height,rx:t.height/2}),(0,W.jsx)(`text`,{x:t.width/2,y:17,textAnchor:`middle`,children:LV(d,t.width+6)}),(0,W.jsx)(`title`,{children:`${f}${s?.touched?l?` · clic : ouvrir ses fichiers`:``:` · aucun fichier modifié`}`})]},`${n}:${t.path}`)},f=(t,n)=>{let s=r.get(t.path),c=t.edges.every(e=>e.kind===`mention`),l=n===`in`?c?`mentionne`:`importe`:c?`mentionné par`:`importé par`,d=[...new Set(t.edges.flatMap(e=>e.detail))].join(`, `),f=i?a.get(i.rootOf.get(t.path)??``)?.label:void 0;return(0,W.jsxs)(`g`,{className:`link-node`,"data-state":s?.state,transform:`translate(${t.x} ${t.y})`,onClick:()=>e.onSelect(t.path),children:[(0,W.jsx)(`rect`,{width:t.width,height:t.height,rx:5,fill:s?LL(s):`var(--br-surface)`}),(0,W.jsxs)(`text`,{x:7,y:17,className:`link-name`,children:[s?.state===`viewed`?`✓ `:``,LV(PV(t.path),t.width-(s?.state===`viewed`?14:0)),f&&f!==u&&(0,W.jsx)(`tspan`,{dx:6,className:`link-pkg-tag`,children:LV(f,t.width-(PV(t.path).length+2)*7.7)})]}),(0,W.jsx)(`title`,{children:`${t.path}${f?` (${f})`:``}\n${l} ${PV(o??``)}${d?` : ${d}`:``}`})]},`${n}:${t.path}`)},p=(e,t,n)=>{let r=t===`out`?RV(e.x+e.width,e.y+e.height/2,n.x,n.y+n.height/2):RV(n.x+n.width,n.y+n.height/2,e.x,e.y+e.height/2);if(e.path.startsWith(zV)){let n=a.get(e.path.slice(8))?.touched===!0;return(0,W.jsx)(`path`,{d:r,className:`link-pkg-edge`,"data-touched":n||void 0,markerEnd:n?`url(#ego-arrow-pkg)`:`url(#ego-arrow)`},`e:${t}:${e.path}`)}return(0,W.jsx)(`path`,{d:r,className:`link-edge`,"data-kind":e.edges.every(e=>e.kind===`mention`)?`mention`:`import`,markerEnd:`url(#ego-arrow)`},`e:${t}:${e.path}`)},m=(e,t)=>e.path.startsWith(zV)?d(e,t):f(e,t);return(0,W.jsxs)(`div`,{className:`ego`,ref:t,children:[(0,W.jsxs)(ql,{gap:6,py:4,wrap:`nowrap`,children:[(0,W.jsxs)(Z,{size:`xs`,fw:600,truncate:!0,style:{flex:1},children:[o?PV(o):``,u&&(0,W.jsx)(Z,{span:!0,size:`xs`,c:`violet.3`,fw:500,ml:6,children:u})]}),c&&(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`utilise `,c.outgoing.length,` · utilisé par `,c.incoming.length]})]}),!o&&(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,pb:8,children:`Ouvrez un fichier pour voir ce qui l’utilise et ce qu’il utilise.`}),c&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(ql,{justify:`space-between`,mb:2,children:[(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`ce qu’il utilise`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`ce qui l’utilise →`})]}),c.incoming.length+c.outgoing.length===0?(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[`Aucun lien avec les autres fichiers`,i?` ou packages`:``,` de la PR.`]}):(0,W.jsxs)(`svg`,{width:`100%`,viewBox:`0 0 ${c.width} ${c.height}`,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`marker`,{id:`ego-arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-gray-5)`})}),(0,W.jsx)(`marker`,{id:`ego-arrow-pkg`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-violet-4)`})})]}),c.incoming.map(e=>p(e,`in`,c.center)),c.outgoing.map(e=>p(e,`out`,c.center)),c.incoming.map(e=>m(e,`in`)),c.outgoing.map(e=>m(e,`out`)),(0,W.jsxs)(`g`,{className:`link-node`,"data-current":!0,"data-state":l?.state,transform:`translate(${c.center.x} ${c.center.y})`,children:[(0,W.jsx)(`rect`,{width:c.center.width,height:38,rx:6,fill:l?LL(l):`var(--br-surface)`}),(0,W.jsx)(`text`,{x:9,y:16,className:`link-name`,children:LV(PV(c.center.path),c.center.width)}),(0,W.jsx)(`text`,{x:9,y:30,className:`link-dir`,children:LV(FV(c.center.path)||`/`,c.center.width+10)}),(0,W.jsx)(`title`,{children:`${c.center.path}${u?` (${u})`:``}`})]})]})]})]})}function VV(e){let{ref:t,width:n,height:r}=$e(),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),c=(0,C.useRef)(null),l=(0,C.useMemo)(()=>new Map(e.stats.map(e=>[e.path,e])),[e.stats]),u=(0,C.useMemo)(()=>kV(e.stats.map(e=>e.path),e.edges,e.groups,e.context),[e.stats,e.edges,e.groups,e.context]),d=n>0&&u.width>0?Math.min(1.4,n/u.width,r/u.height):1,f=o??{k:d,x:(n-u.width*d)/2,y:(r-u.height*d)/2},p=new Map(u.packageNodes.map(e=>[e.id,e.label])),m=t=>i===null||t===i||e.edges.some(e=>e.from===i&&e.to===t||e.to===i&&e.from===t);return(0,W.jsxs)(`div`,{ref:t,className:`link-graph`,onWheel:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=Math.min(4,Math.max(.15,f.k*(e.deltaY<0?1.15:1/1.15)));s({k:i,x:n-(n-f.x)*i/f.k,y:r-(r-f.y)*i/f.k})},onMouseDown:e=>c.current={x:e.clientX-f.x,y:e.clientY-f.y},onMouseMove:e=>c.current&&s({k:f.k,x:e.clientX-c.current.x,y:e.clientY-c.current.y}),onMouseUp:()=>c.current=null,onMouseLeave:()=>c.current=null,children:[(0,W.jsxs)(`svg`,{width:n,height:r,children:[(0,W.jsxs)(`defs`,{children:[(0,W.jsx)(`marker`,{id:`arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-gray-5)`})}),(0,W.jsx)(`marker`,{id:`arrow-hl`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-blue-4)`})}),(0,W.jsx)(`marker`,{id:`arrow-pkg`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,W.jsx)(`path`,{d:`M0,0 L10,5 L0,10 z`,fill:`var(--mantine-color-violet-4)`})})]}),(0,W.jsxs)(`g`,{transform:`translate(${f.x} ${f.y}) scale(${f.k})`,children:[u.clusters.map(e=>(0,W.jsxs)(`g`,{className:`link-cluster`,transform:`translate(${e.x} ${e.y})`,children:[(0,W.jsx)(`rect`,{width:e.width,height:e.height,rx:10}),u.packageNodes.length===0&&(0,W.jsx)(`text`,{x:6,y:-6,children:e.label})]},e.id)),u.packageEdges.map(e=>{let t=i===`package:${e.from}`||i===`package:${e.to}`;return(0,W.jsx)(`path`,{d:IV(e.points),className:`link-pkg-edge`,"data-touched":e.touched||void 0,"data-active":t||void 0,markerEnd:e.touched?`url(#arrow-pkg)`:`url(#arrow)`,children:(0,W.jsx)(`title`,{children:`${p.get(e.from)??e.from} utilise ${p.get(e.to)??e.to}`})},`pkg:${e.from}:${e.to}`)}),u.packageNodes.map(e=>(0,W.jsxs)(`g`,{className:`link-pkg`,"data-touched":e.touched||void 0,transform:`translate(${e.x} ${e.y})`,onMouseEnter:()=>a(`package:${e.id}`),onMouseLeave:()=>a(null),children:[(0,W.jsx)(`rect`,{width:e.width,height:e.height,rx:e.height/2}),(0,W.jsx)(`text`,{x:e.width/2,y:17,textAnchor:`middle`,children:e.label}),(0,W.jsx)(`title`,{children:`${e.label} — ${e.id||`(racine)`}${e.touched?``:` · aucun fichier modifié`}`})]},`package:${e.id}`)),u.edges.map(({edge:e,points:t},n)=>{let r=i!==null&&(e.from===i||e.to===i),a=IV(t);return(0,W.jsx)(`path`,{d:a,className:`link-edge`,"data-kind":e.kind,"data-active":r||void 0,"data-dim":i!==null&&!r||void 0,markerEnd:r?`url(#arrow-hl)`:`url(#arrow)`,children:(0,W.jsxs)(`title`,{children:[e.from,` `,e.kind===`import`?`importe`:`mentionne`,` `,e.to,e.detail.length?` : ${e.detail.join(`, `)}`:``]})},n)}),u.nodes.map(t=>{let n=l.get(t.path);return(0,W.jsxs)(`g`,{className:`link-node`,"data-state":n?.state,"data-current":t.path===e.currentPath||void 0,"data-dim":!m(t.path)||void 0,transform:`translate(${t.x} ${t.y})`,onMouseEnter:()=>a(t.path),onMouseLeave:()=>a(null),onClick:()=>e.onSelect(t.path),children:[(0,W.jsx)(`rect`,{width:t.width,height:38,rx:6,fill:n?LL(n):`var(--br-surface)`}),(0,W.jsxs)(`text`,{x:10,y:16,className:`link-name`,children:[n?.state===`viewed`?`✓ `:``,PV(t.path)]}),(0,W.jsx)(`text`,{x:10,y:30,className:`link-dir`,children:FV(t.path)||`/`}),n&&n.openThreads>0&&(0,W.jsx)(`circle`,{cx:t.width-9,cy:9,r:4,className:`link-thread`,"data-unread":n.unreadThreads>0||void 0}),(0,W.jsx)(`title`,{children:`${t.path}\n+${n?.additions??0} −${n?.deletions??0}`})]},t.path)})]})]}),o&&(0,W.jsx)(Qf,{size:`compact-xs`,variant:`default`,className:`link-fit`,onClick:()=>s(null),children:`Recadrer`})]})}function HV(e){let t=WV(),[n,r]=Ge({key:`br:linksMentions`,defaultValue:!0}),[i,a]=Ge({key:`br:linksIsolated`,defaultValue:!1}),[o,s]=(0,C.useState)(!1),c=(0,C.useMemo)(()=>(t.data?.edges??[]).filter(e=>n||e.kind===`import`),[t.data,n]),l=(0,C.useMemo)(()=>new Set(e.stats.map(e=>e.path)),[e.stats]),u=(0,C.useMemo)(()=>(t.data?.packages??[]).map(e=>({id:e.root,label:e.name,members:e.files})),[t.data]),d=GV(t.data),[f,p]=Ge({key:`br:linksWorkspace`,defaultValue:!0}),m=(0,C.useMemo)(()=>c.filter(e=>l.has(e.from)&&l.has(e.to)),[c,l]),h=new Map,g=new Map;for(let e of c)h.set(e.from,(h.get(e.from)??0)+1),g.set(e.to,(g.get(e.to)??0)+1);let _=e=>(h.get(e)??0)+(g.get(e)??0),v=t.data?.packages??[],y=e.stats,b=y.filter(e=>_(e.path)>0),x=y.filter(e=>_(e.path)===0),S=new Map(v.flatMap(e=>e.files.map(t=>[t,e.root]))),w=new Map(v.map(e=>[e.root,e.name])),T=i?e.stats:e.stats.filter(e=>m.some(t=>t.from===e.path||t.to===e.path));if(t.isPending)return(0,W.jsx)(KV,{});if(t.isError)return(0,W.jsx)(qV,{message:t.error.message});let E=(n,r)=>{let i=t.data.languages[n.path],a=t.data.externalImports[n.path]??0;return(0,W.jsxs)(`div`,{className:`tree-node`,"data-current":n.path===e.currentPath||void 0,"data-viewed":n.state===`viewed`||void 0,title:n.path,onClick:()=>e.onSelect(n.path),children:[r!==void 0&&(0,W.jsx)(`span`,{className:`link-rank`,children:r}),(0,W.jsx)(DL,{state:n.state}),(0,W.jsxs)(`span`,{className:`tree-name`,children:[PV(n.path),(0,W.jsx)(Z,{span:!0,size:`xs`,c:`dimmed`,ml:6,children:FV(n.path)})]}),i&&(0,W.jsx)(Uf,{size:`xs`,variant:`outline`,color:`gray`,radius:`sm`,children:HI(i)}),(0,W.jsx)(Jm,{label:`importe / mentionne ${h.get(n.path)??0} · utilisé par ${g.get(n.path)??0}${a?` · ${a} import(s) hors PR`:``}`,children:(0,W.jsxs)(Z,{span:!0,size:`xs`,ff:`monospace`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`→`,h.get(n.path)??0,` ←`,g.get(n.path)??0]})})]},n.path)};return(0,W.jsxs)(`div`,{className:`links-view`,children:[(0,W.jsxs)(ql,{gap:6,px:10,pb:6,children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[c.length,` liens · `,b.length,` fichiers reliés`]}),(0,W.jsx)(Qf,{size:`compact-xs`,ml:`auto`,variant:`light`,onClick:()=>s(!0),disabled:T.length===0,children:`Graphe ⤢`})]}),(0,W.jsx)(kf,{size:`xs`,px:10,pb:6,label:`Inclure les mentions (noms ou chemins cités dans le texte)`,checked:n,onChange:e=>r(e.currentTarget.checked)}),t.data.unreadable.length>0&&(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,px:10,pb:4,children:[`Non analysés (binaires / trop gros) : `,t.data.unreadable.length]}),(0,W.jsxs)(`div`,{className:`file-nav-scroll`,children:[(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,px:10,pt:6,pb:2,children:v.length>0?`Ordre de lecture : packages les plus utilisés en premier, puis la base d’abord dans chaque package.`:`Ordre de lecture : la base d’abord (fichiers utilisés par les autres), puis ce qui les assemble.`}),v.length>0?(0,W.jsxs)(W.Fragment,{children:[v.map(e=>{let t=y.filter(t=>S.get(t.path)===e.root);if(t.length===0)return null;let n=e=>e.map(e=>w.get(e)??e).join(`, `);return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Jm,{multiline:!0,w:320,label:`${e.root||`(racine)`} · utilise : ${n(e.dependsOn)||`—`} · utilisé par : ${n(e.usedBy)||`—`}`,children:(0,W.jsxs)(`div`,{className:`pkg-head`,children:[(0,W.jsx)(Uf,{size:`xs`,variant:`light`,color:`violet`,radius:`sm`,children:e.ecosystem}),(0,W.jsx)(Z,{span:!0,size:`xs`,fw:700,truncate:!0,children:e.name}),(0,W.jsx)(Z,{span:!0,size:`xs`,c:`dimmed`,truncate:!0,style:{flex:1},children:e.root?`${e.root}/`:``}),(0,W.jsxs)(Z,{span:!0,size:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`utilisé par `,e.usedBy.length,` · utilise `,e.dependsOn.length]})]})}),t.map(e=>E(e,y.indexOf(e)+1))]},e.root)}),y.some(e=>!S.has(e.path))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`tree-dir`,children:`Hors des packages`}),y.filter(e=>!S.has(e.path)).map(e=>E(e,y.indexOf(e)+1))]})]}):(0,W.jsxs)(W.Fragment,{children:[b.map((e,t)=>E(e,t+1)),x.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`tree-dir`,children:[`Sans lien avec les autres fichiers de la PR (`,x.length,`)`]}),x.map(e=>E(e))]})]})]}),(0,W.jsx)(rm,{opened:o,onClose:()=>s(!1),fullScreen:!0,title:(0,W.jsxs)(ql,{gap:`md`,children:[(0,W.jsx)(Z,{fw:600,children:`Liens entre les fichiers modifiés`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`à gauche la base (fichiers utilisés par les autres), à droite ce qui les utilise · flèche = « est utilisé par » · trait plein = import, pointillé = mention · glisser pour déplacer, molette pour zoomer, clic pour ouvrir le fichier`})]}),styles:{body:{height:`calc(100vh - 60px)`,padding:0}},children:(0,W.jsxs)(nh,{gap:0,h:`100%`,children:[(0,W.jsxs)(ql,{gap:`lg`,px:`md`,py:6,children:[(0,W.jsx)(kf,{size:`xs`,label:`Mentions`,checked:n,onChange:e=>r(e.currentTarget.checked)}),(0,W.jsx)(kf,{size:`xs`,label:`Fichiers sans lien`,checked:i,onChange:e=>a(e.currentTarget.checked)}),d&&(0,W.jsx)(kf,{size:`xs`,label:`Autres packages du monorepo (${d.packages.filter(e=>!e.touched).length})`,checked:f,onChange:e=>p(e.currentTarget.checked)})]}),(0,W.jsx)(VV,{stats:T,groups:u,context:f?d:null,edges:m,currentPath:e.currentPath,onSelect:t=>{s(!1),e.onSelect(t)}})]})})]})}function UV(e){let t=WV(),[n,r]=Ge({key:`br:linksMentions`,defaultValue:!0}),i=(0,C.useMemo)(()=>(t.data?.edges??[]).filter(e=>n||e.kind===`import`),[t.data,n]),a=GV(t.data),o=(0,C.useMemo)(()=>{if(!t.data||!a)return null;let n=new Map(t.data.packages.flatMap(e=>e.files.map(t=>[t,e.root]))),r=new Map;for(let t of e.stats){let e=n.get(t.path);e!==void 0&&!r.has(e)&&r.set(e,t.path)}return{context:a,rootOf:n,firstFile:r,imports:t.data.packageImports}},[t.data,a,e.stats]);return t.isPending?(0,W.jsx)(KV,{}):t.isError?(0,W.jsx)(qV,{message:t.error.message}):(0,W.jsxs)(`div`,{className:`panel-body`,children:[(0,W.jsx)(kf,{size:`xs`,pb:6,label:`Inclure les mentions (noms ou chemins cités dans le texte)`,checked:n,onChange:e=>r(e.currentTarget.checked)}),(0,W.jsx)(BV,{center:e.currentPath,edges:i,stats:e.stats,onSelect:e.onSelect,packages:o})]})}function WV(){let e=SF();return fv({...TE().pr.links.queryOptions({ref:e.ref,base:e.range.base,head:e.range.head,fullPr:e.range.fullPr}),staleTime:1/0})}function GV(e){return(0,C.useMemo)(()=>e&&e.workspace.length>0?{packages:e.workspace.map(e=>({id:e.root,label:e.name,touched:e.touched})),edges:e.packageEdges}:null,[e])}function KV(){return(0,W.jsxs)(ql,{p:`md`,gap:`xs`,children:[(0,W.jsx)(kl,{size:`xs`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:`Analyse des imports…`})]})}function qV({message:e}){return(0,W.jsx)($d,{color:`red`,m:`xs`,title:`Liens indisponibles`,children:e})}function JV(e){let t=e.width??48,n=IL(e),r=e.max>0?Math.max(n>0?2:0,n/e.max*t):0,i=n>0?e.additions/n*r:0;return(0,W.jsxs)(`span`,{className:`churn-bar`,style:{width:t},children:[(0,W.jsx)(`i`,{className:`add`,style:{width:i}}),(0,W.jsx)(`i`,{className:`del`,style:{width:r-i}})]})}function YV({additions:e,deletions:t}){return(0,W.jsxs)(Z,{span:!0,size:`xs`,ff:`monospace`,style:{whiteSpace:`nowrap`},children:[e>0&&(0,W.jsxs)(Z,{span:!0,c:`green.4`,inherit:!0,children:[`+`,e]}),` `,t>0&&(0,W.jsxs)(Z,{span:!0,c:`red.4`,inherit:!0,children:[`−`,t]})]})}function XV(e){let{stat:t}=e,n=(0,C.useRef)(null),r=e.current;return(0,C.useEffect)(()=>{r&&n.current?.scrollIntoView({block:`nearest`})},[r]),(0,W.jsxs)(`div`,{ref:n,className:`tree-node`,"data-current":r||void 0,"data-viewed":t.state===`viewed`||void 0,onClick:e.onSelect,title:t.path,style:{paddingLeft:10+e.depth*14},children:[(0,W.jsx)(DL,{state:t.state}),(0,W.jsxs)(`span`,{className:`tree-name`,children:[t.path.split(`/`).at(-1),e.dir&&(0,W.jsx)(Z,{span:!0,size:`xs`,c:`dimmed`,ml:6,children:e.dir})]}),t.openThreads>0&&(0,W.jsxs)(Z,{span:!0,size:`xs`,c:t.unreadThreads>0?`orange.4`:`yellow.4`,children:[(0,W.jsx)(`i`,{className:`ico-c`}),t.openThreads]}),(0,W.jsx)(JV,{additions:t.additions,deletions:t.deletions,max:e.maxChurn,width:36}),(0,W.jsx)(YV,{additions:t.additions,deletions:t.deletions})]})}function ZV(e){let t=Math.max(0,...e.stats.map(IL));if(e.sort===`churn`)return(0,W.jsx)(W.Fragment,{children:e.stats.map(n=>(0,W.jsx)(XV,{stat:n,depth:0,dir:n.path.includes(`/`)?n.path.slice(0,n.path.lastIndexOf(`/`)):void 0,current:n.path===e.currentPath,maxChurn:t,onSelect:()=>e.onSelect(n.path)},n.path))});let n=[];for(let t of e.stats){let e=t.path.includes(`/`)?t.path.slice(0,t.path.lastIndexOf(`/`)):``,r=n.at(-1);r&&r.dir===e?r.stats.push(t):n.push({dir:e,stats:[t]})}return(0,W.jsx)(W.Fragment,{children:n.map((n,r)=>(0,W.jsxs)(`div`,{children:[n.dir&&(0,W.jsxs)(`div`,{className:`tree-dir`,children:[n.dir,`/`]}),n.stats.map(n=>(0,W.jsx)(XV,{stat:n,depth:1,current:n.path===e.currentPath,maxChurn:t,onSelect:()=>e.onSelect(n.path)},n.path))]},`${n.dir}:${r}`))})}function QV(e){let[t,n]=(0,C.useState)(new Set),r=BL(e.root,t),i=IL(e.root),a=Math.max(0,...r.flatMap(e=>e.kind===`file`?[IL(e.stat)]:[])),o=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,W.jsx)(W.Fragment,{children:r.map(n=>n.kind===`dir`?(0,W.jsxs)(`div`,{className:`tree-node tree-folder`,style:{paddingLeft:6+n.depth*14},onClick:()=>o(n.path),title:`${n.path}/ · ${n.fileCount} fichiers · ${n.viewedCount} vus`,children:[(0,W.jsx)(`span`,{className:`tree-chevron`,children:t.has(n.path)?`▸`:`▾`}),(0,W.jsxs)(`span`,{className:`tree-name`,children:[n.name,`/`]}),n.openThreads>0&&(0,W.jsxs)(Z,{span:!0,size:`xs`,c:`yellow.4`,children:[(0,W.jsx)(`i`,{className:`ico-c`}),n.openThreads]}),(0,W.jsxs)(Z,{span:!0,size:`xs`,c:n.viewedCount===n.fileCount?`green.5`:`dimmed`,children:[n.viewedCount,`/`,n.fileCount]}),(0,W.jsx)(JV,{additions:n.additions,deletions:n.deletions,max:i,width:36}),(0,W.jsx)(YV,{additions:n.additions,deletions:n.deletions})]},`d:${n.path}`):(0,W.jsx)(XV,{stat:n.stat,depth:n.depth+.6,current:n.path===e.currentPath,maxChurn:a,onSelect:()=>e.onSelect(n.path)},n.path))})}function $V(e){let{stats:t}=e,[n,r]=(0,C.useState)([]),[i,a]=(0,C.useState)(``),o=(0,C.useMemo)(()=>t.filter(e=>(!n.includes(`unviewed`)||e.state!==`viewed`)&&(!n.includes(`threads`)||e.openThreads>0)&&(i===``||e.path.toLowerCase().includes(i.toLowerCase()))),[t,n,i]),s=(0,C.useMemo)(()=>zL(o),[o]),c=t.filter(e=>e.state===`viewed`).length;return(0,W.jsxs)(`div`,{className:`file-nav`,children:[(0,W.jsx)(Qm,{size:`xs`,mx:10,mb:6,value:e.nav,onChange:t=>e.onNavChange(t===`list`||t===`links`?t:`tree`),data:[{value:`list`,label:`Liste`},{value:`tree`,label:`Arbre`},{value:`links`,label:`Liens`}]}),(0,W.jsxs)(ql,{gap:4,px:10,pb:6,children:[(0,W.jsxs)(op.Group,{multiple:!0,value:n,onChange:r,children:[(0,W.jsx)(op,{size:`xs`,value:`unviewed`,children:`Non vus`}),(0,W.jsx)(op,{size:`xs`,value:`threads`,children:`Threads ouverts`})]}),e.nav!==`links`&&(0,W.jsx)(Qm,{size:`xs`,ml:`auto`,value:e.sort,onChange:t=>e.onSortChange(t===`churn`?`churn`:`name`),data:[{value:`name`,label:`A→Z`},{value:`churn`,label:`Taille`}]})]}),(0,W.jsx)(Mh,{size:`xs`,px:10,pb:6,placeholder:`Filtrer les fichiers…`,value:i,onChange:e=>a(e.currentTarget.value)}),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,px:10,pb:4,children:[c,`/`,t.length,` fichiers vus · `,IL(s),` lignes modifiées`,o.length===t.length?``:` · ${o.length} affichés`]}),o.length===0?(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,px:10,children:`Aucun fichier.`}):e.nav===`links`?(0,W.jsx)(HV,{stats:o,currentPath:e.currentPath,onSelect:e.onSelect}):(0,W.jsx)(`div`,{className:`file-nav-scroll`,children:e.nav===`tree`?(0,W.jsx)(QV,{root:s,currentPath:e.currentPath,onSelect:e.onSelect}):(0,W.jsx)(ZV,{stats:o,sort:e.sort,currentPath:e.currentPath,onSelect:e.onSelect})})]})}function eH(e){let t=SF(),n=iS({from:`/$owner/$repo/pull/$number`}),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),s=t.detail.commits,c=t.detail.myReview?.commitOid??null,l=e=>{n({search:t=>({...t,range:e})}),i(!1)},u=new Set;if(t.range.kind===`commits`){let e=s.findIndex(e=>e.parentOid===t.range.base),n=s.findIndex(e=>e.oid===t.range.head);if(e!==-1&&n>=e)for(let t of s.slice(e,n+1))u.add(t.oid)}let d=(e,t,n,r=!1)=>(0,W.jsx)(Pm,{value:e,disabled:r,label:(0,W.jsxs)(ql,{gap:8,justify:`space-between`,wrap:`nowrap`,w:380,children:[(0,W.jsx)(Z,{size:`sm`,children:t}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:n})]})},e);return(0,W.jsxs)(xl,{opened:r,onChange:i,position:`bottom-start`,shadow:`lg`,width:460,trapFocus:!0,children:[(0,W.jsx)(xl.Target,{children:(0,W.jsxs)(Qf,{size:`compact-sm`,variant:`light`,onClick:()=>i(e=>!e),rightSection:`▾`,children:[`Plage : `,t.range.label]})}),(0,W.jsxs)(xl.Dropdown,{p:`sm`,children:[(0,W.jsx)(Z,{size:`xs`,tt:`uppercase`,fw:600,c:`dimmed`,mb:6,children:`Plage de comparaison`}),(0,W.jsx)(Pm.Group,{value:t.range.kind===`commits`?``:t.range.kind,onChange:l,children:(0,W.jsxs)(nh,{gap:8,children:[d(`all`,`Tous les changements`,`${s.length} commits · ${t.detail.files.length} fichiers`),d(`visit`,`Depuis ma dernière visite`,e.visitAt?e.visitHead===t.detail.pr.headRefOid?`aucun nouveau commit`:new Date(e.visitAt).toLocaleString(`fr`):`jamais visitée`,!e.visitAt||e.visitHead===t.detail.pr.headRefOid),d(`review`,`Depuis ma dernière review`,c?c===t.detail.pr.headRefOid?`à jour`:c.slice(0,7):`jamais reviewée`,!c||c===t.detail.pr.headRefOid)]})}),(0,W.jsx)(_p,{my:`sm`}),(0,W.jsx)(Z,{size:`xs`,tt:`uppercase`,fw:600,c:`dimmed`,mb:6,children:`Commits (clic : un commit · Maj+clic : intervalle)`}),(0,W.jsx)(nh,{gap:2,mah:320,style:{overflow:`auto`},children:s.map((e,t)=>(0,W.jsxs)(ql,{gap:8,wrap:`nowrap`,px:4,py:2,style:{cursor:`pointer`,borderRadius:4,background:e.seen?void 0:`rgba(255,146,43,.08)`},onClick:e=>{let n=e.shiftKey&&a!==null?Math.min(a,t):t,r=e.shiftKey&&a!==null?Math.max(a,t):t;o(t);let i=s[n],c=s[r];i.parentOid&&l(`${i.parentOid}..${c.oid}`)},children:[(0,W.jsx)(kf,{size:`xs`,readOnly:!0,checked:u.has(e.oid)}),(0,W.jsx)(Z,{ff:`monospace`,size:`xs`,c:`dimmed`,children:e.shortOid}),(0,W.jsx)(Z,{size:`sm`,truncate:!0,style:{flex:1},children:e.headline}),!e.seen&&(0,W.jsx)(Uf,{size:`xs`,color:`orange`,variant:`light`,children:`nouveau`}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,children:ME(e.date)})]},e.oid))}),(0,W.jsx)(Z,{size:`xs`,c:`dimmed`,mt:`sm`,children:`Hors « tous les changements », seuls les commentaires côté nouveau code sont possibles (numéros de ligne de la PR).`})]})]})}function tH(e){let t=SF(),n=wF(t.ref),[r,i]=(0,C.useState)(``),a=t.detail.pr.author?.login===t.me,[o,s]=(0,C.useState)(`COMMENT`),c=t.detail.pendingReview,l=async()=>{await n.submitReview.mutateAsync({prId:t.detail.pr.id,pendingReviewId:c?.id??null,event:o,body:r}),i(``),e.onChange(!1)};return(0,W.jsxs)(xl,{opened:e.opened,onChange:e.onChange,position:`bottom-end`,shadow:`lg`,width:400,trapFocus:!0,children:[(0,W.jsx)(xl.Target,{children:(0,W.jsx)(Qf,{size:`compact-sm`,onClick:()=>e.onChange(!e.opened),rightSection:(0,W.jsx)(Bp,{size:`xs`,children:`⇧S`}),children:c?`Soumettre la review (${c.comments})`:`Review`})}),(0,W.jsxs)(xl.Dropdown,{children:[(0,W.jsx)(Z,{fw:600,mb:6,children:c?`Review en attente · ${c.comments} commentaire${c.comments>1?`s`:``}`:`Nouvelle review`}),(0,W.jsx)(Lp,{autosize:!0,minRows:3,placeholder:`Résumé (optionnel)`,value:r,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&l()}}),(0,W.jsx)(Pm.Group,{value:o,onChange:e=>s(e),my:`sm`,children:(0,W.jsxs)(nh,{gap:6,children:[(0,W.jsx)(Pm,{value:`COMMENT`,label:`Commenter`}),(0,W.jsx)(Jm,{label:`Impossible d’approuver sa propre PR`,disabled:!a,children:(0,W.jsx)(Pm,{value:`APPROVE`,label:`Approuver`,disabled:a})}),(0,W.jsx)(Jm,{label:`Impossible sur sa propre PR`,disabled:!a,children:(0,W.jsx)(Pm,{value:`REQUEST_CHANGES`,label:`Demander des changements`,disabled:a})})]})}),(0,W.jsxs)(ql,{justify:`flex-end`,gap:6,children:[c&&(0,W.jsx)(Qf,{size:`compact-sm`,variant:`subtle`,color:`red`,loading:n.discardReview.isPending,onClick:()=>n.discardReview.mutate({reviewId:c.id}),children:`Abandonner la review`}),(0,W.jsx)(Qf,{size:`compact-sm`,color:o===`APPROVE`?`green`:o===`REQUEST_CHANGES`?`red`:`blue`,loading:n.submitReview.isPending,disabled:!c&&o===`COMMENT`&&r.trim()===``,onClick:()=>void l(),children:`Soumettre`})]})]})]})}function nH(e){let t=SF(),{pr:n,checks:r,reviewers:i,requestedTeams:a}=t.detail,o=r?FE[r.state]:null;return(0,W.jsxs)(`div`,{className:`pr-head`,children:[(0,W.jsxs)(ql,{gap:8,wrap:`nowrap`,align:`baseline`,children:[(0,W.jsxs)(zh,{order:3,fw:600,style:{minWidth:0},lineClamp:1,children:[n.title,` `,(0,W.jsxs)(Z,{span:!0,c:`dimmed`,fw:400,inherit:!0,children:[n.owner,`/`,n.repo,` #`,n.number]})]}),(0,W.jsx)(sf,{href:n.url,target:`_blank`,size:`sm`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:`GitHub ↗`})]}),(0,W.jsxs)(ql,{gap:8,mt:4,wrap:`wrap`,children:[(0,W.jsx)(Uf,{color:n.state===`OPEN`?n.isDraft?`gray`:`green`:n.state===`MERGED`?`violet`:`red`,variant:`light`,children:n.isDraft?`Brouillon`:n.state===`OPEN`?`Ouverte`:n.state===`MERGED`?`Mergée`:`Fermée`}),(0,W.jsx)(Bf,{src:n.author?.avatarUrl,size:20}),(0,W.jsxs)(Z,{size:`sm`,c:`dimmed`,children:[n.author?.login??`ghost`,` · `,t.detail.commits.length,` commits de`,` `,(0,W.jsx)(Z,{span:!0,ff:`monospace`,c:`blue.4`,inherit:!0,children:n.headRefName}),` `,`vers`,` `,(0,W.jsx)(Z,{span:!0,ff:`monospace`,c:`blue.4`,inherit:!0,children:n.baseRefName}),` `,`· ouverte `,ME(n.createdAt)]}),o&&r&&(0,W.jsxs)(xl,{position:`bottom`,shadow:`md`,width:360,children:[(0,W.jsx)(xl.Target,{children:(0,W.jsxs)(Uf,{color:o.color,variant:`light`,style:{cursor:`pointer`},children:[o.label,` · `,r.contexts.length]})}),(0,W.jsx)(xl.Dropdown,{children:(0,W.jsx)(nh,{gap:4,children:r.contexts.map(e=>(0,W.jsxs)(ql,{gap:6,wrap:`nowrap`,children:[(0,W.jsx)(Uf,{size:`xs`,color:/SUCCESS/.test(e.state)?`green`:/FAIL|ERROR/.test(e.state)?`red`:`yellow`,children:e.state.toLowerCase()}),e.url?(0,W.jsx)(sf,{href:e.url,target:`_blank`,size:`sm`,truncate:!0,children:e.name}):(0,W.jsx)(Z,{size:`sm`,children:e.name})]},e.name))})})]}),n.mergeable===`CONFLICTING`&&(0,W.jsx)(Uf,{color:`red`,variant:`light`,children:`conflits`}),i.map(e=>(0,W.jsxs)(Uf,{variant:`outline`,color:PE[e.state]?.color??`gray`,leftSection:(0,W.jsx)(Bf,{src:e.avatarUrl,size:14}),children:[e.login,` : `,PE[e.state]?.label??e.state]},e.login)),a.map(e=>(0,W.jsxs)(Uf,{variant:`outline`,color:`yellow`,children:[`@`,e,` : demandé`]},e))]}),(0,W.jsxs)(`div`,{className:`pr-bar`,children:[(0,W.jsx)(eH,{visitAt:e.visitAt,visitHead:e.visitHead}),e.children]})]})}function rH(){let e=hH.useParams(),t=(0,C.useMemo)(()=>({owner:e.owner,repo:e.repo,number:Number(e.number)}),[e.owner,e.repo,e.number]),n=TE(),r=Gg(),i=fv(n.pr.get.queryOptions(t));return bE(n.pr.onChange.subscriptionOptions(t,{onData:()=>void r.invalidateQueries({queryKey:n.pr.get.queryKey(t)})})),i.isPending?(0,W.jsx)(ep,{style:{flex:1},children:(0,W.jsx)(kl,{})}):i.isError?(0,W.jsx)($d,{color:`red`,m:`lg`,title:`PR introuvable ou inaccessible`,children:i.error.message}):(0,W.jsx)(aH,{ref_:t,detail:i.data},`${t.owner}/${t.repo}#${t.number}`)}function iH(e,t,n){let{baseRefOid:r,headRefOid:i}=t.pr,a={kind:`all`,base:r,head:i,fullPr:!0,label:`Tous les changements`};if(e===`visit`&&n&&n!==i)return{kind:`visit`,base:n,head:i,fullPr:!1,label:`Depuis ma dernière visite`};let o=t.myReview?.commitOid;if(e===`review`&&o&&o!==i)return{kind:`review`,base:o,head:i,fullPr:!1,label:`Depuis ma dernière review`};let s=/^([0-9a-f]{7,40})\.\.([0-9a-f]{7,40})$/.exec(e);if(s){let[,e,n]=s,r=t.commits.find(t=>t.parentOid===e),i=t.commits.find(e=>e.oid===n);return{kind:`commits`,base:e,head:n,fullPr:!1,label:r&&i&&r.oid===i.oid?`Commit ${i.shortOid}`:`Commits ${r?.shortOid??e.slice(0,7)}…${i?.shortOid??n.slice(0,7)}`}}return a}function aH({ref_:e,detail:t}){let n=TE(),r=iS({from:`/$owner/$repo/pull/$number`}),i=hH.useSearch(),a=wF(e),[o]=(0,C.useState)(()=>Date.now()),[s]=(0,C.useState)(()=>t.pr.headRefOid),[c,l]=Ge({key:`br:layout`,defaultValue:`split`}),[u,d]=Ge({key:`br:panel`,defaultValue:!0}),[f,p]=Ge({key:`br:panelTab`,defaultValue:`conversations`}),m=e=>{u&&f===e?d(!1):(p(e),d(!0))},[h,g]=Ge({key:`br:tree`,defaultValue:!0}),[_,v]=Ge({key:`br:nav`,defaultValue:`tree`}),y=_===`list`||_===`links`?_:`tree`,[b,x]=Ge({key:`br:navSort`,defaultValue:`name`}),[S]=Ge({key:`br:linksMentions`,defaultValue:!0}),[w,T]=(0,C.useState)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(new Set),[M,N]=(0,C.useState)({fileIdx:null,hunkIdx:null}),[ee,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(!1),L=(0,C.useRef)(null),R=t.pr.headRefOid,te=t.visits.find(e=>e.visitedAt<o)??null,ne=te?.headOid??null,re=ne&&ne!==R?`visit`:`all`,ie=iH(i.range??re,t,ne),ae=i.mode??`continuous`,oe=fv({...n.pr.diff.queryOptions({ref:e,base:ie.base,head:ie.head,fullPr:ie.fullPr}),staleTime:1/0}),se=fv({...n.pr.links.queryOptions({ref:e,base:ie.base,head:ie.head,fullPr:ie.fullPr}),staleTime:1/0,enabled:y===`links`}),ce=(0,C.useMemo)(()=>{let e=oe.data?.files??[],t=new Map(e.map(e=>[e.path,e])),n;if(y!==`links`)n=VL(e,y,b);else if(se.data){let t=se.data.edges.filter(e=>S||e.kind===`import`),r=e.map(e=>e.path);n=se.data.packages.length>0?yF(se.data.packages.map(e=>({items:e.files})),r,t):vF(r,t)}else return e;return n.flatMap(e=>t.get(e)??[])},[oe.data,y,b,se.data,S]),le=a.visit.mutate,z=(0,C.useRef)(!1);(0,C.useEffect)(()=>{z.current||(z.current=!0,le({ref:e,headOid:R,commitOids:t.commits.map(e=>e.oid)}))},[le,e,R,t.commits]);let B=(0,C.useMemo)(()=>new Set(t.seenHunks),[t.seenHunks]),V=(0,C.useMemo)(()=>{let e=new Map(t.files.map(e=>[e.path,e.viewed]));return ce.map(n=>{let r=t.threads.filter(e=>e.path===n.path&&!e.isResolved);return{path:n.path,additions:n.additions,deletions:n.deletions,state:CL(n,e.get(n.path),B).state,openThreads:r.length,unreadThreads:r.filter(e=>e.unread>0).length}})},[ce,t.files,t.threads,B]),ue=ae===`focus`?ce.find(e=>e.path===i.file)??ce.find(e=>t.files.find(t=>t.path===e.path)?.viewed!==`VIEWED`)??ce[0]??null:null,de=ae===`focus`?ue?.path??null:ce[M.fileIdx??-1]?.path??null,fe={ref:e,detail:t,diff:oe.data??null,me:t.viewer.login,range:ie,layout:c,mode:ae,pendingReviewId:t.pendingReview?.id??null,seenHunks:B,selection:w,setSelection:e=>{T(e),e&&D(null)},fileComposer:E,setFileComposer:e=>{D(e),e&&T(null)},focusedThread:O,setFocusedThread:k,canComment:e=>t.pr.state===`OPEN`&&ie.head===R&&(e===`RIGHT`||ie.fullPr),scrollToThread:e=>{k(e);let n=t.threads.find(t=>t.id===e);ae===`focus`&&n&&n.path!==ue?.path&&ce.some(e=>e.path===n.path)?(r({search:e=>({...e,file:n.path})}),requestAnimationFrame(()=>L.current?.scrollToThread(e))):L.current?.scrollToThread(e)},scrollToFile:e=>{ae===`focus`?r({search:t=>({...t,file:e})}):L.current?.scrollToFile(e)},advanceFrom:e=>{if(ae===`focus`){let n=oH(ce,t,e);n&&r({search:e=>({...e,file:n.path})});return}let n=ce[ce.findIndex(t=>t.path===e)+1];n&&L.current?.scrollToFile(n.path)}},pe=t.files.filter(e=>e.viewed===`VIEWED`).length,H=ce.reduce((e,t)=>e+t.hunks.length,0),me=ce.reduce((e,t)=>e+t.hunks.filter(e=>B.has(`${t.path}\n${e.hash}`)).length,0);return(0,W.jsx)(xF,{value:fe,children:(0,W.jsxs)(`div`,{className:`pr-page`,children:[(0,W.jsxs)(nH,{visitAt:te?.visitedAt??null,visitHead:ne,children:[(0,W.jsx)(Qm,{size:`xs`,value:ae,onChange:e=>void r({search:t=>({...t,mode:e===`focus`?`focus`:`continuous`})}),data:[{value:`continuous`,label:`Continu`},{value:`focus`,label:`Focus`}]}),(0,W.jsx)(Qm,{size:`xs`,value:c,onChange:e=>l(e===`unified`?`unified`:`split`),data:[{value:`split`,label:`Côte à côte`},{value:`unified`,label:`Unifié`}]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(Jm,{label:`${me}/${H} hunks vus dans la plage`,children:(0,W.jsxs)(ql,{gap:6,children:[(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[`Vu `,pe,`/`,t.files.length,` fichiers`]}),(0,W.jsx)(ym,{w:90,size:`sm`,color:`green`,value:t.files.length?pe/t.files.length*100:0})]})}),(0,W.jsx)(Qf,{size:`compact-sm`,variant:h?`light`:`default`,onClick:()=>g(!h),children:`Fichiers`}),(0,W.jsx)(Qf,{size:`compact-sm`,variant:u&&f===`description`?`light`:`default`,onClick:()=>m(`description`),children:`Description`}),(0,W.jsxs)(Qf,{size:`compact-sm`,variant:u&&f===`conversations`?`light`:`default`,onClick:()=>m(`conversations`),children:[`Conversations `,t.threads.filter(e=>!e.isResolved).length]}),(0,W.jsx)(Qf,{size:`compact-sm`,variant:u&&f===`neighbors`?`light`:`default`,onClick:()=>m(`neighbors`),children:`Voisinage`}),(0,W.jsx)(tH,{opened:ee,onChange:P})]}),s!==R&&ie.base!==s&&(0,W.jsx)($d,{color:`orange`,variant:`light`,radius:0,py:6,children:(0,W.jsxs)(ql,{gap:`sm`,children:[(0,W.jsx)(Z,{size:`sm`,children:`Nouveaux commits poussés pendant votre lecture.`}),(0,W.jsx)(Qf,{size:`compact-xs`,variant:`light`,color:`orange`,onClick:()=>void r({search:e=>({...e,range:`${s}..${R}`})}),children:`Voir uniquement ces changements`})]})}),ae===`focus`&&ue&&(0,W.jsx)(sH,{files:ce,current:ue}),(0,W.jsxs)(`div`,{className:`pr-body`,"data-tree":h?`open`:`closed`,"data-panel":u?`open`:`closed`,children:[h&&(0,W.jsx)(`aside`,{className:`pr-tree`,children:(0,W.jsx)($V,{stats:V,nav:y,onNavChange:v,sort:b,onSortChange:x,currentPath:de,onSelect:fe.scrollToFile})}),(0,W.jsxs)(`main`,{style:{minWidth:0,minHeight:0},children:[oe.isPending&&(0,W.jsx)(ep,{h:`100%`,children:(0,W.jsx)(kl,{})}),oe.isError&&(0,W.jsxs)($d,{color:`red`,m:`md`,title:`Diff indisponible pour cette plage`,children:[oe.error.message,(0,W.jsx)(Qf,{mt:`sm`,size:`xs`,onClick:()=>void r({search:e=>({...e,range:`all`})}),children:`Revenir à tous les changements`})]}),oe.data&&(0,W.jsx)(FL,{files:ce,onlyFile:ue?.path??null,collapsed:A,onToggleCollapse:e=>j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onCurrentChange:(e,t)=>N({fileIdx:e,hunkIdx:t}),handleRef:L})]}),u&&(0,W.jsxs)(`aside`,{className:`pr-panel`,children:[(0,W.jsx)(Qm,{className:`panel-tabs`,size:`xs`,fullWidth:!0,value:f,onChange:e=>p(e===`description`||e===`neighbors`?e:`conversations`),data:[{value:`conversations`,label:`Conversations ${t.threads.filter(e=>!e.isResolved).length}`},{value:`description`,label:`Description`},{value:`neighbors`,label:`Voisinage`}]}),(0,W.jsx)(`div`,{className:`panel-scroll`,children:f===`description`?(0,W.jsx)(DF,{}):f===`neighbors`?(0,W.jsx)(UV,{stats:V,currentPath:de,onSelect:fe.scrollToFile}):(0,W.jsx)(EF,{})})]})]}),(0,W.jsx)(cH,{files:ce,focusFile:ue,current:M,listRef:L,onToggleReview:()=>P(e=>!e),onToggleConversations:()=>m(`conversations`),onToggleDescription:()=>m(`description`),onToggleTree:()=>g(!h),onToggleLayout:()=>l(c===`split`?`unified`:`split`),onHelp:()=>I(!0)}),(0,W.jsx)(uH,{opened:F,onClose:()=>I(!1)})]})})}function oH(e,t,n){let r=e.findIndex(e=>e.path===n);return[...e.slice(r+1),...e.slice(0,r)].find(e=>t.files.find(t=>t.path===e.path)?.viewed!==`VIEWED`)}function sH({files:e,current:t}){let n=iS({from:`/$owner/$repo/pull/$number`}),r=EL(),i=SF(),a=e.indexOf(t),o=e=>e&&void n({search:t=>({...t,file:e.path})}),s=e.filter(e=>i.detail.files.find(t=>t.path===e.path)?.viewed!==`VIEWED`).length;return(0,W.jsxs)(ql,{className:`focus-bar`,gap:`sm`,px:`md`,py:6,children:[(0,W.jsxs)(Qf,{size:`compact-xs`,variant:`default`,onClick:()=>o(e[a-1]),disabled:a<=0,children:[`←`,` `,(0,W.jsx)(Bp,{size:`xs`,ml:4,children:`k`})]}),(0,W.jsx)(Z,{ff:`monospace`,fw:600,size:`sm`,children:t.path}),(0,W.jsxs)(Z,{size:`xs`,c:`dimmed`,children:[`fichier `,a+1,`/`,e.length,` · `,s,` non vu`,s>1?`s`:``]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(`div`,{className:`steps`,children:e.map(e=>{let n=i.detail.files.find(t=>t.path===e.path)?.viewed;return(0,W.jsx)(`i`,{title:e.path,"data-state":e===t?`current`:n===`VIEWED`?`viewed`:`none`,onClick:()=>o(e)},e.path)})}),(0,W.jsx)(Qf,{size:`compact-xs`,color:`green`,onClick:()=>{r.toggleFile(t,!0),i.advanceFrom(t.path)},rightSection:(0,W.jsx)(Bp,{size:`xs`,children:`v`}),children:`✓ Vu, suivant non vu`}),(0,W.jsxs)(Qf,{size:`compact-xs`,variant:`default`,onClick:()=>o(e[a+1]),disabled:a>=e.length-1,children:[(0,W.jsx)(Bp,{size:`xs`,mr:4,children:`j`}),` `,`→`]})]})}function cH(e){let t=SF(),n=wF(t.ref),r=EL(),i=iS({from:`/$owner/$repo/pull/$number`}),{files:a,focusFile:o,listRef:s}=e,c=o??a[e.current.fileIdx??-1]??null,l=c&&e.current.hunkIdx!==null?c.hunks[e.current.hunkIdx]:void 0,u=e=>{if(o){let t=a[a.indexOf(o)+e];t&&i({search:e=>({...e,file:t.path})})}else s.current?.step(`file`,e)},d=t.detail.threads.find(e=>e.id===t.focusedThread);return lt([[`j`,()=>u(1)],[`k`,()=>u(-1)],[`n`,()=>s.current?.step(`hunk`,1)],[`p`,()=>s.current?.step(`hunk`,-1)],[`]`,()=>s.current?.step(`thread`,1)],[`v`,()=>{if(!c)return;let e=t.detail.files.find(e=>e.path===c.path)?.viewed===`VIEWED`;r.toggleFile(c,!e),e||t.advanceFrom(c.path)}],[`h`,()=>{c&&l&&(r.toggleHunk(c,l,!t.seenHunks.has(`${c.path}\n${l.hash}`)),s.current?.step(`hunk`,1))}],[`r`,()=>{document.querySelector(`[data-thread="${t.focusedThread}"] [data-reply]`)?.click()}],[`x`,()=>d&&(d.isResolved?d.canUnresolve:d.canResolve)&&n.setResolved.mutate({threadId:d.id,resolved:!d.isResolved})],[`m`,()=>void i({search:e=>({...e,mode:t.mode===`focus`?`continuous`:`focus`})})],[`u`,e.onToggleLayout],[`t`,e.onToggleConversations],[`d`,e.onToggleDescription],[`f`,e.onToggleTree],[`shift+S`,e.onToggleReview],[`i`,()=>void i({to:`/`})],[`Escape`,()=>{t.setSelection(null),t.setFileComposer(null)}],[`shift+?`,e.onHelp]]),(0,W.jsxs)(`div`,{className:`statusbar`,children:[(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`j`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`k`}),` fichier`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`n`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`p`}),` hunk`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`]`}),`/`,(0,W.jsx)(Bp,{size:`xs`,children:`[`}),` thread ouvert`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`v`}),` fichier vu · `,(0,W.jsx)(Bp,{size:`xs`,children:`h`}),` hunk vu`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`r`}),` répondre · `,(0,W.jsx)(Bp,{size:`xs`,children:`x`}),` résoudre`]}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Bp,{size:`xs`,children:`?`}),` aide`]}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsxs)(`span`,{children:[c?c.path:``,c&&l?` · hunk ${(e.current.hunkIdx??0)+1}/${c.hunks.length}`:``]})]})}var lH=[[`j / k`,`fichier suivant / précédent`],[`n / p`,`hunk suivant / précédent`],[`] / [`,`thread non résolu suivant / précédent`],[`v`,`marquer le fichier vu, puis fichier suivant (focus : fichier non vu suivant)`],[`h`,`marquer le hunk courant vu, puis hunk suivant`],[`r`,`répondre au thread sélectionné`],[`x`,`résoudre / rouvrir le thread sélectionné`],[`clic n° de ligne`,`commenter (Maj+clic : plage)`],[`m`,`mode continu / focus`],[`u`,`côte à côte / unifié`],[`t`,`panneau conversations`],[`d`,`description de la PR`],[`f`,`arbre des fichiers`],[`Maj+S`,`soumettre la review`],[`i`,`retour à l’inbox`],[`Ctrl+K`,`aller à une PR`],[`Échap`,`fermer le commentaire en cours`]];function uH(e){return(0,W.jsx)(rm,{opened:e.opened,onClose:e.onClose,title:`Raccourcis clavier`,size:`md`,children:(0,W.jsx)(xh,{children:(0,W.jsx)(xh.Tbody,{children:lH.map(([e,t])=>(0,W.jsxs)(xh.Tr,{children:[(0,W.jsx)(xh.Td,{children:(0,W.jsx)(Bp,{children:e})}),(0,W.jsx)(xh.Td,{children:t})]},e))})})})}function dH(){let e=TE(),t=Gg(),n=fv(e.config.get.queryOptions()),[r,i]=(0,C.useState)(`repo`),[a,o]=(0,C.useState)(``),s=()=>{t.invalidateQueries({queryKey:e.config.get.queryKey()}),t.invalidateQueries({queryKey:e.inbox.get.queryKey()})},c=hv(e.config.add.mutationOptions({onSuccess:()=>{o(``),s()},onError:e=>ng.show({color:`red`,title:`Ajout impossible`,message:e.message})})),l=hv(e.config.remove.mutationOptions({onSuccess:s})),u=[...n.data?.orgs.map(e=>({kind:`org`,name:e}))??[],...n.data?.repos.map(e=>({kind:`repo`,name:e}))??[]];return(0,W.jsxs)(pp,{size:`sm`,py:`xl`,children:[(0,W.jsx)(zh,{order:2,mb:`xs`,children:`Repos et orgs suivis`}),(0,W.jsx)(Z,{c:`dimmed`,size:`sm`,mb:`lg`,children:`L’inbox ne montre que les PR de cette liste. Une org (ou un compte) suivie inclut tous ses repos. Le fichier de config peut aussi être édité à la main : les modifications sont prises en compte à chaud.`}),(0,W.jsx)(`form`,{onSubmit:e=>{e.preventDefault();let t=a.trim();t&&c.mutate({kind:r,name:t})},children:(0,W.jsxs)(ql,{align:`flex-end`,mb:`lg`,children:[(0,W.jsx)(Qm,{value:r,onChange:e=>i(e===`org`?`org`:`repo`),data:[{value:`repo`,label:`Repo`},{value:`org`,label:`Org / compte`}]}),(0,W.jsx)(Mh,{style:{flex:1},placeholder:r===`repo`?`owner/repo`:`nom-de-l-org`,value:a,onChange:e=>o(e.currentTarget.value),"data-autofocus":!0}),(0,W.jsx)(Qf,{type:`submit`,loading:c.isPending,children:`Suivre`})]})}),(0,W.jsxs)(nh,{gap:`xs`,children:[u.length===0&&(0,W.jsx)(Z,{c:`dimmed`,children:`Aucun repo suivi pour l’instant.`}),u.map(e=>(0,W.jsx)(Nc,{withBorder:!0,p:`xs`,px:`sm`,children:(0,W.jsxs)(ql,{justify:`space-between`,children:[(0,W.jsxs)(ql,{gap:`xs`,children:[(0,W.jsx)(Uf,{variant:`light`,color:e.kind===`org`?`violet`:`blue`,children:e.kind===`org`?`org`:`repo`}),(0,W.jsx)(Z,{ff:`monospace`,size:`sm`,children:e.name})]}),(0,W.jsx)(Ll,{variant:`subtle`,color:`red`,"aria-label":`Ne plus suivre ${e.name}`,onClick:()=>l.mutate(e),children:`✕`})]})},`${e.kind}:${e.name}`))]})]})}var fH=wS({component:kE}),pH=SS({getParentRoute:()=>fH,path:`/`,validateSearch:e=>typeof e.section==`string`?{section:e.section}:{},component:zE}),mH=SS({getParentRoute:()=>fH,path:`/settings`,component:dH}),hH=SS({getParentRoute:()=>fH,path:`/$owner/$repo/pull/$number`,validateSearch:e=>({...typeof e.range==`string`?{range:e.range}:{},...e.mode===`focus`||e.mode===`continuous`?{mode:e.mode}:{},...typeof e.file==`string`?{file:e.file}:{}}),component:rH}),gH=BS({routeTree:fH.addChildren([pH,mH,hH]),defaultPreload:`intent`,scrollRestoration:!1}),_H=tr({primaryColor:`blue`,defaultRadius:`sm`,fontFamilyMonospace:`ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace`,cursorType:`pointer`});(0,WC.createRoot)(document.getElementById(`root`)).render((0,W.jsx)(C.StrictMode,{children:(0,W.jsxs)(er,{theme:_H,defaultColorScheme:`dark`,forceColorScheme:`dark`,children:[(0,W.jsx)(Ug,{position:`bottom-left`,limit:4}),(0,W.jsx)(Kg,{client:DE,children:(0,W.jsx)(wE,{trpcClient:OE,queryClient:DE,children:(0,W.jsx)(US,{router:gH})})})]})}));
|