(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{23541:function(e,t,n){"use strict";n.d(t,{Ry:function(){return c}});var r=new WeakMap,o=new WeakMap,i={},s=0,l=function(e){return e&&(e.host||l(e.parentNode))},a=function(e,t,n,a){var c=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=l(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});i[n]||(i[n]=new WeakMap);var u=i[n],h=[],d=new Set,f=new Set(c),p=function(e){!e||d.has(e)||(d.add(e),p(e.parentNode))};c.forEach(p);var m=function(e){!e||f.has(e)||Array.prototype.forEach.call(e.children,function(e){if(d.has(e))m(e);else try{var t=e.getAttribute(a),i=null!==t&&"false"!==t,s=(r.get(e)||0)+1,l=(u.get(e)||0)+1;r.set(e,s),u.set(e,l),h.push(e),1===s&&i&&o.set(e,!0),1===l&&e.setAttribute(n,"true"),i||e.setAttribute(a,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return m(t),d.clear(),s++,function(){h.forEach(function(e){var t=r.get(e)-1,i=u.get(e)-1;r.set(e,t),u.set(e,i),t||(o.has(e)||e.removeAttribute(a),o.delete(e)),i||e.removeAttribute(n)}),--s||(r=new WeakMap,r=new WeakMap,o=new WeakMap,i={})}},c=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||("undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),a(r,o,n,"aria-hidden")):function(){return null}}},83454:function(e,t,n){"use strict";var r,o;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(o=n.g.process)?void 0:o.env)?n.g.process:n(77663)},91118:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return n(32586)}])},60998:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(67294);/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(" ")};/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let l=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:o=24,strokeWidth:l=2,absoluteStrokeWidth:a,className:c="",children:u,iconNode:h,...d}=e;return(0,r.createElement)("svg",{ref:t,...s,width:o,height:o,stroke:n,strokeWidth:a?24*Number(l)/Number(o):l,className:i("lucide",c),...d},[...h.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),a=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:a,...c}=n;return(0,r.createElement)(l,{ref:s,iconNode:t,className:i("lucide-".concat(o(e)),a),...c})});return n.displayName="".concat(e),n}},70282:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,n(60998).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},45895:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,n(60998).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},43767:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,n(60998).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},56101:function(e,t){"use strict";var n,r,o,i;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION_FAST_REFRESH:function(){return h},ACTION_NAVIGATE:function(){return l},ACTION_PREFETCH:function(){return u},ACTION_REFRESH:function(){return s},ACTION_RESTORE:function(){return a},ACTION_SERVER_ACTION:function(){return d},ACTION_SERVER_PATCH:function(){return c},PrefetchCacheEntryStatus:function(){return r},PrefetchKind:function(){return n},isThenable:function(){return f}});let s="refresh",l="navigate",a="restore",c="server-patch",u="prefetch",h="fast-refresh",d="server-action";function f(e){return e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}(o=n||(n={})).AUTO="auto",o.FULL="full",o.TEMPORARY="temporary",(i=r||(r={})).fresh="fresh",i.reusable="reusable",i.expired="expired",i.stale="stale",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},27670:function(e,t,n){"use strict";function r(e,t,n,r){return!1}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDomainLocale",{enumerable:!0,get:function(){return r}}),n(51297),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},26821:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return y}});let r=n(10260),o=n(77697),i=n(85893),s=o._(n(67294)),l=r._(n(73935)),a=r._(n(37219)),c=n(21128),u=n(76252),h=n(29146);n(42723);let d=n(54494),f=r._(n(95176)),p={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/dashboard/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0};function m(e,t,n,r,o,i,s){let l=null==e?void 0:e.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&o(!0),null==n?void 0:n.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,o=!1;n.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>o,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{o=!0,t.stopPropagation()}})}(null==r?void 0:r.current)&&r.current(e)}}))}function g(e){return s.use?{fetchPriority:e}:{fetchpriority:e}}let v=(0,s.forwardRef)((e,t)=>{let{src:n,srcSet:r,sizes:o,height:l,width:a,decoding:c,className:u,style:h,fetchPriority:d,placeholder:f,loading:p,unoptimized:v,fill:b,onLoadRef:y,onLoadingCompleteRef:w,setBlurComplete:x,setShowAltText:k,sizesInput:S,onLoad:C,onError:O,...E}=e;return(0,i.jsx)("img",{...E,...g(d),loading:p,width:a,height:l,decoding:c,"data-nimg":b?"fill":"1",className:u,style:h,sizes:o,srcSet:r,src:n,ref:(0,s.useCallback)(e=>{t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e&&(O&&(e.src=e.src),e.complete&&m(e,f,y,w,x,v,S))},[n,f,y,w,x,O,v,S,t]),onLoad:e=>{m(e.currentTarget,f,y,w,x,v,S)},onError:e=>{k(!0),"empty"!==f&&x(!0),O&&O(e)}})});function b(e){let{isAppRouter:t,imgAttributes:n}=e,r={as:"image",imageSrcSet:n.srcSet,imageSizes:n.sizes,crossOrigin:n.crossOrigin,referrerPolicy:n.referrerPolicy,...g(n.fetchPriority)};return t&&l.default.preload?(l.default.preload(n.src,r),null):(0,i.jsx)(a.default,{children:(0,i.jsx)("link",{rel:"preload",href:n.srcSet?void 0:n.src,...r},"__nimg-"+n.src+n.srcSet+n.sizes)})}let y=(0,s.forwardRef)((e,t)=>{let n=(0,s.useContext)(d.RouterContext),r=(0,s.useContext)(h.ImageConfigContext),o=(0,s.useMemo)(()=>{let e=p||r||u.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),n=e.deviceSizes.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:n}},[r]),{onLoad:l,onLoadingComplete:a}=e,m=(0,s.useRef)(l);(0,s.useEffect)(()=>{m.current=l},[l]);let g=(0,s.useRef)(a);(0,s.useEffect)(()=>{g.current=a},[a]);let[y,w]=(0,s.useState)(!1),[x,k]=(0,s.useState)(!1),{props:S,meta:C}=(0,c.getImgProps)(e,{defaultLoader:f.default,imgConf:o,blurComplete:y,showAltText:x});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v,{...S,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:m,onLoadingCompleteRef:g,setBlurComplete:w,setShowAltText:k,sizesInput:e.sizes,ref:t}),C.priority?(0,i.jsx)(b,{isAppRouter:!n,imgAttributes:S}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24116:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return w}});let r=n(10260),o=n(85893),i=r._(n(67294)),s=n(69975),l=n(92712),a=n(28547),c=n(84350),u=n(38109),h=n(54494),d=n(55716),f=n(388),p=n(27670),m=n(6220),g=n(56101),v=new Set;function b(e,t,n,r,o,i){if(i||(0,l.isLocalURL)(t)){if(!r.bypassPrefetchedCheck){let o=t+"%"+n+"%"+(void 0!==r.locale?r.locale:"locale"in e?e.locale:void 0);if(v.has(o))return;v.add(o)}(async()=>i?e.prefetch(t,o):e.prefetch(t,n,r))().catch(e=>{})}}function y(e){return"string"==typeof e?e:(0,a.formatUrl)(e)}let w=i.default.forwardRef(function(e,t){let n,r;let{href:a,as:v,children:w,prefetch:x=null,passHref:k,replace:S,shallow:C,scroll:O,locale:E,onClick:P,onMouseEnter:T,onTouchStart:M,legacyBehavior:A=!1,...R}=e;n=w,A&&("string"==typeof n||"number"==typeof n)&&(n=(0,o.jsx)("a",{children:n}));let _=i.default.useContext(h.RouterContext),D=i.default.useContext(d.AppRouterContext),N=null!=_?_:D,L=!_,I=!1!==x,j=null===x?g.PrefetchKind.AUTO:g.PrefetchKind.FULL,{href:B,as:W}=i.default.useMemo(()=>{if(!_){let e=y(a);return{href:e,as:v?y(v):e}}let[e,t]=(0,s.resolveHref)(_,a,!0);return{href:e,as:v?(0,s.resolveHref)(_,v):t||e}},[_,a,v]),F=i.default.useRef(B),$=i.default.useRef(W);A&&(r=i.default.Children.only(n));let z=A?r&&"object"==typeof r&&r.ref:t,[H,q,V]=(0,f.useIntersection)({rootMargin:"200px"}),U=i.default.useCallback(e=>{($.current!==W||F.current!==B)&&(V(),$.current=W,F.current=B),H(e),z&&("function"==typeof z?z(e):"object"==typeof z&&(z.current=e))},[W,z,B,V,H]);i.default.useEffect(()=>{N&&q&&I&&b(N,B,W,{locale:E},{kind:j},L)},[W,B,q,E,I,null==_?void 0:_.locale,N,L,j]);let G={ref:U,onClick(e){A||"function"!=typeof P||P(e),A&&r.props&&"function"==typeof r.props.onClick&&r.props.onClick(e),N&&!e.defaultPrevented&&function(e,t,n,r,o,s,a,c,u){let{nodeName:h}=e.currentTarget;if("A"===h.toUpperCase()&&(function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||!u&&!(0,l.isLocalURL)(n)))return;e.preventDefault();let d=()=>{let e=null==a||a;"beforePopState"in t?t[o?"replace":"push"](n,r,{shallow:s,locale:c,scroll:e}):t[o?"replace":"push"](r||n,{scroll:e})};u?i.default.startTransition(d):d()}(e,N,B,W,S,C,O,E,L)},onMouseEnter(e){A||"function"!=typeof T||T(e),A&&r.props&&"function"==typeof r.props.onMouseEnter&&r.props.onMouseEnter(e),N&&(I||!L)&&b(N,B,W,{locale:E,priority:!0,bypassPrefetchedCheck:!0},{kind:j},L)},onTouchStart:function(e){A||"function"!=typeof M||M(e),A&&r.props&&"function"==typeof r.props.onTouchStart&&r.props.onTouchStart(e),N&&(I||!L)&&b(N,B,W,{locale:E,priority:!0,bypassPrefetchedCheck:!0},{kind:j},L)}};if((0,c.isAbsoluteUrl)(W))G.href=W;else if(!A||k||"a"===r.type&&!("href"in r.props)){let e=void 0!==E?E:null==_?void 0:_.locale,t=(null==_?void 0:_.isLocaleDomain)&&(0,p.getDomainLocale)(W,e,null==_?void 0:_.locales,null==_?void 0:_.domainLocales);G.href=t||(0,m.addBasePath)((0,u.addLocale)(W,e,null==_?void 0:_.defaultLocale))}return A?i.default.cloneElement(r,G):(0,o.jsx)("a",{...R,...G,children:n})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},388:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useIntersection",{enumerable:!0,get:function(){return a}});let r=n(67294),o=n(40460),i="function"==typeof IntersectionObserver,s=new Map,l=[];function a(e){let{rootRef:t,rootMargin:n,disabled:a}=e,c=a||!i,[u,h]=(0,r.useState)(!1),d=(0,r.useRef)(null),f=(0,r.useCallback)(e=>{d.current=e},[]);return(0,r.useEffect)(()=>{if(i){if(c||u)return;let e=d.current;if(e&&e.tagName)return function(e,t,n){let{id:r,observer:o,elements:i}=function(e){let t;let n={root:e.root||null,margin:e.rootMargin||""},r=l.find(e=>e.root===n.root&&e.margin===n.margin);if(r&&(t=s.get(r)))return t;let o=new Map;return t={id:n,observer:new IntersectionObserver(e=>{e.forEach(e=>{let t=o.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e),elements:o},l.push(n),s.set(n,t),t}(n);return i.set(e,t),o.observe(e),function(){if(i.delete(e),o.unobserve(e),0===i.size){o.disconnect(),s.delete(r);let e=l.findIndex(e=>e.root===r.root&&e.margin===r.margin);e>-1&&l.splice(e,1)}}}(e,e=>e&&h(e),{root:null==t?void 0:t.current,rootMargin:n})}else if(!u){let e=(0,o.requestIdleCallback)(()=>h(!0));return()=>(0,o.cancelIdleCallback)(e)}},[c,n,t,u,d.current]),[f,u,(0,r.useCallback)(()=>{h(!1)},[])]}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},19606:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return l},noSSR:function(){return s}});let r=n(10260);n(85893),n(67294);let o=r._(n(6119));function i(e){return{default:(null==e?void 0:e.default)||e}}function s(e,t){return delete t.webpack,delete t.modules,e(t)}function l(e,t){let n=o.default,r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};e instanceof Promise?r.loader=()=>e:"function"==typeof e?r.loader=e:"object"==typeof e&&(r={...r,...e});let l=(r={...r,...t}).loader;return(r.loadableGenerated&&(r={...r,...r.loadableGenerated},delete r.loadableGenerated),"boolean"!=typeof r.ssr||r.ssr)?n({...r,loader:()=>null!=l?l().then(i):Promise.resolve(i(()=>null))}):(delete r.webpack,delete r.modules,s(n,r))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},21128:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return l}}),n(42723);let r=n(32685),o=n(76252);function i(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function l(e,t){var n;let l,a,c,{src:u,sizes:h,unoptimized:d=!1,priority:f=!1,loading:p,className:m,quality:g,width:v,height:b,fill:y=!1,style:w,overrideSrc:x,onLoad:k,onLoadingComplete:S,placeholder:C="empty",blurDataURL:O,fetchPriority:E,layout:P,objectFit:T,objectPosition:M,lazyBoundary:A,lazyRoot:R,..._}=e,{imgConf:D,showAltText:N,blurComplete:L,defaultLoader:I}=t,j=D||o.imageConfigDefault;if("allSizes"in j)l=j;else{let e=[...j.deviceSizes,...j.imageSizes].sort((e,t)=>e-t),t=j.deviceSizes.sort((e,t)=>e-t);l={...j,allSizes:e,deviceSizes:t}}if(void 0===I)throw Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config");let B=_.loader||I;delete _.loader,delete _.srcSet;let W="__next_img_default"in B;if(W){if("custom"===l.loader)throw Error('Image with src "'+u+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader')}else{let e=B;B=t=>{let{config:n,...r}=t;return e(r)}}if(P){"fill"===P&&(y=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[P];e&&(w={...w,...e});let t={responsive:"100vw",fill:"100vw"}[P];t&&!h&&(h=t)}let F="",$=s(v),z=s(b);if("object"==typeof(n=u)&&(i(n)||void 0!==n.src)){let e=i(u)?u.default:u;if(!e.src)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e));if(!e.height||!e.width)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e));if(a=e.blurWidth,c=e.blurHeight,O=O||e.blurDataURL,F=e.src,!y){if($||z){if($&&!z){let t=$/e.width;z=Math.round(e.height*t)}else if(!$&&z){let t=z/e.height;$=Math.round(e.width*t)}}else $=e.width,z=e.height}}let H=!f&&("lazy"===p||void 0===p);(!(u="string"==typeof u?u:F)||u.startsWith("data:")||u.startsWith("blob:"))&&(d=!0,H=!1),l.unoptimized&&(d=!0),W&&u.endsWith(".svg")&&!l.dangerouslyAllowSVG&&(d=!0),f&&(E="high");let q=s(g),V=Object.assign(y?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:T,objectPosition:M}:{},N?{}:{color:"transparent"},w),U=L||"empty"===C?null:"blur"===C?'url("data:image/svg+xml;charset=utf-8,'+(0,r.getImageBlurSvg)({widthInt:$,heightInt:z,blurWidth:a,blurHeight:c,blurDataURL:O||"",objectFit:V.objectFit})+'")':'url("'+C+'")',G=U?{backgroundSize:V.objectFit||"cover",backgroundPosition:V.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:U}:{},X=function(e){let{config:t,src:n,unoptimized:r,width:o,quality:i,sizes:s,loader:l}=e;if(r)return{src:n,srcSet:void 0,sizes:void 0};let{widths:a,kind:c}=function(e,t,n){let{deviceSizes:r,allSizes:o}=e;if(n){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let r;r=e.exec(n);r)t.push(parseInt(r[2]));if(t.length){let e=.01*Math.min(...t);return{widths:o.filter(t=>t>=r[0]*e),kind:"w"}}return{widths:o,kind:"w"}}return"number"!=typeof t?{widths:r,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>o.find(t=>t>=e)||o[o.length-1]))],kind:"x"}}(t,o,s),u=a.length-1;return{sizes:s||"w"!==c?s:"100vw",srcSet:a.map((e,r)=>l({config:t,src:n,quality:i,width:e})+" "+("w"===c?e:r+1)+c).join(", "),src:l({config:t,src:n,quality:i,width:a[u]})}}({config:l,src:u,unoptimized:d,width:$,quality:q,sizes:h,loader:B});return{props:{..._,loading:H?"lazy":p,fetchPriority:E,width:$,height:z,decoding:"async",className:m,style:{...V,...G},sizes:X.sizes,srcSet:X.srcSet,src:x||X.src},meta:{unoptimized:d,priority:f,placeholder:C,fill:y}}}},32685:function(e,t){"use strict";function n(e){let{widthInt:t,heightInt:n,blurWidth:r,blurHeight:o,blurDataURL:i,objectFit:s}=e,l=r?40*r:t,a=o?40*o:n,c=l&&a?"viewBox='0 0 "+l+" "+a+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+c+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(c?"none":"contain"===s?"xMidYMid":"cover"===s?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+i+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return n}})},7e4:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return a},getImageProps:function(){return l}});let r=n(10260),o=n(21128),i=n(26821),s=r._(n(95176));function l(e){let{props:t}=(0,o.getImgProps)(e,{defaultLoader:s.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/dashboard/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0}});for(let[e,n]of Object.entries(t))void 0===n&&delete t[e];return{props:t}}let a=i.Image},95176:function(e,t){"use strict";function n(e){let{config:t,src:n,width:r,quality:o}=e;return t.path+"?url="+encodeURIComponent(n)+"&w="+r+"&q="+(o||75)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}}),n.__next_img_default=!0;let r=n},16725:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"LoadableContext",{enumerable:!0,get:function(){return r}});let r=n(10260)._(n(67294)).default.createContext(null)},6119:function(e,t,n){"use strict";/**
@copyright (c) 2017-present James Kyle <me@thejameskyle.com>
 MIT License
 Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
 The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
*/Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return d}});let r=n(10260)._(n(67294)),o=n(16725),i=[],s=[],l=!1;function a(e){let t=e(),n={loading:!0,loaded:null,error:null};return n.promise=t.then(e=>(n.loading=!1,n.loaded=e,e)).catch(e=>{throw n.loading=!1,n.error=e,e}),n}class c{promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}}function u(e){return function(e,t){let n=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},t),i=null;function a(){if(!i){let t=new c(e,n);i={getCurrentValue:t.getCurrentValue.bind(t),subscribe:t.subscribe.bind(t),retry:t.retry.bind(t),promise:t.promise.bind(t)}}return i.promise()}if(!l){let e=n.webpack?n.webpack():n.modules;e&&s.push(t=>{for(let n of e)if(t.includes(n))return a()})}function u(e,t){!function(){a();let e=r.default.useContext(o.LoadableContext);e&&Array.isArray(n.modules)&&n.modules.forEach(t=>{e(t)})}();let s=r.default.useSyncExternalStore(i.subscribe,i.getCurrentValue,i.getCurrentValue);return r.default.useImperativeHandle(t,()=>({retry:i.retry}),[]),r.default.useMemo(()=>{var t;return s.loading||s.error?r.default.createElement(n.loading,{isLoading:s.loading,pastDelay:s.pastDelay,timedOut:s.timedOut,error:s.error,retry:i.retry}):s.loaded?r.default.createElement((t=s.loaded)&&t.default?t.default:t,e):null},[e,s])}return u.preload=()=>a(),u.displayName="LoadableComponent",r.default.forwardRef(u)}(a,e)}function h(e,t){let n=[];for(;e.length;){let r=e.pop();n.push(r(t))}return Promise.all(n).then(()=>{if(e.length)return h(e,t)})}u.preloadAll=()=>new Promise((e,t)=>{h(i).then(e,t)}),u.preloadReady=e=>(void 0===e&&(e=[]),new Promise(t=>{let n=()=>(l=!0,t());h(s,e).then(n,n)})),window.__NEXT_PRELOADREADY=u.preloadReady;let d=u},91623:function(e,t,n){"use strict";n.d(t,{$h:function(){return m},on:function(){return p},Bx:function(){return g},pU:function(){return h}});var r=n(85893),o=n(67294),i=n(60998);/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,i.Z)("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]),l=(0,i.Z)("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);var a=n(470),c=n(47145);let u=(0,o.createContext)({version:null,latestVersion:null,commit:null,plugins:[]});function h(e){let{children:t}=e,[n,i]=(0,o.useState)(null),[s,l]=(0,o.useState)(null),[a,h]=(0,o.useState)(null),[d,f]=(0,o.useState)([]),p=async()=>{let[e,t]=await Promise.all([c.x.get("/api/health"),c.x.get("/api/plugins")]);if(e.ok){let t=await e.json();t.version&&i(t.version),t.commit&&h(t.commit),t.latest_version&&l(t.latest_version)}else console.error("API request /api/health failed with status ".concat(e.status));if(t.ok){let e=await t.json();e.plugins&&e.plugins.length>0&&f(e.plugins)}else console.error("API request /api/plugins failed with status ".concat(t.status))};return(0,o.useEffect)(()=>{p()},[]),(0,r.jsx)(u.Provider,{value:{version:n,latestVersion:s,commit:a,plugins:d},children:t})}function d(){return(0,o.useContext)(u)}function f(e){let{children:t,version:n,latestVersion:o,commit:i,plugins:s,showUpdateInfo:l=!0,showCommit:c=!0}=e,u=(0,r.jsxs)("div",{className:"flex flex-col gap-0.5",children:[l&&o&&(0,r.jsxs)("div",{className:"mb-1",children:[(0,r.jsx)("div",{className:"font-bold",children:"Update Available"}),(0,r.jsxs)("div",{children:["Current version: ",n]}),(0,r.jsxs)("div",{children:["New version available: ",o]})]}),c&&i&&(0,r.jsxs)("div",{children:[s.length>0?"Core commit":"Commit",": ",i]}),s.filter(e=>!e.hidden_from_display).map((e,t)=>{let n=e.name||"Unknown Plugin",o=[];return e.version&&o.push(e.version),c&&e.commit&&o.push(e.commit),o.length>0?(0,r.jsxs)("div",{children:[n,": ",o.join(" - ")]},t):null}),!i&&0===s.length&&(!o||!l)&&(0,r.jsx)("div",{children:"Version information not available"})]});return(0,r.jsx)(a.Md,{content:u,className:"text-sm text-muted-foreground",children:t})}function p(){let{version:e,latestVersion:t,commit:n,plugins:o}=d();return e&&t?(0,r.jsx)(f,{version:e,latestVersion:t,commit:n,plugins:o,showCommit:!1,children:(0,r.jsx)("div",{className:"inline-flex items-center justify-center transition-colors duration-150 cursor-help",children:(0,r.jsx)("div",{className:"p-2 rounded-full text-gray-600 hover:bg-gray-100 hover:text-blue-600",children:(0,r.jsx)(s,{className:"w-5 h-5"})})})}):null}function m(){let{latestVersion:e}=d();return e?(0,r.jsxs)("div",{className:"flex items-center mr-4 text-amber-600 animate-pulse",children:[(0,r.jsx)(l,{className:"w-4 h-4 mr-1.5"}),(0,r.jsxs)("span",{className:"text-sm font-medium",children:["New version available: ",e]})]}):null}function g(){let{version:e,latestVersion:t,commit:n,plugins:o}=d();return e?(0,r.jsx)(f,{version:e,latestVersion:t,commit:n,plugins:o,showUpdateInfo:!1,children:(0,r.jsx)("div",{className:"inline-flex items-center justify-center transition-colors duration-150 cursor-help",children:(0,r.jsxs)("div",{className:"text-sm text-gray-500 border-b border-dotted border-gray-400 hover:text-blue-600 hover:border-blue-600",children:["Version: ",e]})})}):null}},72242:function(e,t,n){"use strict";n.d(t,{X:function(){return i},b:function(){return o}});var r=n(85893);n(67294);let o=e=>{let{className:t="",variant:n="default",children:o,...i}=e;return(0,r.jsx)("div",{role:"alert",className:"".concat("relative w-full rounded-lg border p-4 flex items-start space-x-2"," ").concat({default:"bg-blue-50 border-blue-200 text-blue-800",destructive:"bg-red-50 border-red-200 text-red-800"}[n]," ").concat(t),...i,children:o})},i=e=>{let{className:t="",children:n,...o}=e;return(0,r.jsx)("div",{className:"text-sm leading-relaxed ".concat(t),...o,children:n})}},30803:function(e,t,n){"use strict";n.d(t,{d:function(){return a},z:function(){return c}});var r=n(85893),o=n(67294),i=n(88426),s=n(12003),l=n(46990);let a=(0,s.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=o.forwardRef((e,t)=>{let{className:n,variant:o,size:s,asChild:c=!1,...u}=e,h=c?i.g7:"button";return(0,r.jsx)(h,{className:(0,l.cn)(a({variant:o,size:s,className:n})),ref:t,...u})});c.displayName="Button"},37673:function(e,t,n){"use strict";n.d(t,{Ol:function(){return c},SZ:function(){return h},Zb:function(){return a},aY:function(){return d},eW:function(){return f},ll:function(){return u}});var r=n(85893),o=n(67294),i=n(45697),s=n.n(i),l=n(46990);let a=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",n),...i,children:o})});a.displayName="Card",a.propTypes={className:s().string,children:s().node};let c=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",n),...i,children:o})});c.displayName="CardHeader",c.propTypes={className:s().string,children:s().node};let u=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsx)("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",n),...i,children:o})});u.displayName="CardTitle",u.propTypes={className:s().string,children:s().node};let h=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsx)("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",n),...i,children:o})});h.displayName="CardDescription",h.propTypes={className:s().string,children:s().node};let d=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",n),...i,children:o})});d.displayName="CardContent",d.propTypes={className:s().string,children:s().node};let f=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",n),...i,children:o})});f.displayName="CardFooter",f.propTypes={className:s().string,children:s().node}},91360:function(e,t,n){"use strict";n.d(t,{Vq:function(){return en},GG:function(){return ei},cZ:function(){return el},Be:function(){return eh},cN:function(){return ec},fK:function(){return ea},t9:function(){return es},PK:function(){return eo},$N:function(){return eu},hg:function(){return er}});var r=n(85893),o=n(67294),i=n(36206),s=n(28771),l=n(25360),a=n(91276),c=n(77342),u=n(46063),h=n(95420),d=n(42651),f=n(9981),p=e=>{let t,n;let{present:r,children:i}=e,l=function(e){var t,n;let[r,i]=o.useState(),s=o.useRef(null),l=o.useRef(e),a=o.useRef("none"),[c,u]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},o.useReducer((e,t)=>n[e][t]??e,t));return o.useEffect(()=>{let e=m(s.current);a.current="mounted"===c?e:"none"},[c]),(0,f.b)(()=>{let t=s.current,n=l.current;if(n!==e){let r=a.current,o=m(t);e?u("MOUNT"):"none"===o||t?.display==="none"?u("UNMOUNT"):n&&r!==o?u("ANIMATION_OUT"):u("UNMOUNT"),l.current=e}},[e,u]),(0,f.b)(()=>{if(r){let e;let t=r.ownerDocument.defaultView??window,n=n=>{let o=m(s.current).includes(n.animationName);if(n.target===r&&o&&(u("ANIMATION_END"),!l.current)){let n=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=n)})}},o=e=>{e.target===r&&(a.current=m(s.current))};return r.addEventListener("animationstart",o),r.addEventListener("animationcancel",n),r.addEventListener("animationend",n),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",n),r.removeEventListener("animationend",n)}}u("ANIMATION_END")},[r,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:o.useCallback(e=>{s.current=e?getComputedStyle(e):null,i(e)},[])}}(r),a="function"==typeof i?i({present:l.isPresent}):o.Children.only(i),c=(0,s.e)(l.ref,(t=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning?a.ref:(t=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning?a.props.ref:a.props.ref||a.ref);return"function"==typeof i||l.isPresent?o.cloneElement(a,{ref:c}):null};function m(e){return e?.animationName||"none"}p.displayName="Presence";var g=n(75320),v=n(27552),b=n(6223),y=n(23541),w=n(88426),x="Dialog",[k,S]=(0,l.b)(x),[C,O]=k(x),E=e=>{let{__scopeDialog:t,children:n,open:i,defaultOpen:s,onOpenChange:l,modal:u=!0}=e,h=o.useRef(null),d=o.useRef(null),[f,p]=(0,c.T)({prop:i,defaultProp:s??!1,onChange:l,caller:x});return(0,r.jsx)(C,{scope:t,triggerRef:h,contentRef:d,contentId:(0,a.M)(),titleId:(0,a.M)(),descriptionId:(0,a.M)(),open:f,onOpenChange:p,onOpenToggle:o.useCallback(()=>p(e=>!e),[p]),modal:u,children:n})};E.displayName=x;var P="DialogTrigger",T=o.forwardRef((e,t)=>{let{__scopeDialog:n,...o}=e,l=O(P,n),a=(0,s.e)(t,l.triggerRef);return(0,r.jsx)(g.WV.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":X(l.open),...o,ref:a,onClick:(0,i.M)(e.onClick,l.onOpenToggle)})});T.displayName=P;var M="DialogPortal",[A,R]=k(M,{forceMount:void 0}),_=e=>{let{__scopeDialog:t,forceMount:n,children:i,container:s}=e,l=O(M,t);return(0,r.jsx)(A,{scope:t,forceMount:n,children:o.Children.map(i,e=>(0,r.jsx)(p,{present:n||l.open,children:(0,r.jsx)(d.h,{asChild:!0,container:s,children:e})}))})};_.displayName=M;var D="DialogOverlay",N=o.forwardRef((e,t)=>{let n=R(D,e.__scopeDialog),{forceMount:o=n.forceMount,...i}=e,s=O(D,e.__scopeDialog);return s.modal?(0,r.jsx)(p,{present:o||s.open,children:(0,r.jsx)(I,{...i,ref:t})}):null});N.displayName=D;var L=(0,w.Z8)("DialogOverlay.RemoveScroll"),I=o.forwardRef((e,t)=>{let{__scopeDialog:n,...o}=e,i=O(D,n);return(0,r.jsx)(b.Z,{as:L,allowPinchZoom:!0,shards:[i.contentRef],children:(0,r.jsx)(g.WV.div,{"data-state":X(i.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),j="DialogContent",B=o.forwardRef((e,t)=>{let n=R(j,e.__scopeDialog),{forceMount:o=n.forceMount,...i}=e,s=O(j,e.__scopeDialog);return(0,r.jsx)(p,{present:o||s.open,children:s.modal?(0,r.jsx)(W,{...i,ref:t}):(0,r.jsx)(F,{...i,ref:t})})});B.displayName=j;var W=o.forwardRef((e,t)=>{let n=O(j,e.__scopeDialog),l=o.useRef(null),a=(0,s.e)(t,n.contentRef,l);return o.useEffect(()=>{let e=l.current;if(e)return(0,y.Ry)(e)},[]),(0,r.jsx)($,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,i.M)(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:(0,i.M)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:(0,i.M)(e.onFocusOutside,e=>e.preventDefault())})}),F=o.forwardRef((e,t)=>{let n=O(j,e.__scopeDialog),i=o.useRef(!1),s=o.useRef(!1);return(0,r.jsx)($,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(i.current||n.triggerRef.current?.focus(),t.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(i.current=!0,"pointerdown"!==t.detail.originalEvent.type||(s.current=!0));let r=t.target;n.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),$=o.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:a,...c}=e,d=O(j,n),f=o.useRef(null),p=(0,s.e)(t,f);return(0,v.EW)(),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.M,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:l,onUnmountAutoFocus:a,children:(0,r.jsx)(u.XB,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":X(d.open),...c,ref:p,onDismiss:()=>d.onOpenChange(!1)})}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(J,{titleId:d.titleId}),(0,r.jsx)(Z,{contentRef:f,descriptionId:d.descriptionId})]})]})}),z="DialogTitle",H=o.forwardRef((e,t)=>{let{__scopeDialog:n,...o}=e,i=O(z,n);return(0,r.jsx)(g.WV.h2,{id:i.titleId,...o,ref:t})});H.displayName=z;var q="DialogDescription",V=o.forwardRef((e,t)=>{let{__scopeDialog:n,...o}=e,i=O(q,n);return(0,r.jsx)(g.WV.p,{id:i.descriptionId,...o,ref:t})});V.displayName=q;var U="DialogClose",G=o.forwardRef((e,t)=>{let{__scopeDialog:n,...o}=e,s=O(U,n);return(0,r.jsx)(g.WV.button,{type:"button",...o,ref:t,onClick:(0,i.M)(e.onClick,()=>s.onOpenChange(!1))})});function X(e){return e?"open":"closed"}G.displayName=U;var Q="DialogTitleWarning",[K,Y]=(0,l.k)(Q,{contentName:j,titleName:z,docsSlug:"dialog"}),J=({titleId:e})=>{let t=Y(Q),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return o.useEffect(()=>{e&&!document.getElementById(e)&&console.error(n)},[n,e]),null},Z=({contentRef:e,descriptionId:t})=>{let n=Y("DialogDescriptionWarning"),r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return o.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&!document.getElementById(t)&&console.warn(r)},[r,e,t]),null},ee=n(46990),et=n(43767);let en=E,er=T,eo=_,ei=G,es=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(N,{ref:t,className:(0,ee.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...o})});es.displayName=N.displayName;let el=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsxs)(eo,{children:[(0,r.jsx)(es,{}),(0,r.jsxs)(B,{ref:t,className:(0,ee.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...i,children:[(0,r.jsx)("div",{style:{width:"100%",minWidth:0},children:o}),(0,r.jsxs)(G,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,r.jsx)(et.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});el.displayName=B.displayName;let ea=e=>{let{className:t,...n}=e;return(0,r.jsx)("div",{className:(0,ee.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...n})};ea.displayName="DialogHeader";let ec=e=>{let{className:t,...n}=e;return(0,r.jsx)("div",{className:(0,ee.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...n})};ec.displayName="DialogFooter";let eu=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(H,{ref:t,className:(0,ee.cn)("text-lg font-semibold leading-none tracking-tight",n),...o})});eu.displayName=H.displayName;let eh=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(V,{ref:t,className:(0,ee.cn)("text-sm text-gray-500",n),...o})});eh.displayName=V.displayName},90484:function(e,t,n){"use strict";n.r(t),n.d(t,{Alert:function(){return r.b},AlertDescription:function(){return r.X},Avatar:function(){return C},AvatarFallback:function(){return E},AvatarImage:function(){return O},Button:function(){return P.z},Card:function(){return T.Zb},CardContent:function(){return T.aY},CardDescription:function(){return T.SZ},CardFooter:function(){return T.eW},CardHeader:function(){return T.Ol},CardTitle:function(){return T.ll},Dialog:function(){return M.Vq},DialogClose:function(){return M.GG},DialogContent:function(){return M.cZ},DialogDescription:function(){return M.Be},DialogFooter:function(){return M.cN},DialogHeader:function(){return M.fK},DialogOverlay:function(){return M.t9},DialogPortal:function(){return M.PK},DialogTitle:function(){return M.$N},DialogTrigger:function(){return M.hg},FlipCard:function(){return I},Input:function(){return j.I},Label:function(){return B._},Select:function(){return W.Ph},SelectContent:function(){return W.Bw},SelectGroup:function(){return W.DI},SelectItem:function(){return W.Ql},SelectLabel:function(){return W.n5},SelectScrollDownButton:function(){return W.Jk},SelectScrollUpButton:function(){return W.Pn},SelectSeparator:function(){return W.U$},SelectTrigger:function(){return W.i4},SelectValue:function(){return W.ki},Table:function(){return F.iA},TableBody:function(){return F.RM},TableCaption:function(){return F.Rn},TableCell:function(){return F.pj},TableFooter:function(){return F.yt},TableHead:function(){return F.ss},TableHeader:function(){return F.xD},TableRow:function(){return F.SC},Tabs:function(){return $},TabsContent:function(){return q},TabsList:function(){return z},TabsTrigger:function(){return H},Textarea:function(){return V.g},YamlEditor:function(){return U.X},buttonVariants:function(){return P.d}});var r=n(72242),o=n(85893),i=n(67294),s=n(25360),l=n(79698),a=n(9981),c=n(75320),u=n(61688);function h(){return()=>{}}var d="Avatar",[f,p]=(0,s.b)(d),[m,g]=f(d),v=i.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[s,l]=i.useState("idle");return(0,o.jsx)(m,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:l,children:(0,o.jsx)(c.WV.span,{...r,ref:t})})});v.displayName=d;var b="AvatarImage",y=i.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...d}=e,f=g(b,n),p=function(e,{referrerPolicy:t,crossOrigin:n}){let r=(0,u.useSyncExternalStore)(h,()=>!0,()=>!1),o=i.useRef(null),s=r?(o.current||(o.current=new window.Image),o.current):null,[l,c]=i.useState(()=>k(s,e));return(0,a.b)(()=>{c(k(s,e))},[s,e]),(0,a.b)(()=>{let e=e=>()=>{c(e)};if(!s)return;let r=e("loaded"),o=e("error");return s.addEventListener("load",r),s.addEventListener("error",o),t&&(s.referrerPolicy=t),"string"==typeof n&&(s.crossOrigin=n),()=>{s.removeEventListener("load",r),s.removeEventListener("error",o)}},[s,n,t]),l}(r,d),m=(0,l.W)(e=>{s(e),f.onImageLoadingStatusChange(e)});return(0,a.b)(()=>{"idle"!==p&&m(p)},[p,m]),"loaded"===p?(0,o.jsx)(c.WV.img,{...d,ref:t,src:r}):null});y.displayName=b;var w="AvatarFallback",x=i.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...s}=e,l=g(w,n),[a,u]=i.useState(void 0===r);return i.useEffect(()=>{if(void 0!==r){let e=window.setTimeout(()=>u(!0),r);return()=>window.clearTimeout(e)}},[r]),a&&"loaded"!==l.imageLoadingStatus?(0,o.jsx)(c.WV.span,{...s,ref:t}):null});function k(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}x.displayName=w;var S=n(46990);let C=i.forwardRef((e,t)=>{let{className:n,...r}=e;return(0,o.jsx)(v,{ref:t,className:(0,S.cn)("relative flex items-center space-x-4 h-10 w-10 shrink-0 overflow-hidden rounded-full",n),...r})});C.displayName=v.displayName;let O=i.forwardRef((e,t)=>{let{className:n,...r}=e;return(0,o.jsx)(y,{ref:t,className:(0,S.cn)("aspect-square h-full w-full items-center",n),...r})});O.displayName=y.displayName;let E=i.forwardRef((e,t)=>{let{className:n,...r}=e;return(0,o.jsx)(x,{ref:t,className:(0,S.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",n),...r})});E.displayName=x.displayName;var P=n(30803),T=n(37673),M=n(91360),A=n(23941),R=n.n(A),_=n(41664),D=n.n(_),N=n(25675),L=n.n(N);let I=e=>{let{card:t}=e,[n,r]=(0,i.useState)(!1),s=e=>{e.preventDefault(),r(!n)},l={width:"280px",height:"300px",objectFit:"cover",backgroundColor:t.isActive?"honeydew":"#fff"};return(0,o.jsxs)(R(),{isFlipped:n,flipDirection:"horizontal",children:[(0,o.jsx)("div",{className:"flip-card-front",onClick:s,style:l,children:(0,o.jsx)("div",{style:{width:"80%",height:"300px",position:"relative"},children:(0,o.jsx)(L(),{src:t.image,alt:t.title,fill:!0,style:{objectFit:"contain"}})})}),(0,o.jsxs)("div",{className:"flip-card-back",onClick:s,style:{width:"280px",height:"300px",objectFit:"cover",backgroundColor:"white"},children:[(0,o.jsx)("p",{children:t.description}),(0,o.jsx)(D(),{href:t.detailsLink,children:(0,o.jsx)(P.z,{variant:"outline",children:t.isActive?"More Details":"Connect"})})]})]})};var j=n(42557),B=n(29749),W=n(62935),F=n(68764);let $=i.forwardRef((e,t)=>{let{className:n,...r}=e;return(0,o.jsx)("div",{ref:t,className:(0,S.cn)("relative w-full",n),...r})});$.displayName="Tabs";let z=i.forwardRef((e,t)=>{let{className:n,...r}=e;return(0,o.jsx)("div",{ref:t,className:(0,S.cn)("inline-flex h-10 items-center justify-center rounded-md bg-slate-100 p-1 text-slate-500 dark:bg-slate-800 dark:text-slate-400",n),...r})});z.displayName="TabsList";let H=i.forwardRef((e,t)=>{let{className:n,active:r,...i}=e;return(0,o.jsx)("button",{ref:t,className:(0,S.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-slate-950 data-[state=active]:shadow-sm dark:ring-offset-slate-950 dark:focus-visible:ring-slate-800 dark:data-[state=active]:bg-slate-950 dark:data-[state=active]:text-slate-50",r&&"bg-white text-slate-950 shadow-sm dark:bg-slate-950 dark:text-slate-50",n),...i})});H.displayName="TabsTrigger";let q=i.forwardRef((e,t)=>{let{className:n,active:r,...i}=e;return(0,o.jsx)("div",{ref:t,className:(0,S.cn)("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 dark:ring-offset-slate-950 dark:focus-visible:ring-slate-800",!r&&"hidden",n),...i})});q.displayName="TabsContent";var V=n(69123),U=n(28970)},42557:function(e,t,n){"use strict";n.d(t,{I:function(){return s}});var r=n(85893),o=n(67294),i=n(46990);let s=o.forwardRef((e,t)=>{let{className:n,type:o,...s}=e;return(0,r.jsx)("input",{type:o,className:(0,i.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:t,...s})});s.displayName="Input"},29749:function(e,t,n){"use strict";n.d(t,{_:function(){return u}});var r=n(85893),o=n(67294),i=n(75320),s=o.forwardRef((e,t)=>(0,r.jsx)(i.WV.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var l=n(12003),a=n(46990);let c=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),u=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(s,{ref:t,className:(0,a.cn)(c(),n),...o})});u.displayName=s.displayName},62935:function(e,t,n){"use strict";n.d(t,{Ph:function(){return t5},Bw:function(){return ne},DI:function(){return t3},Ql:function(){return nn},n5:function(){return nt},Jk:function(){return t7},Pn:function(){return t8},U$:function(){return nr},i4:function(){return t9},ki:function(){return t6}});var r=n(85893),o=n(67294),i=n(73935);function s(e,[t,n]){return Math.min(n,Math.max(t,e))}var l=n(36206),a=n(25360),c=n(28771),u=n(88426),h=o.createContext(void 0),d=n(46063),f=n(27552),p=n(95420),m=n(91276);let g=["top","right","bottom","left"],v=Math.min,b=Math.max,y=Math.round,w=Math.floor,x=e=>({x:e,y:e}),k={left:"right",right:"left",bottom:"top",top:"bottom"},S={start:"end",end:"start"};function C(e,t){return"function"==typeof e?e(t):e}function O(e){return e.split("-")[0]}function E(e){return e.split("-")[1]}function P(e){return"x"===e?"y":"x"}function T(e){return"y"===e?"height":"width"}function M(e){return["top","bottom"].includes(O(e))?"y":"x"}function A(e){return e.replace(/start|end/g,e=>S[e])}function R(e){return e.replace(/left|right|bottom|top/g,e=>k[e])}function _(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function D(e){let{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function N(e,t,n){let r,{reference:o,floating:i}=e,s=M(t),l=P(M(t)),a=T(l),c=O(t),u="y"===s,h=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2;switch(c){case"top":r={x:h,y:o.y-i.height};break;case"bottom":r={x:h,y:o.y+o.height};break;case"right":r={x:o.x+o.width,y:d};break;case"left":r={x:o.x-i.width,y:d};break;default:r={x:o.x,y:o.y}}switch(E(t)){case"start":r[l]-=f*(n&&u?-1:1);break;case"end":r[l]+=f*(n&&u?-1:1)}return r}let L=async(e,t,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await (null==s.isRTL?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:h}=N(c,r,a),d=r,f={},p=0;for(let n=0;n<l.length;n++){let{name:i,fn:m}=l[n],{x:g,y:v,data:b,reset:y}=await m({x:u,y:h,initialPlacement:r,placement:d,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=null!=g?g:u,h=null!=v?v:h,f={...f,[i]:{...f[i],...b}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(d=y.placement),y.rects&&(c=!0===y.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):y.rects),{x:u,y:h}=N(c,d,a)),n=-1)}return{x:u,y:h,placement:d,strategy:o,middlewareData:f}};async function I(e,t){var n;void 0===t&&(t={});let{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}=C(t,e),p=_(f),m=l[d?"floating"===h?"reference":"floating":h],g=D(await i.getClippingRect({element:null==(n=await (null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),v="floating"===h?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await (null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),y=await (null==i.isElement?void 0:i.isElement(b))&&await (null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=D(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:b,strategy:a}):v);return{top:(g.top-w.top+p.top)/y.y,bottom:(w.bottom-g.bottom+p.bottom)/y.y,left:(g.left-w.left+p.left)/y.x,right:(w.right-g.right+p.right)/y.x}}function j(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function B(e){return g.some(t=>e[t]>=0)}async function W(e,t){let{placement:n,platform:r,elements:o}=e,i=await (null==r.isRTL?void 0:r.isRTL(o.floating)),s=O(n),l=E(n),a="y"===M(n),c=["left","top"].includes(s)?-1:1,u=i&&a?-1:1,h=C(t,e),{mainAxis:d,crossAxis:f,alignmentAxis:p}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&"number"==typeof p&&(f="end"===l?-1*p:p),a?{x:f*u,y:d*c}:{x:d*c,y:f*u}}function F(){return"undefined"!=typeof window}function $(e){return q(e)?(e.nodeName||"").toLowerCase():"#document"}function z(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function H(e){var t;return null==(t=(q(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function q(e){return!!F()&&(e instanceof Node||e instanceof z(e).Node)}function V(e){return!!F()&&(e instanceof Element||e instanceof z(e).Element)}function U(e){return!!F()&&(e instanceof HTMLElement||e instanceof z(e).HTMLElement)}function G(e){return!!F()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof z(e).ShadowRoot)}function X(e){let{overflow:t,overflowX:n,overflowY:r,display:o}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Q(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function K(e){let t=Y(),n=V(e)?Z(e):e;return["transform","translate","scale","rotate","perspective"].some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some(e=>(n.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(n.contain||"").includes(e))}function Y(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}function J(e){return["html","body","#document"].includes($(e))}function Z(e){return z(e).getComputedStyle(e)}function ee(e){return V(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function et(e){if("html"===$(e))return e;let t=e.assignedSlot||e.parentNode||G(e)&&e.host||H(e);return G(t)?t.host:t}function en(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let o=function e(t){let n=et(t);return J(n)?t.ownerDocument?t.ownerDocument.body:t.body:U(n)&&X(n)?n:e(n)}(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),s=z(o);if(i){let e=er(s);return t.concat(s,s.visualViewport||[],X(o)?o:[],e&&n?en(e):[])}return t.concat(o,en(o,[],n))}function er(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function eo(e){let t=Z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=U(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=y(n)!==i||y(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function ei(e){return V(e)?e:e.contextElement}function es(e){let t=ei(e);if(!U(t))return x(1);let n=t.getBoundingClientRect(),{width:r,height:o,$:i}=eo(t),s=(i?y(n.width):n.width)/r,l=(i?y(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),l&&Number.isFinite(l)||(l=1),{x:s,y:l}}let el=x(0);function ea(e){let t=z(e);return Y()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:el}function ec(e,t,n,r){var o;void 0===t&&(t=!1),void 0===n&&(n=!1);let i=e.getBoundingClientRect(),s=ei(e),l=x(1);t&&(r?V(r)&&(l=es(r)):l=es(e));let a=(void 0===(o=n)&&(o=!1),r&&(!o||r===z(s))&&o)?ea(s):x(0),c=(i.left+a.x)/l.x,u=(i.top+a.y)/l.y,h=i.width/l.x,d=i.height/l.y;if(s){let e=z(s),t=r&&V(r)?z(r):r,n=e,o=er(n);for(;o&&r&&t!==n;){let e=es(o),t=o.getBoundingClientRect(),r=Z(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,u*=e.y,h*=e.x,d*=e.y,c+=i,u+=s,o=er(n=z(o))}}return D({width:h,height:d,x:c,y:u})}function eu(e,t){let n=ee(e).scrollLeft;return t?t.left+n:ec(H(e)).left+n}function eh(e,t,n){void 0===n&&(n=!1);let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:eu(e,r)),y:r.top+t.scrollTop}}function ed(e,t,n){let r;if("viewport"===t)r=function(e,t){let n=z(e),r=H(e),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;let e=Y();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,a=o.offsetTop)}return{width:i,height:s,x:l,y:a}}(e,n);else if("document"===t)r=function(e){let t=H(e),n=ee(e),r=e.ownerDocument.body,o=b(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=b(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+eu(e),l=-n.scrollTop;return"rtl"===Z(r).direction&&(s+=b(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}(H(e));else if(V(t))r=function(e,t){let n=ec(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=U(e)?es(e):x(1),s=e.clientWidth*i.x;return{width:s,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{let n=ea(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return D(r)}function ef(e){return"static"===Z(e).position}function ep(e,t){if(!U(e)||"fixed"===Z(e).position)return null;if(t)return t(e);let n=e.offsetParent;return H(e)===n&&(n=n.ownerDocument.body),n}function em(e,t){let n=z(e);if(Q(e))return n;if(!U(e)){let t=et(e);for(;t&&!J(t);){if(V(t)&&!ef(t))return t;t=et(t)}return n}let r=ep(e,t);for(;r&&["table","td","th"].includes($(r))&&ef(r);)r=ep(r,t);return r&&J(r)&&ef(r)&&!K(r)?n:r||function(e){let t=et(e);for(;U(t)&&!J(t);){if(K(t))return t;if(Q(t))break;t=et(t)}return null}(e)||n}let eg=async function(e){let t=this.getOffsetParent||em,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=U(t),o=H(t),i="fixed"===n,s=ec(e,!0,i,t),l={scrollLeft:0,scrollTop:0},a=x(0);if(r||!r&&!i){if(("body"!==$(t)||X(o))&&(l=ee(t)),r){let e=ec(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=eu(o))}i&&!r&&o&&(a.x=eu(o));let c=!o||r||i?x(0):eh(o,l);return{x:s.left+l.scrollLeft-a.x-c.x,y:s.top+l.scrollTop-a.y-c.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},ev={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e,i="fixed"===o,s=H(r),l=!!t&&Q(t.floating);if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=x(1),u=x(0),h=U(r);if((h||!h&&!i)&&(("body"!==$(r)||X(s))&&(a=ee(r)),U(r))){let e=ec(r);c=es(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let d=!s||h||i?x(0):eh(s,a,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+d.x,y:n.y*c.y-a.scrollTop*c.y+u.y+d.y}},getDocumentElement:H,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e,i=[..."clippingAncestors"===n?Q(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=en(e,[],!1).filter(e=>V(e)&&"body"!==$(e)),o=null,i="fixed"===Z(e).position,s=i?et(e):e;for(;V(s)&&!J(s);){let t=Z(s),n=K(s);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&!!o&&["absolute","fixed"].includes(o.position)||X(s)&&!n&&function e(t,n){let r=et(t);return!(r===n||!V(r)||J(r))&&("fixed"===Z(r).position||e(r,n))}(e,s))?r=r.filter(e=>e!==s):o=t,s=et(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=i[0],l=i.reduce((e,n)=>{let r=ed(t,n,o);return e.top=b(r.top,e.top),e.right=v(r.right,e.right),e.bottom=v(r.bottom,e.bottom),e.left=b(r.left,e.left),e},ed(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:em,getElementRects:eg,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=eo(e);return{width:t,height:n}},getScale:es,isElement:V,isRTL:function(e){return"rtl"===Z(e).direction}};function eb(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let ey=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=t,{element:c,padding:u=0}=C(e,t)||{};if(null==c)return{};let h=_(u),d={x:n,y:r},f=P(M(o)),p=T(f),m=await s.getDimensions(c),g="y"===f,y=g?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[f]-d[f]-i.floating[p],x=d[f]-i.reference[f],k=await (null==s.getOffsetParent?void 0:s.getOffsetParent(c)),S=k?k[y]:0;S&&await (null==s.isElement?void 0:s.isElement(k))||(S=l.floating[y]||i.floating[p]);let O=S/2-m[p]/2-1,A=v(h[g?"top":"left"],O),R=v(h[g?"bottom":"right"],O),D=S-m[p]-R,N=S/2-m[p]/2+(w/2-x/2),L=b(A,v(N,D)),I=!a.arrow&&null!=E(o)&&N!==L&&i.reference[p]/2-(N<A?A:R)-m[p]/2<0,j=I?N<A?N-A:N-D:0;return{[f]:d[f]+j,data:{[f]:L,centerOffset:N-L-j,...I&&{alignmentOffset:j}},reset:I}}}),ew=(e,t,n)=>{let r=new Map,o={platform:ev,...n},i={...o.platform,_c:r};return L(e,t,{...o,platform:i})};var ex="undefined"!=typeof document?o.useLayoutEffect:function(){};function ek(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!ek(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!ek(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function eS(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function eC(e,t){let n=eS(e);return Math.round(t*n)/n}function eO(e){let t=o.useRef(e);return ex(()=>{t.current=e}),t}let eE=e=>({name:"arrow",options:e,fn(t){let{element:n,padding:r}="function"==typeof e?e(t):e;return n&&({}).hasOwnProperty.call(n,"current")?null!=n.current?ey({element:n.current,padding:r}).fn(t):{}:n?ey({element:n,padding:r}).fn(t):{}}}),eP=(e,t)=>{var n;return{...(void 0===(n=e)&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:o,y:i,placement:s,middlewareData:l}=e,a=await W(e,n);return s===(null==(t=l.offset)?void 0:t.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}),options:[e,t]}},eT=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...a}=C(n,e),c={x:t,y:r},u=await I(e,a),h=M(O(o)),d=P(h),f=c[d],p=c[h];if(i){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",n=f+u[e],r=f-u[t];f=b(n,v(f,r))}if(s){let e="y"===h?"top":"left",t="y"===h?"bottom":"right",n=p+u[e],r=p-u[t];p=b(n,v(p,r))}let m=l.fn({...e,[d]:f,[h]:p});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[d]:i,[h]:s}}}}}),options:[e,t]}},eM=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{options:n,fn(e){let{x:t,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=C(n,e),u={x:t,y:r},h=M(o),d=P(h),f=u[d],p=u[h],m=C(l,e),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){let e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+g.mainAxis,n=i.reference[d]+i.reference[e]-g.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var v,b;let e="y"===d?"width":"height",t=["top","left"].includes(O(o)),n=i.reference[h]-i.floating[e]+(t&&(null==(v=s.offset)?void 0:v[h])||0)+(t?0:g.crossAxis),r=i.reference[h]+i.reference[e]+(t?0:(null==(b=s.offset)?void 0:b[h])||0)-(t?g.crossAxis:0);p<n?p=n:p>r&&(p=r)}return{[d]:f,[h]:p}}}),options:[e,t]}},eA=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"flip",options:n,async fn(e){var t,r,o,i,s;let{placement:l,middlewareData:a,rects:c,initialPlacement:u,platform:h,elements:d}=e,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...y}=C(n,e);if(null!=(t=a.arrow)&&t.alignmentOffset)return{};let w=O(l),x=M(u),k=O(u)===u,S=await (null==h.isRTL?void 0:h.isRTL(d.floating)),_=m||(k||!b?[R(u)]:function(e){let t=R(e);return[A(e),t,A(t)]}(u)),D="none"!==v;!m&&D&&_.push(...function(e,t,n,r){let o=E(e),i=function(e,t,n){let r=["left","right"],o=["right","left"];switch(e){case"top":case"bottom":if(n)return t?o:r;return t?r:o;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(O(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(A)))),i}(u,b,v,S));let N=[u,..._],L=await I(e,y),j=[],B=(null==(r=a.flip)?void 0:r.overflows)||[];if(f&&j.push(L[w]),p){let e=function(e,t,n){void 0===n&&(n=!1);let r=E(e),o=P(M(e)),i=T(o),s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=R(s)),[s,R(s)]}(l,c,S);j.push(L[e[0]],L[e[1]])}if(B=[...B,{placement:l,overflows:j}],!j.every(e=>e<=0)){let e=((null==(o=a.flip)?void 0:o.index)||0)+1,t=N[e];if(t&&(!("alignment"===p&&x!==M(t))||B.every(e=>e.overflows[0]>0&&M(e.placement)===x)))return{data:{index:e,overflows:B},reset:{placement:t}};let n=null==(i=B.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!n)switch(g){case"bestFit":{let e=null==(s=B.filter(e=>{if(D){let t=M(e.placement);return t===x||"y"===t}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])?void 0:s[0];e&&(n=e);break}case"initialPlacement":n=u}if(l!==n)return{reset:{placement:n}}}return{}}}),options:[e,t]}},eR=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"size",options:n,async fn(e){var t,r;let o,i;let{placement:s,rects:l,platform:a,elements:c}=e,{apply:u=()=>{},...h}=C(n,e),d=await I(e,h),f=O(s),p=E(s),m="y"===M(s),{width:g,height:y}=l.floating;"top"===f||"bottom"===f?(o=f,i=p===(await (null==a.isRTL?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(i=f,o="end"===p?"top":"bottom");let w=y-d.top-d.bottom,x=g-d.left-d.right,k=v(y-d[o],w),S=v(g-d[i],x),P=!e.middlewareData.shift,T=k,A=S;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(A=x),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(T=w),P&&!p){let e=b(d.left,0),t=b(d.right,0),n=b(d.top,0),r=b(d.bottom,0);m?A=g-2*(0!==e||0!==t?e+t:b(d.left,d.right)):T=y-2*(0!==n||0!==r?n+r:b(d.top,d.bottom))}await u({...e,availableWidth:A,availableHeight:T});let R=await a.getDimensions(c.floating);return g!==R.width||y!==R.height?{reset:{rects:!0}}:{}}}),options:[e,t]}},e_=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"hide",options:n,async fn(e){let{rects:t}=e,{strategy:r="referenceHidden",...o}=C(n,e);switch(r){case"referenceHidden":{let n=j(await I(e,{...o,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:B(n)}}}case"escaped":{let n=j(await I(e,{...o,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:B(n)}}}default:return{}}}}),options:[e,t]}},eD=(e,t)=>({...eE(e),options:[e,t]});var eN=n(75320),eL=o.forwardRef((e,t)=>{let{children:n,width:o=10,height:i=5,...s}=e;return(0,r.jsx)(eN.WV.svg,{...s,ref:t,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,r.jsx)("polygon",{points:"0,0 30,0 15,10"})})});eL.displayName="Arrow";var eI=n(79698),ej=n(9981),eB="Popper",[eW,eF]=(0,a.b)(eB),[e$,ez]=eW(eB),eH=e=>{let{__scopePopper:t,children:n}=e,[i,s]=o.useState(null);return(0,r.jsx)(e$,{scope:t,anchor:i,onAnchorChange:s,children:n})};eH.displayName=eB;var eq="PopperAnchor",eV=o.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...s}=e,l=ez(eq,n),a=o.useRef(null),u=(0,c.e)(t,a);return o.useEffect(()=>{l.onAnchorChange(i?.current||a.current)}),i?null:(0,r.jsx)(eN.WV.div,{...s,ref:u})});eV.displayName=eq;var eU="PopperContent",[eG,eX]=eW(eU),eQ=o.forwardRef((e,t)=>{let{__scopePopper:n,side:s="bottom",sideOffset:l=0,align:a="center",alignOffset:u=0,arrowPadding:h=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:x,...k}=e,S=ez(eU,n),[C,O]=o.useState(null),E=(0,c.e)(t,e=>O(e)),[P,T]=o.useState(null),M=function(e){let[t,n]=o.useState(void 0);return(0,ej.b)(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,o;if(!Array.isArray(t)||!t.length)return;let i=t[0];if("borderBoxSize"in i){let e=i.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,o=t.blockSize}else r=e.offsetWidth,o=e.offsetHeight;n({width:r,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(P),A=M?.width??0,R=M?.height??0,_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},D=Array.isArray(f)?f:[f],N=D.length>0,L={padding:_,boundary:D.filter(eZ),altBoundary:N},{refs:I,floatingStyles:j,placement:B,isPositioned:W,middlewareData:F}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:l,floating:a}={},transform:c=!0,whileElementsMounted:u,open:h}=e,[d,f]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=o.useState(r);ek(p,r)||m(r);let[g,v]=o.useState(null),[b,y]=o.useState(null),w=o.useCallback(e=>{e!==C.current&&(C.current=e,v(e))},[]),x=o.useCallback(e=>{e!==O.current&&(O.current=e,y(e))},[]),k=l||g,S=a||b,C=o.useRef(null),O=o.useRef(null),E=o.useRef(d),P=null!=u,T=eO(u),M=eO(s),A=eO(h),R=o.useCallback(()=>{if(!C.current||!O.current)return;let e={placement:t,strategy:n,middleware:p};M.current&&(e.platform=M.current),ew(C.current,O.current,e).then(e=>{let t={...e,isPositioned:!1!==A.current};_.current&&!ek(E.current,t)&&(E.current=t,i.flushSync(()=>{f(t)}))})},[p,t,n,M,A]);ex(()=>{!1===h&&E.current.isPositioned&&(E.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[h]);let _=o.useRef(!1);ex(()=>(_.current=!0,()=>{_.current=!1}),[]),ex(()=>{if(k&&(C.current=k),S&&(O.current=S),k&&S){if(T.current)return T.current(k,S,R);R()}},[k,S,R,T,P]);let D=o.useMemo(()=>({reference:C,floating:O,setReference:w,setFloating:x}),[w,x]),N=o.useMemo(()=>({reference:k,floating:S}),[k,S]),L=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=eC(N.floating,d.x),r=eC(N.floating,d.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...eS(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,N.floating,d.x,d.y]);return o.useMemo(()=>({...d,update:R,refs:D,elements:N,floatingStyles:L}),[d,R,D,N,L])}({strategy:"fixed",placement:s+("center"!==a?"-"+a:""),whileElementsMounted:(...e)=>(function(e,t,n,r){let o;void 0===r&&(r={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,u=ei(e),h=i||s?[...u?en(u):[],...en(t)]:[];h.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)});let d=u&&a?function(e,t){let n,r=null,o=H(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function s(l,a){void 0===l&&(l=!1),void 0===a&&(a=1),i();let c=e.getBoundingClientRect(),{left:u,top:h,width:d,height:f}=c;if(l||t(),!d||!f)return;let p=w(h),m=w(o.clientWidth-(u+d)),g={rootMargin:-p+"px "+-m+"px "+-w(o.clientHeight-(h+f))+"px "+-w(u)+"px",threshold:b(0,v(1,a))||1},y=!0;function x(t){let r=t[0].intersectionRatio;if(r!==a){if(!y)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||eb(c,e.getBoundingClientRect())||s(),y=!1}try{r=new IntersectionObserver(x,{...g,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(x,g)}r.observe(e)}(!0),i}(u,n):null,f=-1,p=null;l&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let m=c?ec(e):null;return c&&function t(){let r=ec(e);m&&!eb(m,r)&&n(),m=r,o=requestAnimationFrame(t)}(),n(),()=>{var e;h.forEach(e=>{i&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(o)}})(...e,{animationFrame:"always"===y}),elements:{reference:S.anchor},middleware:[eP({mainAxis:l+R,alignmentAxis:u}),d&&eT({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?eM():void 0,...L}),d&&eA({...L}),eR({...L,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:o,height:i}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${o}px`),s.setProperty("--radix-popper-anchor-height",`${i}px`)}}),P&&eD({element:P,padding:h}),e0({arrowWidth:A,arrowHeight:R}),g&&e_({strategy:"referenceHidden",...L})]}),[$,z]=e1(B),q=(0,eI.W)(x);(0,ej.b)(()=>{W&&q?.()},[W,q]);let V=F.arrow?.x,U=F.arrow?.y,G=F.arrow?.centerOffset!==0,[X,Q]=o.useState();return(0,ej.b)(()=>{C&&Q(window.getComputedStyle(C).zIndex)},[C]),(0,r.jsx)("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:W?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,r.jsx)(eG,{scope:n,placedSide:$,onArrowChange:T,arrowX:V,arrowY:U,shouldHideArrow:G,children:(0,r.jsx)(eN.WV.div,{"data-side":$,"data-align":z,...k,ref:E,style:{...k.style,animation:W?void 0:"none"}})})})});eQ.displayName=eU;var eK="PopperArrow",eY={top:"bottom",right:"left",bottom:"top",left:"right"},eJ=o.forwardRef(function(e,t){let{__scopePopper:n,...o}=e,i=eX(eK,n),s=eY[i.placedSide];return(0,r.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,r.jsx)(eL,{...o,ref:t,style:{...o.style,display:"block"}})})});function eZ(e){return null!==e}eJ.displayName=eK;var e0=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,s=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[a,c]=e1(n),u={start:"0%",center:"50%",end:"100%"}[c],h=(o.arrow?.x??0)+s/2,d=(o.arrow?.y??0)+l/2,f="",p="";return"bottom"===a?(f=i?u:`${h}px`,p=`${-l}px`):"top"===a?(f=i?u:`${h}px`,p=`${r.floating.height+l}px`):"right"===a?(f=`${-l}px`,p=i?u:`${d}px`):"left"===a&&(f=`${r.floating.width+l}px`,p=i?u:`${d}px`),{data:{x:f,y:p}}}});function e1(e){let[t,n="center"]=e.split("-");return[t,n]}var e2=n(42651),e4=n(77342),e5=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});o.forwardRef((e,t)=>(0,r.jsx)(eN.WV.span,{...e,ref:t,style:{...e5,...e.style}})).displayName="VisuallyHidden";var e3=n(23541),e6=n(6223),e9=[" ","Enter","ArrowUp","ArrowDown"],e8=[" ","Enter"],e7="Select",[te,tt,tn]=function(e){let t=e+"CollectionProvider",[n,i]=(0,a.b)(t),[s,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),h=e=>{let{scope:t,children:n}=e,i=o.useRef(null),l=o.useRef(new Map).current;return(0,r.jsx)(s,{scope:t,itemMap:l,collectionRef:i,children:n})};h.displayName=t;let d=e+"CollectionSlot",f=(0,u.Z8)(d),p=o.forwardRef((e,t)=>{let{scope:n,children:o}=e,i=l(d,n),s=(0,c.e)(t,i.collectionRef);return(0,r.jsx)(f,{ref:s,children:o})});p.displayName=d;let m=e+"CollectionItemSlot",g="data-radix-collection-item",v=(0,u.Z8)(m),b=o.forwardRef((e,t)=>{let{scope:n,children:i,...s}=e,a=o.useRef(null),u=(0,c.e)(t,a),h=l(m,n);return o.useEffect(()=>(h.itemMap.set(a,{ref:a,...s}),()=>void h.itemMap.delete(a))),(0,r.jsx)(v,{[g]:"",ref:u,children:i})});return b.displayName=m,[{Provider:h,Slot:p,ItemSlot:b},function(t){let n=l(e+"CollectionConsumer",t);return o.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},i]}(e7),[tr,to]=(0,a.b)(e7,[tn,eF]),ti=eF(),[ts,tl]=tr(e7),[ta,tc]=tr(e7),tu=e=>{let{__scopeSelect:t,children:n,open:i,defaultOpen:s,onOpenChange:l,value:a,defaultValue:c,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:g,required:v,form:b}=e,y=ti(t),[w,x]=o.useState(null),[k,S]=o.useState(null),[C,O]=o.useState(!1),E=function(e){let t=o.useContext(h);return e||t||"ltr"}(d),[P,T]=(0,e4.T)({prop:i,defaultProp:s??!1,onChange:l,caller:e7}),[M,A]=(0,e4.T)({prop:a,defaultProp:c,onChange:u,caller:e7}),R=o.useRef(null),_=!w||b||!!w.closest("form"),[D,N]=o.useState(new Set),L=Array.from(D).map(e=>e.props.value).join(";");return(0,r.jsx)(eH,{...y,children:(0,r.jsxs)(ts,{required:v,scope:t,trigger:w,onTriggerChange:x,valueNode:k,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:O,contentId:(0,m.M)(),value:M,onValueChange:A,open:P,onOpenChange:T,dir:E,triggerPointerDownPosRef:R,disabled:g,children:[(0,r.jsx)(te.Provider,{scope:t,children:(0,r.jsx)(ta,{scope:e.__scopeSelect,onNativeOptionAdd:o.useCallback(e=>{N(t=>new Set(t).add(e))},[]),onNativeOptionRemove:o.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),_?(0,r.jsxs)(tK,{"aria-hidden":!0,required:v,tabIndex:-1,name:f,autoComplete:p,value:M,onChange:e=>A(e.target.value),disabled:g,form:b,children:[void 0===M?(0,r.jsx)("option",{value:""}):null,Array.from(D)]},L):null]})})};tu.displayName=e7;var th="SelectTrigger",td=o.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:i=!1,...s}=e,a=ti(n),u=tl(th,n),h=u.disabled||i,d=(0,c.e)(t,u.onTriggerChange),f=tt(n),p=o.useRef("touch"),[m,g,v]=tJ(e=>{let t=f().filter(e=>!e.disabled),n=t.find(e=>e.value===u.value),r=tZ(t,e,n);void 0!==r&&u.onValueChange(r.value)}),b=e=>{h||(u.onOpenChange(!0),v()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,r.jsx)(eV,{asChild:!0,...a,children:(0,r.jsx)(eN.WV.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":tY(u.value)?"":void 0,...s,ref:d,onClick:(0,l.M)(s.onClick,e=>{e.currentTarget.focus(),"mouse"!==p.current&&b(e)}),onPointerDown:(0,l.M)(s.onPointerDown,e=>{p.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(b(e),e.preventDefault())}),onKeyDown:(0,l.M)(s.onKeyDown,e=>{let t=""!==m.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||g(e.key),(!t||" "!==e.key)&&e9.includes(e.key)&&(b(),e.preventDefault())})})})});td.displayName=th;var tf="SelectValue",tp=o.forwardRef((e,t)=>{let{__scopeSelect:n,className:o,style:i,children:s,placeholder:l="",...a}=e,u=tl(tf,n),{onValueNodeHasChildrenChange:h}=u,d=void 0!==s,f=(0,c.e)(t,u.onValueNodeChange);return(0,ej.b)(()=>{h(d)},[h,d]),(0,r.jsx)(eN.WV.span,{...a,ref:f,style:{pointerEvents:"none"},children:tY(u.value)?(0,r.jsx)(r.Fragment,{children:l}):s})});tp.displayName=tf;var tm=o.forwardRef((e,t)=>{let{__scopeSelect:n,children:o,...i}=e;return(0,r.jsx)(eN.WV.span,{"aria-hidden":!0,...i,ref:t,children:o||"▼"})});tm.displayName="SelectIcon";var tg=e=>(0,r.jsx)(e2.h,{asChild:!0,...e});tg.displayName="SelectPortal";var tv="SelectContent",tb=o.forwardRef((e,t)=>{let n=tl(tv,e.__scopeSelect),[s,l]=o.useState();return((0,ej.b)(()=>{l(new DocumentFragment)},[]),n.open)?(0,r.jsx)(tk,{...e,ref:t}):s?i.createPortal((0,r.jsx)(ty,{scope:e.__scopeSelect,children:(0,r.jsx)(te.Slot,{scope:e.__scopeSelect,children:(0,r.jsx)("div",{children:e.children})})}),s):null});tb.displayName=tv;var[ty,tw]=tr(tv),tx=(0,u.Z8)("SelectContent.RemoveScroll"),tk=o.forwardRef((e,t)=>{let{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:u,side:h,sideOffset:m,align:g,alignOffset:v,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:x,hideWhenDetached:k,avoidCollisions:S,...C}=e,O=tl(tv,n),[E,P]=o.useState(null),[T,M]=o.useState(null),A=(0,c.e)(t,e=>P(e)),[R,_]=o.useState(null),[D,N]=o.useState(null),L=tt(n),[I,j]=o.useState(!1),B=o.useRef(!1);o.useEffect(()=>{if(E)return(0,e3.Ry)(E)},[E]),(0,f.EW)();let W=o.useCallback(e=>{let[t,...n]=L().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(let n of e)if(n===o||(n?.scrollIntoView({block:"nearest"}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==o))return},[L,T]),F=o.useCallback(()=>W([R,E]),[W,R,E]);o.useEffect(()=>{I&&F()},[I,F]);let{onOpenChange:$,triggerPointerDownPosRef:z}=O;o.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():E.contains(n.target)||$(!1),document.removeEventListener("pointermove",t),z.current=null};return null!==z.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[E,$,z]),o.useEffect(()=>{let e=()=>$(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[$]);let[H,q]=tJ(e=>{let t=L().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=tZ(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),V=o.useCallback((e,t,n)=>{let r=!B.current&&!n;(void 0!==O.value&&O.value===t||r)&&(_(e),r&&(B.current=!0))},[O.value]),U=o.useCallback(()=>E?.focus(),[E]),G=o.useCallback((e,t,n)=>{let r=!B.current&&!n;(void 0!==O.value&&O.value===t||r)&&N(e)},[O.value]),X="popper"===i?tC:tS,Q=X===tC?{side:h,sideOffset:m,align:g,alignOffset:v,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:x,hideWhenDetached:k,avoidCollisions:S}:{};return(0,r.jsx)(ty,{scope:n,content:E,viewport:T,onViewportChange:M,itemRefCallback:V,selectedItem:R,onItemLeave:U,itemTextRefCallback:G,focusSelectedItem:F,selectedItemText:D,position:i,isPositioned:I,searchRef:H,children:(0,r.jsx)(e6.Z,{as:tx,allowPinchZoom:!0,children:(0,r.jsx)(p.M,{asChild:!0,trapped:O.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:(0,l.M)(s,e=>{O.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,r.jsx)(d.XB,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:u,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:(0,r.jsx)(X,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:e=>e.preventDefault(),...C,...Q,onPlaced:()=>j(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:(0,l.M)(C.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||q(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=L().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>W(t)),e.preventDefault()}})})})})})})});tk.displayName="SelectContentImpl";var tS=o.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:i,...l}=e,a=tl(tv,n),u=tw(tv,n),[h,d]=o.useState(null),[f,p]=o.useState(null),m=(0,c.e)(t,e=>p(e)),g=tt(n),v=o.useRef(!1),b=o.useRef(!0),{viewport:y,selectedItem:w,selectedItemText:x,focusSelectedItem:k}=u,S=o.useCallback(()=>{if(a.trigger&&a.valueNode&&h&&f&&y&&w&&x){let e=a.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),r=x.getBoundingClientRect();if("rtl"!==a.dir){let o=r.left-t.left,i=n.left-o,l=e.left-i,a=e.width+l,c=Math.max(a,t.width),u=s(i,[10,Math.max(10,window.innerWidth-10-c)]);h.style.minWidth=a+"px",h.style.left=u+"px"}else{let o=t.right-r.right,i=window.innerWidth-n.right-o,l=window.innerWidth-e.right-i,a=e.width+l,c=Math.max(a,t.width),u=s(i,[10,Math.max(10,window.innerWidth-10-c)]);h.style.minWidth=a+"px",h.style.right=u+"px"}let o=g(),l=window.innerHeight-20,c=y.scrollHeight,u=window.getComputedStyle(f),d=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),b=d+p+c+parseInt(u.paddingBottom,10)+m,k=Math.min(5*w.offsetHeight,b),S=window.getComputedStyle(y),C=parseInt(S.paddingTop,10),O=parseInt(S.paddingBottom,10),E=e.top+e.height/2-10,P=w.offsetHeight/2,T=d+p+(w.offsetTop+P);if(T<=E){let e=o.length>0&&w===o[o.length-1].ref.current;h.style.bottom="0px";let t=f.clientHeight-y.offsetTop-y.offsetHeight;h.style.height=T+Math.max(l-E,P+(e?O:0)+t+m)+"px"}else{let e=o.length>0&&w===o[0].ref.current;h.style.top="0px";let t=Math.max(E,d+y.offsetTop+(e?C:0)+P);h.style.height=t+(b-T)+"px",y.scrollTop=T-E+y.offsetTop}h.style.margin="10px 0",h.style.minHeight=k+"px",h.style.maxHeight=l+"px",i?.(),requestAnimationFrame(()=>v.current=!0)}},[g,a.trigger,a.valueNode,h,f,y,w,x,a.dir,i]);(0,ej.b)(()=>S(),[S]);let[C,O]=o.useState();(0,ej.b)(()=>{f&&O(window.getComputedStyle(f).zIndex)},[f]);let E=o.useCallback(e=>{e&&!0===b.current&&(S(),k?.(),b.current=!1)},[S,k]);return(0,r.jsx)(tO,{scope:n,contentWrapper:h,shouldExpandOnScrollRef:v,onScrollButtonChange:E,children:(0,r.jsx)("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:(0,r.jsx)(eN.WV.div,{...l,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});tS.displayName="SelectItemAlignedPosition";var tC=o.forwardRef((e,t)=>{let{__scopeSelect:n,align:o="start",collisionPadding:i=10,...s}=e,l=ti(n);return(0,r.jsx)(eQ,{...l,...s,ref:t,align:o,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});tC.displayName="SelectPopperPosition";var[tO,tE]=tr(tv,{}),tP="SelectViewport",tT=o.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:i,...s}=e,a=tw(tP,n),u=tE(tP,n),h=(0,c.e)(t,a.onViewportChange),d=o.useRef(0);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),(0,r.jsx)(te.Slot,{scope:n,children:(0,r.jsx)(eN.WV.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:(0,l.M)(s.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=u;if(r?.current&&n){let e=Math.abs(d.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,o=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(o<r){let i=o+e,s=Math.min(r,i),l=i-s;n.style.height=s+"px","0px"===n.style.bottom&&(t.scrollTop=l>0?l:0,n.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});tT.displayName=tP;var tM="SelectGroup",[tA,tR]=tr(tM),t_=o.forwardRef((e,t)=>{let{__scopeSelect:n,...o}=e,i=(0,m.M)();return(0,r.jsx)(tA,{scope:n,id:i,children:(0,r.jsx)(eN.WV.div,{role:"group","aria-labelledby":i,...o,ref:t})})});t_.displayName=tM;var tD="SelectLabel",tN=o.forwardRef((e,t)=>{let{__scopeSelect:n,...o}=e,i=tR(tD,n);return(0,r.jsx)(eN.WV.div,{id:i.id,...o,ref:t})});tN.displayName=tD;var tL="SelectItem",[tI,tj]=tr(tL),tB=o.forwardRef((e,t)=>{let{__scopeSelect:n,value:i,disabled:s=!1,textValue:a,...u}=e,h=tl(tL,n),d=tw(tL,n),f=h.value===i,[p,g]=o.useState(a??""),[v,b]=o.useState(!1),y=(0,c.e)(t,e=>d.itemRefCallback?.(e,i,s)),w=(0,m.M)(),x=o.useRef("touch"),k=()=>{s||(h.onValueChange(i),h.onOpenChange(!1))};if(""===i)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,r.jsx)(tI,{scope:n,value:i,disabled:s,textId:w,isSelected:f,onItemTextChange:o.useCallback(e=>{g(t=>t||(e?.textContent??"").trim())},[]),children:(0,r.jsx)(te.ItemSlot,{scope:n,value:i,disabled:s,textValue:p,children:(0,r.jsx)(eN.WV.div,{role:"option","aria-labelledby":w,"data-highlighted":v?"":void 0,"aria-selected":f&&v,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:y,onFocus:(0,l.M)(u.onFocus,()=>b(!0)),onBlur:(0,l.M)(u.onBlur,()=>b(!1)),onClick:(0,l.M)(u.onClick,()=>{"mouse"!==x.current&&k()}),onPointerUp:(0,l.M)(u.onPointerUp,()=>{"mouse"===x.current&&k()}),onPointerDown:(0,l.M)(u.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:(0,l.M)(u.onPointerMove,e=>{x.current=e.pointerType,s?d.onItemLeave?.():"mouse"===x.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:(0,l.M)(u.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:(0,l.M)(u.onKeyDown,e=>{d.searchRef?.current!==""&&" "===e.key||(e8.includes(e.key)&&k()," "===e.key&&e.preventDefault())})})})})});tB.displayName=tL;var tW="SelectItemText",tF=o.forwardRef((e,t)=>{let{__scopeSelect:n,className:s,style:l,...a}=e,u=tl(tW,n),h=tw(tW,n),d=tj(tW,n),f=tc(tW,n),[p,m]=o.useState(null),g=(0,c.e)(t,e=>m(e),d.onItemTextChange,e=>h.itemTextRefCallback?.(e,d.value,d.disabled)),v=p?.textContent,b=o.useMemo(()=>(0,r.jsx)("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:y,onNativeOptionRemove:w}=f;return(0,ej.b)(()=>(y(b),()=>w(b)),[y,w,b]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eN.WV.span,{id:d.textId,...a,ref:g}),d.isSelected&&u.valueNode&&!u.valueNodeHasChildren?i.createPortal(a.children,u.valueNode):null]})});tF.displayName=tW;var t$="SelectItemIndicator",tz=o.forwardRef((e,t)=>{let{__scopeSelect:n,...o}=e;return tj(t$,n).isSelected?(0,r.jsx)(eN.WV.span,{"aria-hidden":!0,...o,ref:t}):null});tz.displayName=t$;var tH="SelectScrollUpButton",tq=o.forwardRef((e,t)=>{let n=tw(tH,e.__scopeSelect),i=tE(tH,e.__scopeSelect),[s,l]=o.useState(!1),a=(0,c.e)(t,i.onScrollButtonChange);return(0,ej.b)(()=>{if(n.viewport&&n.isPositioned){let e=function(){l(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),s?(0,r.jsx)(tG,{...e,ref:a,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});tq.displayName=tH;var tV="SelectScrollDownButton",tU=o.forwardRef((e,t)=>{let n=tw(tV,e.__scopeSelect),i=tE(tV,e.__scopeSelect),[s,l]=o.useState(!1),a=(0,c.e)(t,i.onScrollButtonChange);return(0,ej.b)(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;l(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),s?(0,r.jsx)(tG,{...e,ref:a,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});tU.displayName=tV;var tG=o.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:i,...s}=e,a=tw("SelectScrollButton",n),c=o.useRef(null),u=tt(n),h=o.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return o.useEffect(()=>()=>h(),[h]),(0,ej.b)(()=>{let e=u().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[u]),(0,r.jsx)(eN.WV.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:(0,l.M)(s.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(i,50))}),onPointerMove:(0,l.M)(s.onPointerMove,()=>{a.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(i,50))}),onPointerLeave:(0,l.M)(s.onPointerLeave,()=>{h()})})}),tX=o.forwardRef((e,t)=>{let{__scopeSelect:n,...o}=e;return(0,r.jsx)(eN.WV.div,{"aria-hidden":!0,...o,ref:t})});tX.displayName="SelectSeparator";var tQ="SelectArrow";o.forwardRef((e,t)=>{let{__scopeSelect:n,...o}=e,i=ti(n),s=tl(tQ,n),l=tw(tQ,n);return s.open&&"popper"===l.position?(0,r.jsx)(eJ,{...i,...o,ref:t}):null}).displayName=tQ;var tK=o.forwardRef(({__scopeSelect:e,value:t,...n},i)=>{let s=o.useRef(null),l=(0,c.e)(i,s),a=function(e){let t=o.useRef({value:e,previous:e});return o.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}(t);return o.useEffect(()=>{let e=s.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(a!==t&&n){let r=new Event("change",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[a,t]),(0,r.jsx)(eN.WV.select,{...n,style:{...e5,...n.style},ref:l,defaultValue:t})});function tY(e){return""===e||void 0===e}function tJ(e){let t=(0,eI.W)(e),n=o.useRef(""),r=o.useRef(0),i=o.useCallback(e=>{let o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(o)},[t]),s=o.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return o.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function tZ(e,t,n){var r;let o=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=(r=Math.max(n?e.indexOf(n):-1,0),e.map((t,n)=>e[(r+n)%e.length]));1===o.length&&(i=i.filter(e=>e!==n));let s=i.find(e=>e.textValue.toLowerCase().startsWith(o.toLowerCase()));return s!==n?s:void 0}tK.displayName="SelectBubbleInput";var t0=n(45895);/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let t1=(0,n(60998).Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var t2=n(70282),t4=n(46990);let t5=tu,t3=t_,t6=tp,t9=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsxs)(td,{ref:t,className:(0,t4.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...i,children:[o,(0,r.jsx)(tm,{asChild:!0,children:(0,r.jsx)(t0.Z,{className:"h-4 w-4 opacity-50"})})]})});t9.displayName=td.displayName;let t8=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(tq,{ref:t,className:(0,t4.cn)("flex cursor-default items-center justify-center py-1",n),...o,children:(0,r.jsx)(t1,{className:"h-4 w-4"})})});t8.displayName=tq.displayName;let t7=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(tU,{ref:t,className:(0,t4.cn)("flex cursor-default items-center justify-center py-1",n),...o,children:(0,r.jsx)(t0.Z,{className:"h-4 w-4"})})});t7.displayName=tU.displayName;let ne=o.forwardRef((e,t)=>{let{className:n,children:o,position:i="popper",...s}=e;return(0,r.jsx)(tg,{children:(0,r.jsxs)(tb,{ref:t,className:(0,t4.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:i,...s,children:[(0,r.jsx)(t8,{}),(0,r.jsx)(tT,{className:(0,t4.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:o}),(0,r.jsx)(t7,{})]})})});ne.displayName=tb.displayName;let nt=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(tN,{ref:t,className:(0,t4.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...o})});nt.displayName=tN.displayName;let nn=o.forwardRef((e,t)=>{let{className:n,children:o,...i}=e;return(0,r.jsxs)(tB,{ref:t,className:(0,t4.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...i,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(tz,{children:(0,r.jsx)(t2.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(tF,{children:o})]})});nn.displayName=tB.displayName;let nr=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)(tX,{ref:t,className:(0,t4.cn)("-mx-1 my-1 h-px bg-muted",n),...o})});nr.displayName=tX.displayName},68764:function(e,t,n){"use strict";n.d(t,{RM:function(){return a},Rn:function(){return f},SC:function(){return u},iA:function(){return s},pj:function(){return d},ss:function(){return h},xD:function(){return l},yt:function(){return c}});var r=n(85893),o=n(67294),i=n(46990);let s=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:(0,i.cn)("w-full caption-bottom text-base",n),...o})})});s.displayName="Table";let l=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("thead",{ref:t,className:(0,i.cn)("[&_tr]:border-b",n),...o})});l.displayName="TableHeader";let a=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("tbody",{ref:t,className:(0,i.cn)("[&_tr:last-child]:border-0",n),...o})});a.displayName="TableBody";let c=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("tfoot",{ref:t,className:(0,i.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...o})});c.displayName="TableFooter";let u=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("tr",{ref:t,className:(0,i.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...o})});u.displayName="TableRow";let h=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("th",{ref:t,className:(0,i.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",n),...o})});h.displayName="TableHead";let d=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("td",{ref:t,className:(0,i.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",n),...o})});d.displayName="TableCell";let f=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("caption",{ref:t,className:(0,i.cn)("mt-4 text-base text-muted-foreground",n),...o})});f.displayName="TableCaption"},69123:function(e,t,n){"use strict";n.d(t,{g:function(){return s}});var r=n(85893),o=n(67294),i=n(46990);let s=o.forwardRef((e,t)=>{let{className:n,...o}=e;return(0,r.jsx)("textarea",{className:(0,i.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:t,...o})});s.displayName="Textarea"},28970:function(e,t,n){"use strict";let r,o;n.d(t,{X:function(){return da}});var i,s,l,a,c,u,h,d,f=n(85893),p=n(67294),m=n(87462),g=n(63366);let v=[],b=[];function y(e){return e>=127462&&e<=127487}function w(e,t,n){if(t==e.length)return t;t&&k(e.charCodeAt(t))&&S(e.charCodeAt(t-1))&&t--;let r=x(e,t);for(t+=C(r);t<e.length;){let o=x(e,t);if(8205==r||8205==o||n&&function(e){if(e<768)return!1;for(let t=0,n=v.length;;){let r=t+n>>1;if(e<v[r])n=r;else{if(!(e>=b[r]))return!0;t=r+1}if(t==n)return!1}}(o))t+=C(o),r=o;else if(y(o)){let n=0,r=t-2;for(;r>=0&&y(x(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function x(e,t){let n=e.charCodeAt(t);if(!S(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return k(r)?(n-55296<<10)+(r-56320)+65536:n}function k(e){return e>=56320&&e<57344}function S(e){return e>=55296&&e<56320}function C(e){return e<65536?1:2}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?b:v).push(n+=e[t])})();class O{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=D(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),P.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=D(this,e,t);let n=[];return this.decompose(e,t,n,0),P.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new M(this),o=new M(e);for(let e=t,i=t;;){if(r.next(e),o.next(e),e=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(i+=r.value.length,r.done||i>=n)return!0}}iter(e=1){return new M(this,e)}iterRange(e,t=this.length){return new A(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new R(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new E(e):P.from(E.split(e,[])):O.empty}}class E extends O{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let o=0;;o++){let i=this.text[o],s=r+i.length;if((t?n:s)>=e)return new _(r,s,n,i);r=s+1,n++}}decompose(e,t,n,r){let o=e<=0&&t>=this.length?this:new E(T(this.text,[""],e,t),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=T(o.text,e.text.slice(),0,o.length);if(t.length<=32)n.push(new E(t,e.length+o.length));else{let e=t.length>>1;n.push(new E(t.slice(0,e)),new E(t.slice(e)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof E))return super.replace(e,t,n);[e,t]=D(this,e,t);let r=T(this.text,T(n.text,T(this.text,[""],0,e)),t),o=this.length+n.length-(t-e);return r.length<=32?new E(r,o):P.from(E.split(r,[]),o)}sliceString(e,t=this.length,n="\n"){[e,t]=D(this,e,t);let r="";for(let o=0,i=0;o<=t&&i<this.text.length;i++){let s=this.text[i],l=o+s.length;o>e&&i&&(r+=n),e<l&&t>o&&(r+=s.slice(Math.max(0,e-o),t-o)),o=l+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let o of e)n.push(o),r+=o.length+1,32==n.length&&(t.push(new E(n,r)),n=[],r=-1);return r>-1&&t.push(new E(n,r)),t}}class P extends O{constructor(e,t){for(let n of(super(),this.children=e,this.length=t,this.lines=0,e))this.lines+=n.lines}lineInner(e,t,n,r){for(let o=0;;o++){let i=this.children[o],s=r+i.length,l=n+i.lines-1;if((t?l:s)>=e)return i.lineInner(e,t,n,r);r=s+1,n=l+1}}decompose(e,t,n,r){for(let o=0,i=0;i<=t&&o<this.children.length;o++){let s=this.children[o],l=i+s.length;if(e<=l&&t>=i){let o=r&((i<=e?1:0)|(l>=t?2:0));i>=e&&l<=t&&!o?n.push(s):s.decompose(e-i,t-i,n,o)}i=l+1}}replace(e,t,n){if([e,t]=D(this,e,t),n.lines<this.lines)for(let r=0,o=0;r<this.children.length;r++){let i=this.children[r],s=o+i.length;if(e>=o&&t<=s){let l=i.replace(e-o,t-o,n),a=this.lines-i.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let o=this.children.slice();return o[r]=l,new P(o,this.length-(t-e)+n.length)}return super.replace(o,s,l)}o=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=D(this,e,t);let r="";for(let o=0,i=0;o<this.children.length&&i<=t;o++){let s=this.children[o],l=i+s.length;i>e&&o&&(r+=n),e<l&&t>i&&(r+=s.sliceString(e-i,t-i,n)),i=l+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof P))return 0;let n=0,[r,o,i,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,o+=t){if(r==i||o==s)return n;let l=this.children[r],a=e.children[o];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new E(n,t)}let r=Math.max(32,n>>5),o=r<<1,i=r>>1,s=[],l=0,a=-1,c=[];function u(){0!=l&&(s.push(1==c.length?c[0]:P.from(c,a)),a=-1,l=c.length=0)}for(let t of e)!function e(t){let n;if(t.lines>o&&t instanceof P)for(let n of t.children)e(n);else t.lines>i&&(l>i||!l)?(u(),s.push(t)):t instanceof E&&l&&(n=c[c.length-1])instanceof E&&t.lines+n.lines<=32?(l+=t.lines,a+=t.length+1,c[c.length-1]=new E(n.text.concat(t.text),n.length+1+t.length)):(l+t.lines>r&&u(),l+=t.lines,a+=t.length+1,c.push(t))}(t);return u(),1==s.length?s[0]:new P(s,t)}}function T(e,t,n=0,r=1e9){for(let o=0,i=0,s=!0;i<e.length&&o<=r;i++){let l=e[i],a=o+l.length;a>=n&&(a>r&&(l=l.slice(0,r-o)),o<n&&(l=l.slice(n-o)),s?(t[t.length-1]+=l,s=!1):t.push(l)),o=a+1}return t}O.empty=new E([""],0);class M{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof E?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],o=this.offsets[n],i=o>>1,s=r instanceof E?r.text.length:r.children.length;if(i==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof E){let o=r.text[i+(t<0?-1:0)];if(this.offsets[n]+=t,o.length>Math.max(0,e))return this.value=0==e?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=r.children[i+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof E?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class A{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new M(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class R{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(O.prototype[Symbol.iterator]=function(){return this.iter()},M.prototype[Symbol.iterator]=A.prototype[Symbol.iterator]=R.prototype[Symbol.iterator]=function(){return this});class _{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function D(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function N(e,t,n=!0,r=!0){return function(e,t,n=!0,r=!0){return(n?w:function(e,t,n){for(;t>0;){let r=w(e,t-2,n);if(r<t)return r;t--}return 0})(e,t,r)}(e,t,n,r)}function L(e,t){let n=e.charCodeAt(t);if(!(n>=55296&&n<56320)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return r>=56320&&r<57344?(n-55296<<10)+(r-56320)+65536:n}function I(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,(1023&e)+56320)}function j(e){return e<65536?1:2}let B=/\r\n?|\n/;var W=((i=W||(W={}))[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i);class F{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let o=this.sections[t++],i=this.sections[t++];i<0?(e(n,r,o),r+=o):r+=i,n+=o}}iterChangedRanges(e,t=!1){q(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new F(e)}composeDesc(e){return this.empty?e:e.empty?this:U(this,e)}mapDesc(e,t=!1){return e.empty?this:V(this,e,t)}mapPos(e,t=-1,n=W.Simple){let r=0,o=0;for(let i=0;i<this.sections.length;){let s=this.sections[i++],l=this.sections[i++],a=r+s;if(l<0){if(a>e)return o+(e-r);o+=s}else{if(n!=W.Simple&&a>=e&&(n==W.TrackDel&&r<e&&a>e||n==W.TrackBefore&&r<e||n==W.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!s)return e==r||t<0?o:o+l;o+=l}r=a}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let o=this.sections[n++],i=this.sections[n++],s=r+o;if(i>=0&&r<=t&&s>=e)return!(r<e)||!(s>t)||"cover";r=s}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw RangeError("Invalid JSON representation of ChangeDesc");return new F(e)}static create(e){return new F(e)}}class $ extends F{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return q(this,(t,n,r,o,i)=>e=e.replace(r,r+(n-t),i),!1),e}mapDesc(e,t=!1){return V(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,o=0;r<t.length;r+=2){let i=t[r],s=t[r+1];if(s>=0){t[r]=s,t[r+1]=i;let l=r>>1;for(;n.length<l;)n.push(O.empty);n.push(i?e.slice(o,o+i):O.empty)}o+=i}return new $(t,n)}compose(e){return this.empty?e:e.empty?this:U(this,e,!0)}map(e,t=!1){return e.empty?this:V(this,e,t,!0)}iterChanges(e,t=!1){q(this,e,t)}get desc(){return F.create(this.sections)}filter(e){let t=[],n=[],r=[],o=new G(this);e:for(let i=0,s=0;;){let l=i==e.length?1e9:e[i++];for(;s<l||s==l&&0==o.len;){if(o.done)break e;let e=Math.min(o.len,l-s);z(r,e,-1);let i=-1==o.ins?-1:0==o.off?o.ins:0;z(t,e,i),i>0&&H(n,t,o.text),o.forward(e),s+=e}let a=e[i++];for(;s<a;){if(o.done)break e;let e=Math.min(o.len,a-s);z(t,e,-1),z(r,e,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(e),s+=e}}return{changes:new $(t,n),filtered:F.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):0==r?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],o=[],i=0,s=null;function l(e=!1){if(!e&&!r.length)return;i<t&&z(r,t-i,-1);let n=new $(r,o);s=s?s.compose(n.map(s)):n,r=[],o=[],i=0}return!function e(a){if(Array.isArray(a))for(let t of a)e(t);else if(a instanceof $){if(a.length!=t)throw RangeError(`Mismatched change set length (got ${a.length}, expected ${t})`);l(),s=s?s.compose(a.map(s)):a}else{let{from:e,to:s=e,insert:c}=a;if(e>s||e<0||s>t)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let u=c?"string"==typeof c?O.of(c.split(n||B)):c:O.empty,h=u.length;if(e==s&&0==h)return;e<i&&l(),e>i&&z(r,e-i,-1),z(r,s-e,h),H(o,r,u),i=s}}(e),l(!s),s}static empty(e){return new $(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let o=e[r];if("number"==typeof o)t.push(o,-1);else if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((e,t)=>t&&"string"!=typeof e))throw RangeError("Invalid JSON representation of ChangeSet");else if(1==o.length)t.push(o[0],0);else{for(;n.length<r;)n.push(O.empty);n[r]=O.of(o.slice(1)),t.push(o[0],n[r].length)}}return new $(t,n)}static createSet(e,t){return new $(e,t)}}function z(e,t,n,r=!1){if(0==t&&n<=0)return;let o=e.length-2;o>=0&&n<=0&&n==e[o+1]?e[o]+=t:o>=0&&0==t&&0==e[o]?e[o+1]+=n:r?(e[o]+=t,e[o+1]+=n):e.push(t,n)}function H(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(O.empty);e.push(n)}}function q(e,t,n){let r=e.inserted;for(let o=0,i=0,s=0;s<e.sections.length;){let l=e.sections[s++],a=e.sections[s++];if(a<0)o+=l,i+=l;else{let c=o,u=i,h=O.empty;for(;c+=l,u+=a,a&&r&&(h=h.append(r[s-2>>1])),!n&&s!=e.sections.length&&!(e.sections[s+1]<0);)l=e.sections[s++],a=e.sections[s++];t(o,c,i,u,h),o=c,i=u}}}function V(e,t,n,r=!1){let o=[],i=r?[]:null,s=new G(e),l=new G(t);for(let e=-1;;){if(s.done&&l.len||l.done&&s.len)throw Error("Mismatched change set lengths");if(-1==s.ins&&-1==l.ins){let e=Math.min(s.len,l.len);z(o,e,-1),s.forward(e),l.forward(e)}else if(l.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(l.len<s.len||l.len==s.len&&!n))){let t=l.len;for(z(o,l.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(z(o,0,s.ins),i&&H(i,o,s.text),e=s.i),s.forward(n),t-=n}l.next()}else if(s.ins>=0){let t=0,n=s.len;for(;n;)if(-1==l.ins){let e=Math.min(n,l.len);t+=e,n-=e,l.forward(e)}else if(0==l.ins&&l.len<n)n-=l.len,l.next();else break;z(o,t,e<s.i?s.ins:0),i&&e<s.i&&H(i,o,s.text),e=s.i,s.forward(s.len-n)}else if(s.done&&l.done)return i?$.createSet(o,i):F.create(o);else throw Error("Mismatched change set lengths")}}function U(e,t,n=!1){let r=[],o=n?[]:null,i=new G(e),s=new G(t);for(let e=!1;;){if(i.done&&s.done)return o?$.createSet(r,o):F.create(r);if(0==i.ins)z(r,i.len,0,e),i.next();else if(0!=s.len||s.done){if(i.done||s.done)throw Error("Mismatched change set lengths");{let t=Math.min(i.len2,s.len),n=r.length;if(-1==i.ins){let n=-1==s.ins?-1:s.off?0:s.ins;z(r,t,n,e),o&&n&&H(o,r,s.text)}else -1==s.ins?(z(r,i.off?0:i.len,t,e),o&&H(o,r,i.textBit(t))):(z(r,i.off?0:i.len,s.off?0:s.ins,e),o&&!s.off&&H(o,r,s.text));e=(i.ins>t||s.ins>=0&&s.len>t)&&(e||r.length>n),i.forward2(t),s.forward(t)}}else z(r,0,s.ins,e),o&&H(o,r,s.text),s.next()}}class G{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return -2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?O.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?O.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class X{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new X(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Q.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Q.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw RangeError("Invalid JSON representation for SelectionRange");return Q.range(e.anchor,e.head)}static create(e,t,n){return new X(e,t,n)}}class Q{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Q.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Q([this.main],0)}addRange(e,t=!0){return Q.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Q.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new Q(e.ranges.map(e=>X.fromJSON(e)),e.main)}static single(e,t=e){return new Q([Q.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let o=e[r];if(o.empty?o.from<=n:o.from<n)return Q.normalized(e.slice(),t);n=o.to}return new Q(e,t)}static cursor(e,t=0,n,r){return X.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=r?r:16777215)<<6)}static range(e,t,n,r){let o=(null!=n?n:16777215)<<6|(null==r?7:Math.min(6,r));return t<e?X.create(t,e,48|o):X.create(e,t,(t>e?8:0)|o)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let r=e[n],o=e[n-1];if(r.empty?r.from<=o.to:r.from<o.to){let i=o.from,s=Math.max(r.to,o.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?Q.range(s,i):Q.range(i,s))}}return new Q(e,t)}}function K(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}let Y=0;class J{constructor(e,t,n,r,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Y++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}get reader(){return this}static define(e={}){return new J(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Z),!!e.static,e.enables)}of(e){return new ee([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new ee(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new ee(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function Z(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class ee{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Y++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,o=this.id,i=e[o]>>1,s=2==this.type,l=!1,a=!1,c=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:((null!==(t=e[n.id])&&void 0!==t?t:1)&1)==0&&c.push(e[n.id]);return{create:e=>(e.values[i]=n(e),1),update(e,t){if(l&&t.docChanged||a&&(t.docChanged||t.selection)||en(e,c)){let t=n(e);if(s?!et(t,e.values[i],r):!r(t,e.values[i]))return e.values[i]=t,1}return 0},reconfigure:(e,t)=>{let l,a=t.config.address[o];if(null!=a){let o=ef(t,a);if(this.dependencies.every(n=>n instanceof J?t.facet(n)===e.facet(n):!(n instanceof eo)||t.field(n,!1)==e.field(n,!1))||(s?et(l=n(e),o,r):r(l=n(e),o)))return e.values[i]=o,0}else l=n(e);return e.values[i]=l,1}}}}function et(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function en(e,t){let n=!1;for(let r of t)1&ed(e,r)&&(n=!0);return n}let er=J.define({static:!0});class eo{constructor(e,t,n,r,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let t=new eo(Y++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(er).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],o=this.updateF(r,n);return this.compareF(r,o)?0:(e.values[t]=o,1)},reconfigure:(e,n)=>{let r=e.facet(er),o=n.facet(er),i;return(i=r.find(e=>e.field==this))&&i!=o.find(e=>e.field==this)?(e.values[t]=i.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,er.of({field:this,create:e})]}get extension(){return this}}let ei={lowest:4,low:3,default:2,high:1,highest:0};function es(e){return t=>new ea(t,e)}let el={highest:es(ei.highest),high:es(ei.high),default:es(ei.default),low:es(ei.low),lowest:es(ei.lowest)};class ea{constructor(e,t){this.inner=e,this.prec=t}}class ec{of(e){return new eu(this,e)}reconfigure(e){return ec.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class eu{constructor(e,t){this.compartment=e,this.inner=t}}class eh{constructor(e,t,n,r,o,i){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=o,this.facets=i,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let r,o,i=[],s=Object.create(null),l=new Map;for(let n of(r=[[],[],[],[],[]],o=new Map,!function e(n,i){let s=o.get(n);if(null!=s){if(s<=i)return;let e=r[s].indexOf(n);e>-1&&r[s].splice(e,1),n instanceof eu&&l.delete(n.compartment)}if(o.set(n,i),Array.isArray(n))for(let t of n)e(t,i);else if(n instanceof eu){if(l.has(n.compartment))throw RangeError("Duplicate use of compartment in extensions");let r=t.get(n.compartment)||n.inner;l.set(n.compartment,r),e(r,i)}else if(n instanceof ea)e(n.inner,n.prec);else if(n instanceof eo)r[i].push(n),n.provides&&e(n.provides,i);else if(n instanceof ee)r[i].push(n),n.facet.extensions&&e(n.facet.extensions,ei.default);else{let t=n.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${n}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,i)}}(e,ei.default),r.reduce((e,t)=>e.concat(t))))n instanceof eo?i.push(n):(s[n.facet.id]||(s[n.facet.id]=[])).push(n);let a=Object.create(null),c=[],u=[];for(let e of i)a[e.id]=u.length<<1,u.push(t=>e.slot(t));let h=null==n?void 0:n.config.facets;for(let e in s){let t=s[e],r=t[0].facet,o=h&&h[e]||[];if(t.every(e=>0==e.type)){if(a[r.id]=c.length<<1|1,Z(o,t))c.push(n.facet(r));else{let e=r.combine(t.map(e=>e.value));c.push(n&&r.compare(e,n.facet(r))?n.facet(r):e)}}else{for(let e of t)0==e.type?(a[e.id]=c.length<<1|1,c.push(e.value)):(a[e.id]=u.length<<1,u.push(t=>e.dynamicSlot(t)));a[r.id]=u.length<<1,u.push(e=>(function(e,t,n){let r=n.map(t=>e[t.id]),o=n.map(e=>e.type),i=r.filter(e=>!(1&e)),s=e[t.id]>>1;function l(e){let n=[];for(let t=0;t<r.length;t++){let i=ef(e,r[t]);if(2==o[t])for(let e of i)n.push(e);else n.push(i)}return t.combine(n)}return{create(e){for(let t of r)ed(e,t);return e.values[s]=l(e),1},update(e,n){if(!en(e,i))return 0;let r=l(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,o){let i=en(e,r),a=o.config.facets[t.id],c=o.facet(t);if(a&&!i&&Z(n,a))return e.values[s]=c,0;let u=l(e);return t.compare(u,c)?(e.values[s]=c,0):(e.values[s]=u,1)}}})(e,r,t))}}return new eh(e,l,u.map(e=>e(a)),a,c,s)}}function ed(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let o=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|o}function ef(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}let ep=J.define(),em=J.define({combine:e=>e.some(e=>e),static:!0}),eg=J.define({combine:e=>e.length?e[0]:void 0,static:!0}),ev=J.define(),eb=J.define(),ey=J.define(),ew=J.define({combine:e=>!!e.length&&e[0]});class ex{constructor(e,t){this.type=e,this.value=t}static define(){return new ek}}class ek{of(e){return new ex(this,e)}}class eS{constructor(e){this.map=e}of(e){return new eC(this,e)}}class eC{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new eC(this.type,t)}is(e){return this.type==e}static define(e={}){return new eS(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}eC.reconfigure=eC.define(),eC.appendConfig=eC.define();class eO{constructor(e,t,n,r,o,i){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=o,this.scrollIntoView=i,this._doc=null,this._state=null,n&&K(n,t.newLength),o.some(e=>e.type==eO.time)||(this.annotations=o.concat(eO.time.of(Date.now())))}static create(e,t,n,r,o,i){return new eO(e,t,n,r,o,i)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(eO.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function eE(e,t,n){var r;let o,i,s;return n?(o=t.changes,i=$.empty(t.changes.length),s=e.changes.compose(t.changes)):(o=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(o)),{changes:s,selection:t.selection?t.selection.map(i):null===(r=e.selection)||void 0===r?void 0:r.map(o),effects:eC.mapEffects(e.effects,o).concat(eC.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function eP(e,t,n){let r=t.selection,o=eM(t.annotations);return t.userEvent&&(o=o.concat(eO.userEvent.of(t.userEvent))),{changes:t.changes instanceof $?t.changes:$.of(t.changes||[],n,e.facet(eg)),selection:r&&(r instanceof Q?r:Q.single(r.anchor,r.head)),effects:eM(t.effects),annotations:o,scrollIntoView:!!t.scrollIntoView}}eO.time=ex.define(),eO.userEvent=ex.define(),eO.addToHistory=ex.define(),eO.remote=ex.define();let eT=[];function eM(e){return null==e?eT:Array.isArray(e)?e:[e]}var eA=((s=eA||(eA={}))[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s);let eR=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{r=RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class e_{constructor(e,t,n,r,o,i){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,i&&(i._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)ed(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null==n){if(t)throw RangeError("Field is not present in this state");return}return ed(this,n),ef(this,n)}update(...e){return function e(t,n,r){let o=eP(t,n.length?n[0]:{},t.doc.length);n.length&&!1===n[0].filter&&(r=!1);for(let e=1;e<n.length;e++){!1===n[e].filter&&(r=!1);let i=!!n[e].sequential;o=eE(o,eP(t,n[e],i?o.changes.newLength:t.doc.length),i)}let i=eO.create(t,o.changes,o.selection,o.effects,o.annotations,o.scrollIntoView);return function(e){let t=e.startState,n=t.facet(ey),r=e;for(let o=n.length-1;o>=0;o--){let i=n[o](e);i&&Object.keys(i).length&&(r=eE(r,eP(t,i,e.changes.newLength),!0))}return r==e?e:eO.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(r?function(t){let n=t.startState,r=!0;for(let e of n.facet(ev)){let n=e(t);if(!1===n){r=!1;break}Array.isArray(n)&&(r=!0===r?n:function(e,t){let n=[];for(let r=0,o=0;;){let i,s;if(r<e.length&&(o==t.length||t[o]>=e[r]))i=e[r++],s=e[r++];else{if(!(o<t.length))return n;i=t[o++],s=t[o++]}!n.length||n[n.length-1]<i?n.push(i,s):n[n.length-1]<s&&(n[n.length-1]=s)}}(r,n))}if(!0!==r){let e,o;if(!1===r)o=t.changes.invertedDesc,e=$.empty(n.doc.length);else{let n=t.changes.filter(r);e=n.changes,o=n.filtered.mapDesc(n.changes).invertedDesc}t=eO.create(n,e,t.selection&&t.selection.map(o),eC.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let o=n.facet(eb);for(let r=o.length-1;r>=0;r--){let i=o[r](t);t=i instanceof eO?i:Array.isArray(i)&&1==i.length&&i[0]instanceof eO?i[0]:e(n,eM(i),!1)}return t}(i):i)}(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:r,compartments:o}=n;for(let t of e.effects)t.is(ec.reconfigure)?(n&&(o=new Map,n.compartments.forEach((e,t)=>o.set(t,e)),n=null),o.set(t.value.compartment,t.value.extension)):t.is(eC.reconfigure)?(n=null,r=t.value):t.is(eC.appendConfig)&&(n=null,r=eM(r).concat(t.value));t=n?e.startState.values.slice():new e_(n=eh.resolve(r,o,this),this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values;let i=e.startState.facet(em)?e.newSelection:e.newSelection.asSingle();new e_(n,e.newDoc,i,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Q.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),o=[n.range],i=eM(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),l=this.changes(s.changes),a=l.map(r);for(let e=0;e<n;e++)o[e]=o[e].map(a);let c=r.mapDesc(l,!0);o.push(s.range.map(c)),r=r.compose(a),i=eC.mapEffects(i,a).concat(eC.mapEffects(eM(s.effects),c))}return{changes:r,selection:Q.create(o,t.mainIndex),effects:i}}changes(e=[]){return e instanceof $?e:$.of(e,this.doc.length,this.facet(e_.lineSeparator))}toText(e){return O.of(e.split(this.facet(e_.lineSeparator)||B))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(ed(this,t),ef(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof eo&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let o=n[t],i=e[t];r.push(o.init(e=>o.spec.fromJSON(i,e)))}}return e_.create({doc:e.doc,selection:Q.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=eh.resolve(e.extensions||[],new Map),n=e.doc instanceof O?e.doc:O.of((e.doc||"").split(t.staticFacet(e_.lineSeparator)||B)),r=e.selection?e.selection instanceof Q?e.selection:Q.single(e.selection.anchor,e.selection.head):Q.single(0);return K(r,n.length),t.staticFacet(em)||(r=r.asSingle()),new e_(t,n,r,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e_.tabSize)}get lineBreak(){return this.facet(e_.lineSeparator)||"\n"}get readOnly(){return this.facet(ew)}phrase(e,...t){for(let t of this.facet(e_.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let r=+(n||1);return!r||r>t.length?e:t[r-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let o of this.facet(ep))for(let i of o(this,t,n))Object.prototype.hasOwnProperty.call(i,e)&&r.push(i[e]);return r}charCategorizer(e){var t;let n=this.languageDataAt("wordChars",e);return t=n.length?n[0]:"",e=>{if(!/\S/.test(e))return eA.Space;if(function(e){if(r)return r.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||eR.test(n)))return!0}return!1}(e))return eA.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return eA.Word;return eA.Other}}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),i=e-n,s=e-n;for(;i>0;){let e=N(t,i,!1);if(o(t.slice(e,i))!=eA.Word)break;i=e}for(;s<r;){let e=N(t,s);if(o(t.slice(s,e))!=eA.Word)break;s=e}return i==s?null:Q.range(i+n,s+n)}}function eD(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let o=t[e],i=r[e];if(void 0===i)r[e]=o;else if(i===o||void 0===o);else if(Object.hasOwnProperty.call(n,e))r[e]=n[e](i,o);else throw Error("Config merge conflict for field "+e)}for(let e in t)void 0===r[e]&&(r[e]=t[e]);return r}e_.allowMultipleSelections=em,e_.tabSize=J.define({combine:e=>e.length?e[0]:4}),e_.lineSeparator=eg,e_.readOnly=ew,e_.phrases=J.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),e_.languageData=ep,e_.changeFilter=ev,e_.transactionFilter=eb,e_.transactionExtender=ey,ec.reconfigure=eC.define();class eN{eq(e){return this==e}range(e,t=e){return eI.create(e,t,this)}}function eL(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}eN.prototype.startSide=eN.prototype.endSide=0,eN.prototype.point=!1,eN.prototype.mapMode=W.TrackDel;class eI{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new eI(e,t,n)}}function ej(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class eB{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let o=n?this.to:this.from;for(let i=r,s=o.length;;){if(i==s)return i;let r=i+s>>1,l=o[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==i)return l>=0?i:s;l>=0?s=r:i=r+1}}between(e,t,n,r){for(let o=this.findIndex(t,-1e9,!0),i=this.findIndex(n,1e9,!1,o);o<i;o++)if(!1===r(this.from[o]+e,this.to[o]+e,this.value[o]))return!1}map(e,t){let n=[],r=[],o=[],i=-1,s=-1;for(let l=0;l<this.value.length;l++){let a=this.value[l],c=this.from[l]+e,u=this.to[l]+e,h,d;if(c==u){let e=t.mapPos(c,a.startSide,a.mapMode);if(null==e||(h=d=e,a.startSide!=a.endSide&&(d=t.mapPos(c,a.endSide))<h))continue}else if((h=t.mapPos(c,a.startSide))>(d=t.mapPos(u,a.endSide))||h==d&&a.startSide>0&&a.endSide<=0)continue;0>(d-h||a.endSide-a.startSide)||(i<0&&(i=h),a.point&&(s=Math.max(s,d-h)),n.push(a),r.push(h-i),o.push(d-i))}return{mapped:n.length?new eB(r,o,n,s):null,pos:i}}}class eW{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new eW(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:o=this.length}=e,i=e.filter;if(0==t.length&&!i)return this;if(n&&(t=t.slice().sort(ej)),this.isEmpty)return t.length?eW.of(t):this;let s=new ez(this,null,-1).goto(0),l=0,a=[],c=new eF;for(;s.value||l<t.length;)if(l<t.length&&(s.from-t[l].from||s.startSide-t[l].value.startSide)>=0){let e=t[l++];c.addInner(e.from,e.to,e.value)||a.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(s.chunkIndex)<t[l].from)&&(!i||r>this.chunkEnd(s.chunkIndex)||o<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!i||r>s.to||o<s.from||i(s.from,s.to,s.value))&&!c.addInner(s.from,s.to,s.value)&&a.push(eI.create(s.from,s.to,s.value)),s.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?eW.empty:this.nextLayer.update({add:a,filter:i,filterFrom:r,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let i=this.chunkPos[o],s=this.chunk[o],l=e.touchesRange(i,i+s.length);if(!1===l)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(i));else if(!0===l){let{mapped:o,pos:l}=s.map(i,e);o&&(r=Math.max(r,o.maxPoint),t.push(o),n.push(l))}}let o=this.nextLayer.map(e);return 0==t.length?o:new eW(n,t,o||eW.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],i=this.chunk[r];if(t>=o&&e<=o+i.length&&!1===i.between(o,e-o,t-o,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return eH.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return eH.from(e).goto(t)}static compare(e,t,n,r,o=-1){let i=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o),l=e$(i,s,n),a=new eV(i,l,o),c=new eV(s,l,o);n.iterGaps((e,t,n)=>eU(a,e,c,t,n,r)),n.empty&&0==n.length&&eU(a,0,c,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=999999999);let o=e.filter(e=>!e.isEmpty&&0>t.indexOf(e)),i=t.filter(t=>!t.isEmpty&&0>e.indexOf(t));if(o.length!=i.length)return!1;if(!o.length)return!0;let s=e$(o,i),l=new eV(o,s,0).goto(n),a=new eV(i,s,0).goto(n);for(;;){if(l.to!=a.to||!eG(l.active,a.active)||l.point&&(!a.point||!eL(l.point,a.point)))return!1;if(l.to>r)return!0;l.next(),a.next()}}static spans(e,t,n,r,o=-1){let i=new eV(e,null,o).goto(t),s=t,l=i.openStart;for(;;){let e=Math.min(i.to,n);if(i.point){let n=i.activeForPoint(i.to),o=i.pointFrom<t?n.length+1:i.point.startSide<0?n.length:Math.min(n.length,l);r.point(s,e,i.point,n,o,i.pointRank),l=Math.min(i.openEnd(e),n.length)}else e>s&&(r.span(s,e,i.active,l),l=i.openEnd(e));if(i.to>n)return l+(i.point&&i.to>n?1:0);s=i.to,i.next()}}static of(e,t=!1){let n=new eF;for(let r of e instanceof eI?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(ej(t,r)>0)return e.slice().sort(ej);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return eW.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=eW.empty;r=r.nextLayer)t=new eW(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}eW.empty=new eW([],[],null,-1),eW.empty.nextLayer=eW.empty;class eF{finishChunk(e){this.chunks.push(new eB(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new eF)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&0>(e-this.lastFrom||n.startSide-this.last.startSide))throw Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if(0>(e-this.lastTo||t.value[0].startSide-this.last.endSide))return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(eW.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=eW.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function e$(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let o=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let i=r.get(e.chunk[t]);null==i||(n?n.mapPos(i):i)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(i,i+e.chunk[t].length))||o.add(e.chunk[t])}return o}class ez{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){0>(this.to-e||this.endSide-t)&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class eH{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let o=0;o<e.length;o++)for(let i=e[o];!i.isEmpty;i=i.nextLayer)i.maxPoint>=n&&r.push(new ez(i,t,n,o));return 1==r.length?r[0]:new eH(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)eq(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)eq(this.heap,e);0>(this.to-e||this.value.endSide-t)&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),eq(this.heap,0)}}}function eq(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let o=e[r];if(r+1<e.length&&o.compare(e[r+1])>=0&&(o=e[r+1],r++),0>n.compare(o))break;e[r]=n,e[t]=o,t=r}}class eV{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=eH.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&0>(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t);)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){eX(this.active,e),eX(this.activeTo,e),eX(this.activeRank,e),this.minActive=eK(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||r-this.activeTo[t])>0;)t++;eQ(this.active,t,n),eQ(this.activeTo,t,r),eQ(this.activeRank,t,o),e&&eQ(e,t,this.cursor.from),this.minActive=eK(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&0>(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&eX(n,r)}else if(this.cursor.value){if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else this.addActive(n),this.cursor.next()}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function eU(e,t,n,r,o,i){e.goto(t),n.goto(r);let s=r+o,l=r,a=r-t,c=!!i.boundChange;for(let t=!1;;){let r=e.to+a-n.to,o=r||e.endSide-n.endSide,u=o<0?e.to+a:n.to,h=Math.min(u,s);if(e.point||n.point?(e.point&&n.point&&eL(e.point,n.point)&&eG(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(l,h,e.point,n.point),t=!1):(t&&i.boundChange(l),h>l&&!eG(e.active,n.active)&&i.compareRange(l,h,e.active,n.active),c&&h<s&&(r||e.openEnd(u)!=n.openEnd(u))&&(t=!0)),u>s)break;l=u,o<=0&&e.next(),o>=0&&n.next()}}function eG(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!eL(e[n],t[n]))return!1;return!0}function eX(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function eQ(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function eK(e,t){let n=-1,r=1e9;for(let o=0;o<t.length;o++)0>(t[o]-r||e[o].endSide-e[n].endSide)&&(n=o,r=t[o]);return n}function eY(e,t,n=e.length){let r=0;for(let o=0;o<n&&o<e.length;)9==e.charCodeAt(o)?(r+=t-r%t,o++):(r++,o=N(e,o));return r}function eJ(e,t,n,r){for(let r=0,o=0;;){if(o>=t)return r;if(r==e.length)break;o+=9==e.charCodeAt(r)?n-o%n:1,r=N(e,r)}return!0===r?-1:e.length}let eZ="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),e0="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),e1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class e2{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}for(let t in e)!function e(t,o,i,s){let l=[],a=/^@(\w+)\b/.exec(t[0]),c=a&&"keyframes"==a[1];if(a&&null==o)return i.push(t[0]+";");for(let n in o){let s=o[n];if(/&/.test(n))e(n.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((e,t)=>e.concat(t)),s,i);else if(s&&"object"==typeof s){if(!a)throw RangeError("The value of a property ("+n+") should be a primitive value.");e(r(n),s,l,c)}else null!=s&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(l.length||c)&&i.push((!n||a||s?t:t.map(n)).join(", ")+" {"+l.join(" ")+"}")}(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=e1[eZ]||1;return e1[eZ]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[e0],o=n&&n.nonce;r?o&&r.setNonce(o):r=new e5(e,o),r.mount(Array.isArray(t)?t:[t],e)}}let e4=new Map;class e5{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=e4.get(n);if(t)return e[e0]=t;this.sheet=new r.CSSStyleSheet,e4.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[e0]=this}mount(e,t){let n=this.sheet,r=0,o=0;for(let t=0;t<e.length;t++){let i=e[t],s=this.modules.indexOf(i);if(s<o&&s>-1&&(this.modules.splice(s,1),o--,s=-1),-1==s){if(this.modules.splice(o++,0,i),n)for(let e=0;e<i.rules.length;e++)n.insertRule(i.rules[e],r++)}else{for(;o<s;)r+=this.modules[o++].rules.length;r+=i.rules.length,o++}}if(n)0>t.adoptedStyleSheets.indexOf(this.sheet)&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var e3={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},e6={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},e9="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),e8="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),e7=0;e7<10;e7++)e3[48+e7]=e3[96+e7]=String(e7);for(var e7=1;e7<=24;e7++)e3[e7+111]="F"+e7;for(var e7=65;e7<=90;e7++)e3[e7]=String.fromCharCode(e7+32),e6[e7]=String.fromCharCode(e7);for(var te in e3)e6.hasOwnProperty(te)||(e6[te]=e3[te]);function tt(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var o=n[r];"string"==typeof o?e.setAttribute(r,o):null!=o&&(e[r]=o)}t++}for(;t<arguments.length;t++)!function e(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null==n);else if(null!=n.nodeType)t.appendChild(n);else if(Array.isArray(n))for(var r=0;r<n.length;r++)e(t,n[r]);else throw RangeError("Unsupported child node: "+n)}(e,arguments[t]);return e}let tn="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},tr="undefined"!=typeof document?document:{documentElement:{style:{}}},to=/Edge\/(\d+)/.exec(tn.userAgent),ti=/MSIE \d/.test(tn.userAgent),ts=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(tn.userAgent),tl=!!(ti||ts||to),ta=!tl&&/gecko\/(\d+)/i.test(tn.userAgent),tc=!tl&&/Chrome\/(\d+)/.exec(tn.userAgent),tu="webkitFontSmoothing"in tr.documentElement.style,th=!tl&&/Apple Computer/.test(tn.vendor),td=th&&(/Mobile\/\w+/.test(tn.userAgent)||tn.maxTouchPoints>2);var tf={mac:td||/Mac/.test(tn.platform),windows:/Win/.test(tn.platform),linux:/Linux|X11/.test(tn.platform),ie:tl,ie_version:ti?tr.documentMode||6:ts?+ts[1]:to?+to[1]:0,gecko:ta,gecko_version:ta?+(/Firefox\/(\d+)/.exec(tn.userAgent)||[0,0])[1]:0,chrome:!!tc,chrome_version:tc?+tc[1]:0,ios:td,android:/Android\b/.test(tn.userAgent),webkit:tu,webkit_version:tu?+(/\bAppleWebKit\/(\d+)/.exec(tn.userAgent)||[0,0])[1]:0,safari:th,safari_version:th?+(/\bVersion\/(\d+(\.\d+)?)/.exec(tn.userAgent)||[0,0])[1]:0,tabSize:null!=tr.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function tp(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}let tm=Object.create(null);function tg(e,t,n){if(e==t)return!0;e||(e=tm),t||(t=tm);let r=Object.keys(e),o=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=o.length-(n&&o.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(-1==o.indexOf(i)||e[i]!==t[i]))return!1;return!0}function tv(e,t,n){let r=!1;if(t)for(let o in t)n&&o in n||(r=!0,"style"==o?e.style.cssText="":e.removeAttribute(o));if(n)for(let o in n)t&&t[o]==n[o]||(r=!0,"style"==o?e.style.cssText=n[o]:e.setAttribute(o,n[o]));return r}class tb{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return -1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var ty=((l=ty||(ty={}))[l.Text=0]="Text",l[l.WidgetBefore=1]="WidgetBefore",l[l.WidgetAfter=2]="WidgetAfter",l[l.WidgetRange=3]="WidgetRange",l);class tw extends eN{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new tx(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new tS(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:o,end:i}=tC(e,t);n=(o?t?-3e8:-1:5e8)-1,r=(i?t?2e8:1:-6e8)+1}return new tS(e,n,r,t,e.widget||null,!0)}static line(e){return new tk(e)}static set(e,t=!1){return eW.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}tw.none=eW.empty;class tx extends tw{constructor(e){let{start:t,end:n}=tC(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?tp(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||tm}eq(e){return this==e||e instanceof tx&&this.tagName==e.tagName&&tg(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}}tx.prototype.point=!1;class tk extends tw{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof tk&&this.spec.class==e.spec.class&&tg(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}tk.prototype.mapMode=W.TrackBefore,tk.prototype.point=!0;class tS extends tw{constructor(e,t,n,r,o,i){super(t,n,o,e),this.block=r,this.isReplace=i,this.mapMode=r?t<=0?W.TrackBefore:W.TrackAfter:W.TrackDel}get type(){return this.startSide!=this.endSide?ty.WidgetRange:this.startSide<=0?ty.WidgetBefore:ty.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){var t,n;return e instanceof tS&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function tC(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function tO(e,t,n,r=0){let o=n.length-1;o>=0&&n[o]+r>=e?n[o]=Math.max(n[o],t):n.push(e,t)}tS.prototype.point=!0;class tE extends eN{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof tE&&this.tagName==e.tagName&&tg(this.attributes,e.attributes)}static create(e){return new tE(e.tagName,e.attributes||tm)}static set(e,t=!1){return eW.of(e,t)}}function tP(e){return(11==e.nodeType?e.getSelection?e:e.ownerDocument:e).getSelection()}function tT(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function tM(e,t){if(!t.anchorNode)return!1;try{return tT(e,t.anchorNode)}catch(e){return!1}}function tA(e){return 3==e.nodeType?t$(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function tR(e,t,n,r){return!!n&&(tN(e,t,n,r,-1)||tN(e,t,n,r,1))}function t_(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function tD(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function tN(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:tL(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=t_(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType||1==(e=e.childNodes[t+(o<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=o<0?tL(e):0}}}function tL(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tI(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function tj(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||1>Math.abs(t.width-e.offsetWidth))&&(n=1),(r>.995&&r<1.005||!isFinite(r)||1>Math.abs(t.height-e.offsetHeight))&&(r=1),{scaleX:n,scaleY:r}}tE.prototype.startSide=tE.prototype.endSide=-1;class tB{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?tL(t):0),n,Math.min(e.focusOffset,n?tL(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let tW=null;function tF(e){if(e.setActive)return e.setActive();if(tW)return e.focus(tW);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==tW?{get preventScroll(){return tW={preventScroll:!0},!0}}:void 0),!tW){tW=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],o=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=o&&(n.scrollLeft=o)}}}function t$(e,t,n=t){let r=o||(o=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function tz(e,t,n,r){let o={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,metaKey:o.metaKey}=r);let i=new KeyboardEvent("keydown",o);i.synthetic=!0,e.dispatchEvent(i);let s=new KeyboardEvent("keyup",o);return s.synthetic=!0,e.dispatchEvent(s),i.defaultPrevented||s.defaultPrevented}function tH(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function tq(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r>0)return{node:n,offset:r};if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;r=tL(n=n.childNodes[r-1])}else{if(!n.parentNode||tD(n))return null;r=t_(n),n=n.parentNode}}}function tV(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||tD(n))return null;r=t_(n)+1,n=n.parentNode}}}tf.safari&&tf.safari_version>=26&&(tW=!1);class tU{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new tU(e.parentNode,t_(e),t)}static after(e,t){return new tU(e.parentNode,t_(e)+1,t)}}var tG=((a=tG||(tG={}))[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a);let tX=tG.LTR,tQ=tG.RTL;function tK(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}let tY=tK("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),tJ=tK("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),tZ=Object.create(null),t0=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);tZ[t]=n,tZ[n]=-t}function t1(e){return e<=247?tY[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?tJ[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}let t2=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class t4{get dir(){return this.level%2?tQ:tX}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let o=-1;for(let i=0;i<e.length;i++){let s=e[i];if(s.from<=t&&s.to>=t){if(s.level==n)return i;(o<0||(0!=r?r<0?s.from<t:s.to>t:e[o].level>s.level))&&(o=i)}}if(o<0)throw RangeError("Index out of range");return o}}let t5=[];function t3(e){return[new t4(0,e,0)]}let t6="",t9=J.define(),t8=J.define(),t7=J.define(),ne=J.define(),nt=J.define(),nn=J.define(),nr=J.define(),no=J.define(),ni=J.define(),ns=J.define({combine:e=>e.some(e=>e)}),nl=J.define({combine:e=>e.some(e=>e)}),na=J.define();class nc{constructor(e,t="nearest",n="nearest",r=5,o=5,i=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=o,this.isSnapshot=i}map(e){return e.empty?this:new nc(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new nc(Q.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}let nu=eC.define({map:(e,t)=>e.map(t)}),nh=eC.define();function nd(e,t,n){let r=e.facet(ne);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}let nf=J.define({combine:e=>!e.length||e[0]}),np=0,nm=J.define({combine:e=>e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})});class ng{constructor(e,t,n,r,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(nm.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(nm.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:n,eventObservers:r,provide:o,decorations:i}=t||{};return new ng(np++,e,n,r,e=>{let t=[];return i&&t.push(nw.of(t=>{let n=t.plugin(e);return n?i(n):tw.none})),o&&t.push(o(e)),t})}static fromClass(e,t){return ng.define((t,n)=>new e(t,n),t)}}class nv{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(nd(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){nd(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){nd(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}let nb=J.define(),ny=J.define(),nw=J.define(),nx=J.define(),nk=J.define(),nS=J.define(),nC=J.define();function nO(e,t){let n=e.state.facet(nC);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),o=[];return eW.spans(r,t.from,t.to,{point(){},span(e,n,r,i){let s=e-t.from,l=n-t.from,a=o;for(let e=r.length-1;e>=0;e--,i--){let n=r[e].spec.bidiIsolate,o;if(null==n&&(n=function(e,t,n){for(let r=t;r<n;r++){let t=t1(e.charCodeAt(r));if(1==t)break;if(2==t||4==t)return tQ}return tX}(t.text,s,l)),i>0&&a.length&&(o=a[a.length-1]).to==s&&o.direction==n)o.to=l,a=o.inner;else{let e={from:s,to:l,direction:n,inner:[]};a.push(e),a=e.inner}}}}),o}let nE=J.define();function nP(e){let t=0,n=0,r=0,o=0;for(let i of e.state.facet(nE)){let s=i(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(o=Math.max(o,s.bottom)))}return{left:t,right:n,top:r,bottom:o}}let nT=J.define();class nM{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new nM(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let r=0,o=0,i=0;;){let s=Math.min(r<e.length?e[r].fromB:1e9,o<t.length?t[o]:1e9);if(1e9==s)break;let l=s+i,a=s,c=l;for(;;)if(o<t.length&&t[o]<=a){let n=t[o+1];o+=2,a=Math.max(a,n);for(let t=r;t<e.length&&e[t].fromB<=a;t++)i=e[t].toA-e[t].toB;c=Math.max(c,n+i)}else if(r<e.length&&e[r].fromB<=a){let t=e[r++];a=Math.max(a,t.toB),c=Math.max(c,t.toA),i=t.toA-t.toB}else break;n.push(new nM(l,c,s,a))}return n}}class nA{constructor(e,t,n){for(let r of(this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=$.empty(this.startState.doc.length),n))this.changes=this.changes.compose(r.changes);let r=[];this.changes.iterChangedRanges((e,t,n,o)=>r.push(new nM(e,t,n,o))),this.changedRanges=r}static create(e,t,n){return new nA(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}let nR=[];class n_{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return nR}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;null==t[r]&&e.removeAttribute(r)}for(let n in t){let r=t[n];"style"==n?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=t_(this.dom),r=this.length?e>0:t>0;return new tU(this.parent.dom,n+(r?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof nL)return e;return null}static get(e){return e.cmTile}}class nD extends n_{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t=this.dom,n=null,r,o=(null==e?void 0:e.node)==t?e:null,i=0;for(let s of this.children){if(s.sync(e),i+=s.length+s.breakAfter,r=n?n.nextSibling:t.firstChild,o&&r!=s.dom&&(o.written=!0),s.dom.parentNode==t)for(;r&&r!=s.dom;)r=nN(r);else t.insertBefore(s.dom,r);n=s.dom}for(r=n?n.nextSibling:t.firstChild,o&&r&&(o.written=!0);r;)r=nN(r);this.length=i}}function nN(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class nL extends nD{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=n_.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,o=0;;)if(r==n.children.length){if(!t.length)return;(n=n.parent).breakAfter&&o++,r=t.pop()}else{let i=n.children[r++];if(i instanceof nI)t.push(r),n=i,r=0;else{let t=o+i.length,n=e(i,o);if(void 0!==n)return n;o=t+i.breakAfter}}}resolveBlock(e,t){let n,r=-1,o,i=-1;if(this.blockTiles((s,l)=>{let a=l+s.length;if(e>=l&&e<=a){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(n=void 0)}(l<e||e==a&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget())&&(n=s,r=e-l),(a>e||e==l&&(t>1?s.length:s.covers(-1)))&&(!o||!s.isWidget()&&o.isWidget())&&(o=s,i=e-l)}}),!n&&!o)throw Error("No tile at position "+e);return n&&t<0||!o?{tile:n,offset:r}:{tile:o,offset:i}}}class nI extends nD{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new nI(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class nj extends nD{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new nj(t||document.createElement("div"),e);return t&&n||(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,o=-1,i=null,s=-1;!function e(l,a){for(let c=0,u=0;c<l.children.length&&u<=a;c++){let h=l.children[c],d=u+h.length;d>=a&&(h.isComposite()?e(h,a-u):(!i||i.isHidden&&(t>0||n&&function(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}(i,h)))&&(d>a||32&h.flags)?(i=h,s=a-u):(u<a||16&h.flags&&!h.isHidden)&&(r=h,o=a-u)),u=d}}(this,e);let l=(t<0?r:i)||r||i;return l?{tile:l,offset:l==r?o:s}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=tA(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new tU(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,16&e.flags?1:32&e.flags?-1:t);let o=n.tile.parent,i=!1;for(let e of o.children){if(i)return new tU(e.dom,0);e==n.tile&&(i=!0)}}return new tU(this.dom,0)}}class nB extends nD{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new nB(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class nW extends n_{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue==this.text||(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,o=e,i=0;0==e&&t<0||e==n&&t>=0?!(tf.chrome||tf.gecko)&&(e?(r--,i=1):o<n&&(o++,i=-1)):t<0?r--:o<n&&o++;let s=t$(this.dom,r,o).getClientRects();if(!s.length)return null;let l=s[(i?i<0:t>=0)?0:s.length-1];return tf.safari&&!i&&0==l.width&&(l=Array.prototype.find.call(s,e=>e.width)||l),i?tI(l,i<0):l||null}static of(e,t){let n=new nW(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class nF extends n_{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return tI(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let o=r?t.length-1:0;n=t[o],e>0?0!=o:o!=t.length-1&&!(n.top<n.bottom);o+=r?-1:1);return tI(n,!r)}}get overrideDOMText(){if(!this.length)return O.empty;let{root:e}=this;if(!e)return O.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,r,o){return o||(o=e.toDOM(t),e.editable||(o.contentEditable="false")),new nF(o,n,e,r)}}class n$ extends n_{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return O.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class nz{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:o,beforeBreak:i,parents:s}=this;for(;e||t>0;)if(r.isComposite()){if(i){if(!e)break;n&&n.break(),e--,i=!1}else if(o==r.children.length){if(!e&&!s.length)break;n&&n.leave(r),i=!!r.breakAfter,({tile:r,index:o}=s.pop()),o++}else{let l=r.children[o],a=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!n||!1!==n.skip(l,0,l.length)||!l.isComposite)?(i=!!a,o++,e-=l.length):(s.push({tile:r,index:o}),r=l,o=0,n&&l.isComposite()&&n.enter(l))}}else if(o==r.length)i=!!r.breakAfter,({tile:r,index:o}=s.pop()),o++;else if(e){let t=Math.min(e,r.length-o);n&&n.skip(r,o,o+t),e-=t,o+=t}else break;return this.tile=r,this.index=o,this.beforeBreak=i,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class nH{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}}class nq{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){var o;this.flushBuffer();let i=this.ensureMarks(t,n),s=i.lastChild;s&&s.isText()&&!(8&s.flags)?(this.cache.reused.set(s,2),(i.children[i.children.length-1]=new nW(s.dom,s.text+e)).parent=i):i.append(r||nW.of(e,null===(o=this.cache.find(nW))||void 0===o?void 0:o.dom)),this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?nY(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],o=r.lastChild;if(o instanceof nB&&o.mark.eq(n.mark))o.dom!=n.dom&&o.setDOM(nY(n.dom)),r=o;else{if(this.cache.reused.get(n)){let e=n_.get(n.dom);e&&e.setDOM(nY(n.dom))}let e=nB.of(n.mark,n.dom);r.append(e),r=e}this.cache.reused.set(n,2)}let o=n_.get(e.text);o&&this.cache.reused.set(o,2);let i=new nW(e.text,e.text.nodeValue);i.flags|=8,r.append(i)}addInlineWidget(e,t,n){let r=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);r||this.flushBuffer();let o=this.ensureMarks(t,n);r||16&e.flags||o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=nK);let r=nj.start(e,t||(null===(n=this.cache.find(nj))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let o=e.length-1;o>=0;o--){let i=e[o],s;if(t>0&&(s=r.lastChild)&&s instanceof nB&&s.mark.eq(i))r=s,t--;else{let e=nB.of(i,null===(n=this.cache.find(nB,e=>e.mark.eq(i)))||void 0===n?void 0:n.dom);r.append(e),r=e,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!nQ(this.curLine,!1)||"BR"!=e.dom.nodeName&&e.isWidget()&&!(tf.ios&&nQ(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(nZ,0,32)||new nF(nZ.toDOM(),0,nZ,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new nH(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&0>(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to);)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.from<this.pos&&r instanceof nI&&r.wrapper.eq(n.wrapper))t=r;else{let r=nI.of(n.wrapper,null===(e=this.cache.find(nI,e=>e.wrapper.eq(n.wrapper)))||void 0===e?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(n$,void 0,1);return n&&(n.flags=t),n||new n$(t)}flushBuffer(){this.afterWidget&&!(32&this.afterWidget.flags)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class nV{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error("Ran out of text content when drawing inline views");this.text=t;let o=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,o)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}let nU=[nF,nj,nW,nB,n$,nI,nL];for(let e=0;e<nU.length;e++)nU[e].bucket=e;class nG{constructor(e){this.view=e,this.buckets=nU.map(()=>[]),this.index=nU.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,o=this.buckets[r],i=this.index[r];for(let e=o.length-1;e>=0;e--){let s=(e+i)%o.length,l=o[s];if((!t||t(l))&&!this.reused.has(l))return o.splice(s,1),s<i&&this.index[r]--,this.reused.set(l,n),l}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let o=0,i=0;;o++){if(o==r.length){if(i)return null;i=1,o=0}let s=r[o];if(!this.reused.has(s)&&(0==i?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view))){if(r.splice(o,1),o<this.index[0]&&this.index[0]--,s.widget==e&&s.length==t&&(497&s.flags)==n)return this.reused.set(s,1),s;return this.reused.set(s,2),new nF(s.dom,t,e,-498&s.flags|n)}}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class nX{constructor(e,t,n,r,o){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new nG(e),this.text=new nV(e.state.doc),this.builder=new nq(this.cache,new nL(e,e.contentDOM),eW.iter(n)),this.cache.reused.set(t,2),this.old=new nz(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,o=0,i=0;;){let s=i<e.length?e[i++]:null,l=s?s.fromA:this.old.root.length;if(l>r){let e=l-r;this.preserve(e,!i,!s),r=l,o+=e}if(!s)break;t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(o,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB)):(this.forward(s.fromA,s.toA),this.emit(o,s.toB)),o=s.toB,r=s.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof nB&&t.push(r.mark)}return t}(this.old),o=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let i=n>0||t<e.length?nF.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&i.flags?(i.flags&=-2,this.builder.addBlockWidget(i)):(this.builder.ensureLine(null),this.builder.addInlineWidget(i,r,o),o=r.length)}}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,o)):this.builder.addText(e.text,r,o,this.cache.reuse(e)),o=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof n$)this.cache.add(e);else{if(!(e instanceof nB))return!1;this.builder.ensureLine(null),this.builder.addMark(e,r,o),this.cache.reused.set(e,1),o=r.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof nB&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&(r.length=o=0):e instanceof nB&&(r.shift(),o=Math.min(o,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,o=0,i=eW.spans(this.decorations,e,t,{point:(e,t,i,s,l,a)=>{var c;if(i instanceof tS){if(this.disallowBlockEffectsFor[a]){if(i.block)throw RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=s.length,l>s.length)r.continueWidget(t-e);else{let o;let a=i.widget||(i.block?nJ.block:nJ.inline),c=(o=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0):i.startSide>0?32:16,i.block&&(o|=256),o),u=this.cache.findWidget(a,t-e,c)||nF.of(a,this.view,t-e,c);i.block?(i.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(u)):(r.ensureLine(n),r.addInlineWidget(u,s,l))}n=null}else{let e,t;c=n,e=i.spec.attributes,t=i.spec.class,(e||t)&&(c||(c={class:"cm-line"}),e&&tp(e,c),t&&(c.class+=" "+t)),n=c}t>e&&this.text.skip(t-e)},span:(e,t,o,i)=>{for(let s=e;s<t;){let e=this.text.next(Math.min(512,t-s));null==e?(r.addLineStartIfNotCovered(n),r.addBreak(),s++):(r.ensureLine(n),r.addText(e,o,i),s+=e.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=i>o,this.openMarks=i}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=n_.get(r);if(r==this.view.contentDOM)break;e instanceof nB?t.push(e):(null==e?void 0:e.isLine())?n=e:"DIV"!=r.nodeName||n||r==this.view.contentDOM?t.push(nB.of(new tx({tagName:r.nodeName.toLowerCase(),attributes:function(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}(r)}),r)):n=new nj(r,nK)}return{line:n,marks:t}}}function nQ(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}let nK={class:"cm-line"};function nY(e){let t=n_.get(e);return t&&t.setDOM(e.cloneNode()),e}class nJ extends tb{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}nJ.inline=new nJ("span"),nJ.block=new nJ("div");let nZ=new class extends tb{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class n0{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=tw.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new nL(e,e.contentDOM),this.updateInner([new nM(0,0,0,e.state.doc.length)],null)}update(e){var t,n,r,o,i,s,l;let a,c,u;let h=e.changedRanges;this.minWidth>0&&h.length&&(h.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let d=-1;!(this.view.inputState.composing>=0)||this.view.observer.editContext||((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?d=this.domChanged.newSel.head:(n=e.changes,r=this.hasComposition,a=!1,r&&n.iterChangedRanges((e,t)=>{e<r.to&&t>r.from&&(a=!0)}),a||e.selectionSet||(d=e.state.selection.main.head)));let f=d>-1?function(e,t,n){let r=n2(e,n);if(!r)return null;let{node:o,from:i,to:s}=r,l=o.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(r.from,r.to)!=l)return null;let a=t.invertedDesc;return{range:new nM(a.mapPos(i),a.mapPos(s),i,s),text:o}}(this.view,e.changes,d):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:n}=this.hasComposition;h=new nM(t,n,e.changes.mapPos(t,-1),e.changes.mapPos(n,1)).addToSet(h.slice())}this.hasComposition=f?{from:f.range.fromB,to:f.range.toB}:null,(tf.ie||tf.chrome)&&!f&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let p=this.decorations,m=this.blockWrappers;this.updateDeco();let g=(o=this.decorations,i=e.changes,c=new n4,eW.compare(p,o,i,c),c.changes);g.length&&(h=nM.extendWithRanges(h,g));let v=(s=this.blockWrappers,l=e.changes,u=new n5,eW.compare(m,s,l,u),u.changes);return v.length&&(h=nM.extendWithRanges(h,v)),f&&!h.some(e=>e.fromA<=f.range.fromA&&e.toA>=f.range.toA)&&(h=f.range.addToSet(h.slice())),(!(2&this.tile.flags)||0!=h.length)&&(this.updateInner(h,f),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new nX(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=r.run(e,t),n1(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=tf.chrome||tf.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof n3&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){for(let t of(this.editContextFormatting=this.editContextFormatting.map(e.changes),e.transactions))for(let e of t.effects)e.is(nh)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){var n;(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,o=this.view.root.activeElement,i=o==r,s=!i&&!(this.view.state.facet(nf)||r.tabIndex>-1)&&tM(r,this.view.observer.selectionRange)&&!(o&&r.contains(o));if(!(i||t||s))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,c,u;if(a.empty?u=c=this.inlineDOMNearPos(a.anchor,a.assoc||1):(u=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),c=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),tf.gecko&&a.empty&&!this.hasComposition&&1==(n=c).node.nodeType&&n.node.firstChild&&(0==n.offset||"false"==n.node.childNodes[n.offset-1].contentEditable)&&(n.offset==n.node.childNodes.length||"false"==n.node.childNodes[n.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=u=new tU(e,0),l=!0}let h=this.view.observer.selectionRange;!l&&h.focusNode&&(tR(c.node,c.offset,h.anchorNode,h.anchorOffset)&&tR(u.node,u.offset,h.focusNode,h.focusOffset)||this.suppressWidgetCursorChange(h,a))||(this.view.observer.ignore(()=>{tf.android&&tf.chrome&&r.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let e=tP(this.view.root);if(e){if(a.empty){if(tf.gecko){var t,n;let e=(t=c.node,n=c.offset,1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable?2:0));if(e&&3!=e){let t=(1==e?tq:tV)(c.node,c.offset);t&&(c=new tU(t.node,t.offset))}}e.collapse(c.node,c.offset),null!=a.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=a.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(u.node,u.offset)}catch(e){}}else{let t=document.createRange();a.anchor>a.head&&([c,u]=[u,c]),t.setEnd(u.node,u.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}s&&this.view.root.activeElement==r&&(r.blur(),o&&o.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new tU(h.anchorNode,h.anchorOffset),this.impreciseHead=u.precise?null:new tU(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&tR(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=tP(e.root),{anchorNode:r,anchorOffset:o}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let i=this.lineAt(t.head,t.assoc);if(!i)return;let s=i.posAtStart;if(t.head==s||t.head==s+i.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,o)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let o;if(e==n.dom)o=n.dom.childNodes[t];else{let r=0==tL(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}o=r<0?e:e.nextSibling}if(o==n.dom.firstChild)return r;for(;o&&!n_.get(o);)o=o.nextSibling;if(!o)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==o)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,o=!1,i,s=-1,l=!1;return(this.tile.blockTiles((t,a)=>{if(t.isWidget()){if(32&t.flags&&a>=e)return!0;16&t.flags&&(o=!0)}else{let c=a+t.length;if(a<=e&&(n=t,r=e-a,o=c<e),c>=e&&!i&&(i=t,s=e-a,l=a>e),a>e&&i)return!0}}),n||i)?(o&&i?n=null:l&&n&&(i=null),n&&t<0||!i?n.domIn(r,t):i.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof n3?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,n){if(t.isComposite())for(let r of t.children){if(r.length>=n){let t=e(r,n);if(t)return t}if((n-=r.length)<0)break}else if(t.isText()&&n<t.length){let e=N(t.text,n);if(e==n)return null;let r=t$(t.dom,n,e).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n):null}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,o=this.view.contentDOM.clientWidth,i=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,l=this.view.textDirection==tG.LTR,a=0,c=(e,u,h)=>{for(let d=0;d<e.children.length&&!(u>r);d++){let r=e.children[d],f=u+r.length,p=r.dom.getBoundingClientRect(),{height:m}=p;if(h&&!d&&(a+=p.top-h.top),r instanceof nI)f>n&&c(r,u,p);else if(u>=n&&(a>0&&t.push(-a),t.push(m+a),a=0,i)){let e=r.dom.lastChild,t=e?tA(e):[];if(t.length){let e=t[t.length-1],n=l?e.right-p.left:p.right-e.left;n>s&&(s=n,this.minWidth=o,this.minWidthFrom=u,this.minWidthTo=f)}}h&&d==e.children.length-1&&(a+=h.bottom-p.bottom),u=f+r.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?tG.RTL:tG.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=tA(r.dom);if(1!=e.length)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement("div"),n,r,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=tA(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,o=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let o=r==t.viewports.length?null:t.viewports[r],i=o?o.from-1:this.view.state.doc.length;if(i>n){let r=(t.lineBlockAt(i).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(tw.replace({widget:new n3(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,i))}if(!o)break;n=o.to+1}return tw.set(e)}updateDeco(){let e=1,t=this.view.state.facet(nw).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(nk).map((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(eW.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(nx).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(na))try{if(t(this.view,e.range,e))return!0}catch(e){nd(this.view.state,e,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let o=nP(this.view),i={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:s,offsetHeight:l}=this.view.scrollDOM;!function(e,t,n,r,o,i,s,l){let a=e.ownerDocument,c=a.defaultView||window;for(let u=e,h=!1;u&&!h;)if(1==u.nodeType){let e,d=u==a.body,f=1,p=1;if(d)e=function(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:f,scaleY:p}=tj(u,t)),e={left:t.left,right:t.left+u.clientWidth*f,top:t.top,bottom:t.top+u.clientHeight*p}}let m=0,g=0;if("nearest"==o)t.top<e.top?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let r=t.bottom-t.top,i=e.bottom-e.top;g=("center"==o&&r<=i?t.top+r/2-i/2:"start"==o||"center"==o&&n<0?t.top-s:t.bottom-i+s)-e.top}if("nearest"==r?t.left<e.left?(m=t.left-(e.left+i),n>0&&t.right>e.right+m&&(m=t.right-e.right+i)):t.right>e.right&&(m=t.right-e.right+i,n<0&&t.left<e.left+m&&(m=t.left-(e.left+i))):m=("center"==r?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==r==l?t.left-i:t.right-(e.right-e.left)+i)-e.left,m||g){if(d)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=u.scrollTop;u.scrollTop+=g/p,n=(u.scrollTop-e)*p}if(m){let t=u.scrollLeft;u.scrollLeft+=m/f,e=(u.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&1>Math.abs(e-m)&&(r="nearest"),n&&1>Math.abs(n-g)&&(o="nearest")}}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(11==u.nodeType)u=u.host;else break}(this.view.scrollDOM,i,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==tG.LTR)}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){n1(this.tile)}}function n1(e,t){let n=null==t?void 0:t.get(e);if(1!=n)for(let r of(null==n&&e.destroy(),e.children))n1(r,t)}function n2(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=tq(n.focusNode,n.focusOffset),o=tV(n.focusNode,n.focusOffset),i=r||o;if(o&&r&&o.node!=r.node){let t=n_.get(o.node);if(!t||t.isText()&&t.text!=o.node.nodeValue)i=o;else if(e.docView.lastCompositionAfterCursor){let e=n_.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(i=o)}}if(e.docView.lastCompositionAfterCursor=i!=r,!i)return null;let s=t-i.offset;return{from:s,to:s+i.node.nodeValue.length,node:i.node}}let n4=class{constructor(){this.changes=[]}compareRange(e,t){tO(e,t,this.changes)}comparePoint(e,t){tO(e,t,this.changes)}boundChange(e){tO(e,e,this.changes)}};class n5{constructor(){this.changes=[]}compareRange(e,t){tO(e,t,this.changes)}comparePoint(){}boundChange(e){tO(e,e,this.changes)}}class n3 extends tb{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function n6(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let o of r.type){if(o.from>t)break;if(!(o.to<t)){if(o.from<t&&o.to>t)return o;(!e||o.type==ty.Text&&(e.type!=o.type||(n<0?o.from<t:o.to>t)))&&(e=o)}}return e||r}return r}function n9(e,t,n,r){let o=e.state.doc.lineAt(t.head),i=e.bidiSpans(o),s=e.textDirectionAt(o.from);for(let l=t,a=null;;){let t=function(e,t,n,r,o){var i;let s=r.head-e.from,l=t4.find(t,s,null!==(i=r.bidiLevel)&&void 0!==i?i:-1,r.assoc),a=t[l],c=a.side(o,n);if(s==c){let e=l+=o?1:-1;if(e<0||e>=t.length)return null;s=(a=t[l=e]).side(!o,n),c=a.side(o,n)}let u=N(e.text,s,a.forward(o,n));(u<a.from||u>a.to)&&(u=c),t6=e.text.slice(Math.min(s,u),Math.max(s,u));let h=l==(o?t.length-1:0)?null:t[l+(o?1:-1)];return h&&u==c&&h.level+(o?0:1)<a.level?Q.cursor(h.side(!o,n)+e.from,h.forward(o,n)?1:-1,h.level):Q.cursor(u+e.from,a.forward(o,n)?-1:1,a.level)}(o,i,s,l,n),c=t6;if(!t){if(o.number==(n?e.state.doc.lines:1))return l;c="\n",o=e.state.doc.line(o.number+(n?1:-1)),i=e.bidiSpans(o),t=e.visualLineSide(o,!n)}if(a){if(!a(c))return l}else{if(!r)return t;a=r(c)}l=t}}function n8(e,t,n){for(;;){let r=0;for(let o of e)o.between(t-1,t+1,(e,o,i)=>{if(t>e&&t<o){let i=r||n||(t-e<o-t?-1:1);t=i<0?e:o,r=i}});if(!r)return t}}function n7(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let o=t.ranges[r],i=null;if(o.empty){let t=n8(e,o.from,0);t!=o.from&&(i=Q.cursor(t,-1))}else{let t=n8(e,o.from,-1),n=n8(e,o.to,1);(t!=o.from||n!=o.to)&&(i=Q.range(o.from==o.anchor?t:n,o.from==o.head?t:n))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?Q.create(n,t.mainIndex):t}function re(e,t,n){let r=n8(e.state.facet(nS).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Q.cursor(r,r<n.from?1:-1)}class rt{constructor(e,t){this.pos=e,this.assoc=t}}function rn(e,t,n,r){let o=e.contentDOM.getBoundingClientRect(),i=o.top+e.viewState.paddingTop,{x:s,y:l}=t,a=l-i,c;for(;;){if(a<0)return new rt(0,1);if(a>e.viewState.docHeight)return new rt(e.state.doc.length,-1);if(c=e.elementAtHeight(a),null==r)break;if(c.type==ty.Text){let t=e.docView.coordsAt(r<0?c.from:c.to,r);if(t&&(r<0?t.top<=a+i:t.bottom>=a+i))break}let t=e.viewState.heightOracle.textHeight/2;a=r>0?c.bottom+t:c.top-t}if(e.viewport.from>=c.to||e.viewport.to<=c.from){if(n)return null;if(c.type==ty.Text){let t=function(e,t,n,r,o){let i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;i+=Math.floor((o-n.top-(e.defaultLineHeight-t)*.5)/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+eJ(s,i,e.state.tabSize)}(e,o,c,s,l);return new rt(t,t==c.from?1:-1)}}if(c.type!=ty.Text)return a<(c.top+c.bottom)/2?new rt(c.from,1):new rt(c.to,-1);let u=e.docView.lineAt(c.from,2);return u&&u.length==c.length||(u=e.docView.lineAt(c.from,-2)),function e(t,n,r,o,i){let s=-1,l=null,a=1e9,c=1e9,u=i,h=i,d=(e,t)=>{for(let n=0;n<e.length;n++){let r=e[n];if(r.top==r.bottom)continue;let d=r.left>o?r.left-o:r.right<o?o-r.right:0,f=r.top>i?r.top-i:r.bottom<i?i-r.bottom:0;r.top<=h&&r.bottom>=u&&(u=Math.min(r.top,u),h=Math.max(r.bottom,h),f=0),(s<0||0>(f-c||d-a))&&(s>=0&&c&&a<d&&l.top<=h-2&&l.bottom>=u+2?c=0:(s=t,a=d,c=f,l=r))}};if(n.isText()){for(let e=0;e<n.length;){let t=N(n.text,e);if(d(t$(n.dom,e,t).getClientRects(),e),!a&&!c)break;e=t}return o>(l.left+l.right)/2==(rr(t,s+r)==tG.LTR)?new rt(r+N(n.text,s),-1):new rt(r+s,1)}{if(!n.length)return new rt(r,1);for(let e=0;e<n.children.length;e++){let t=n.children[e];if(!(48&t.flags)&&(d((1==t.dom.nodeType?t.dom:t$(t.dom,0,t.length)).getClientRects(),e),!a&&!c))break}let u=n.children[s],h=n.posBefore(u,r);return u.isComposite()||u.isText()?e(t,u,h,Math.max(l.left,Math.min(l.right,o)),i):o>(l.left+l.right)/2==(rr(t,s+r)==tG.LTR)?new rt(h+u.length,-1):new rt(h,1)}}(e,u,c.from,s,l)}function rr(e,t){let n=e.state.doc.lineAt(t);return e.bidiSpans(n)[t4.find(e.bidiSpans(n),t-n.from,-1,1)].dir}class ro{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(e_.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=""}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let o=n_.get(r),i=r.nextSibling;if(i==t){(null==o?void 0:o.breakAfter)&&!i&&n!=this.view.contentDOM&&this.lineBreak();break}let s=n_.get(i);(o&&s?o.breakAfter:(o?o.breakAfter:tD(r))||tD(i)&&("BR"!=r.nodeName||(null==o?void 0:o.isWidget()))&&this.text.length>e)&&!function(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=n_.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}(i,t)&&this.lineBreak(),r=i}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,i=1,s;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),i=this.lineSeparator.length):(s=r.exec(t))&&(o=s.index,i=s[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),i>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=i-1);n=o+i}}readNode(e){let t=n_.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(!function(e,t,n){for(;;){if(!t||n<tL(t))return!1;if(t==e)return!0;n=t_(t)+1,t=t.parentNode}}(e,n.node,n.offset)?0:t))}}class ri{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class rs{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:i}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=function e(t,n,r,o){if(t.isComposite()){let i=-1,s=-1,l=-1,a=-1;for(let c=0,u=o,h=o;c<t.children.length;c++){let o=t.children[c],d=u+o.length;if(u<n&&d>r)return e(o,n,r,u);if(d>=n&&-1==i&&(i=c,s=u),u>r&&o.dom.parentNode==t.dom){l=c,a=h;break}h=d,u=d+o.breakAfter}return{from:s,to:a<0?o+t.length:a,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:l<t.children.length&&l>=0?t.children[l].dom:null}}return t.isText()?{from:o,to:o+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}(e.docView.tile,t,n,0))){let t=o||i?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new ri(n,r)),(o!=n||i!=r)&&t.push(new ri(o,i))),t}(e),n=new ro(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?Q.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=o&&o.node==t.focusNode&&o.offset==t.focusOffset||!tT(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=i&&i.node==t.anchorNode&&i.offset==t.anchorOffset||!tT(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((tf.ios||tf.chrome)&&e.state.selection.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),o=Math.max(n,r),i=s.from-t,l=s.to-o;(0==i||1==i||0==t)&&(0==l||-1==l||o==e.state.doc.length)&&(n=0,r=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Q.range(r,n)):this.newSel=Q.single(r,n)}}}function rl(e,t){let n;let{newSel:r}=t,o=e.state.selection.main,i=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:r,to:s}=t.bounds,l=o.from,a=null;(8===i||tf.android&&t.text.length<s-r)&&(l=o.to,a="end");let c=rc(e.state.doc.sliceString(r,s,""),t.text,l-r,a);c&&(tf.chrome&&13==i&&c.toB==c.from+2&&""==t.text.slice(c.from,c.toB)&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:O.of(t.text.slice(c.from,c.toB).split(""))})}else r&&(!e.hasFocus&&e.state.facet(nf)||ru(r,o))&&(r=null);if(!n&&!r)return!1;if(!n&&t.typeOver&&!o.empty&&r&&r.main.empty?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:(tf.mac||tf.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=Q.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:O.of([n.insert.toString().replace("."," ")])}):n&&n.from>=o.from&&n.to<=o.to&&(n.from!=o.from||n.to!=o.to)&&o.to-o.from-(n.to-n.from)<=4?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,o.to))}:e.state.doc.lineAt(o.from).to<o.to&&e.docView.lineHasWidget(o.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:o.from,to:o.to,insert:e.state.toText(e.inputState.insertingText)}:tf.chrome&&n&&n.from==n.to&&n.from==o.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=Q.single(r.main.anchor-1,r.main.head-1)),n={from:o.from,to:o.to,insert:O.of([" "])}),n)return ra(e,n,r,i);if(!r||ru(r,o))return!1;{let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),"select.pointer"==(n=e.inputState.lastSelectionOrigin)&&(r=n7(e.state.facet(nS).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}}function ra(e,t,n,r=-1){let o;if(tf.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(tf.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&" "==e.state.sliceDoc(t.from,i.from))&&1==t.insert.length&&2==t.insert.lines&&tz(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>i.head)&&tz(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&0==t.insert.length&&tz(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>o||(o=function(e,t,n){let r,o=e.state,i=o.selection.main,s=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let n=t.from<i.from?-1:1,r=n<0?i.from:i.to,l=n8(o.facet(nS).map(t=>t(e)),r,n);t.from==l&&(s=l)}if(s>-1)r={changes:t,selection:Q.cursor(t.from+t.insert.length,-1)};else if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=i.from<t.from?o.sliceDoc(i.from,t.from):"",s=i.to>t.to?o.sliceDoc(t.to,i.to):"";r=o.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=o.changes(t),l=n&&n.main.to<=s.newLength?n.main:void 0;if(o.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let a=e.state.sliceDoc(t.from,t.to),c,u=n&&n2(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);c={from:u.from,to:u.to-e}}else c=e.state.doc.lineAt(i.head);let h=i.to-t.to;r=o.changeByRange(n=>{if(n.from==i.from&&n.to==i.to)return{changes:s,range:l||n.map(s)};let r=n.to-h,u=r-a.length;if(e.state.sliceDoc(u,r)!=a||r>=c.from&&u<=c.to)return{range:n};let d=o.changes({from:u,to:r,insert:t.insert}),f=n.to-i.to;return{changes:d,range:l?Q.range(Math.max(0,l.anchor+f),Math.max(0,l.head+f)):n.map(d)}})}else r={changes:s,selection:l&&o.selection.replaceRange(l)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),o.update(r,{userEvent:l,scrollIntoView:!0})}(e,t,n));return e.state.facet(nn).some(n=>n(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function rc(e,t,n,r){let o=Math.min(e.length,t.length),i=0;for(;i<o&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==o&&e.length==t.length)return null;let s=e.length,l=t.length;for(;s>0&&l>0&&e.charCodeAt(s-1)==t.charCodeAt(l-1);)s--,l--;if("end"==r){let e=Math.max(0,i-Math.min(s,l));n-=s+e-i}if(s<i&&e.length<t.length){let e=n<=i&&n>=s?i-n:0;i-=e,l=i+(l-s),s=i}else if(l<i){let e=n<=i&&n>=l?i-n:0;i-=e,s=i+(s-l),l=i}return{from:i,toA:s,toB:l}}function ru(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class rh{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){var t;this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,tf.safari&&e.contentDOM.addEventListener("input",()=>null),tf.gecko&&(t=e.contentDOM.ownerDocument,rN.has(t)||(rN.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{})))}handleEvent(e){!(!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(r=n_.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}(this.view,e)||this.ignoreDuringComposition(e))&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,o=e&&e.plugin.domEventObservers;if(r)for(let e in r){let o=r[e];o&&n(e).handlers.push(rd(t.value,o))}if(o)for(let e in o){let r=o[e];r&&n(e).observers.push(rd(t.value,r))}}for(let e in rb)n(e).handlers.push(rb[e]);for(let e in ry)n(e).observers.push(ry[e]);return t}(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let o=!t[e].handlers.length,i=n[e];i&&!i.handlers.length!=o&&(r.removeEventListener(e,this.handleEvent),i=null),i||r.addEventListener(e,this.handleEvent,{passive:o})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){let t;return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),!!(9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))||((this.tabFocusMode>0&&27!=e.keyCode&&0>rm.indexOf(e.keyCode)&&(this.tabFocusMode=-1),tf.android&&tf.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))?(this.view.observer.delayAndroidKey(e.key,e.keyCode),!0):tf.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=rf.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||rp.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(229!=e.keyCode&&this.view.observer.forceFlush(),!1))}flushIOSKey(e){let t=this.pendingIOSKey;return!(!t||"Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,tz(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&!e.synthetic&&(this.composing>0||!!(tf.safari&&!tf.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function rd(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){nd(n.state,e)}}}let rf=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],rp="dthko",rm=[16,17,18,20,91,92,224,225];function rg(e){return .7*Math.max(0,e)+8}class rv{constructor(e,t,n,r){let o;this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t=e.ownerDocument,n,r;for(let o=e.parentNode;o&&o!=t.body&&(!n||!r);)if(1==o.nodeType)!r&&o.scrollHeight>o.clientHeight&&(r=o),!n&&o.scrollWidth>o.clientWidth&&(n=o),o=o.assignedSlot||o.parentNode;else if(11==o.nodeType)o=o.host;else break;return{x:n,y:r}}(e.contentDOM),this.atoms=e.state.facet(nS).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(e_.allowMultipleSelections)&&((o=e.state.facet(t9)).length?o[0](t):tf.mac?t.metaKey:t.ctrlKey),this.dragging=!!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=tP(e.root);if(!r||0==r.rangeCount)return!0;let o=r.getRangeAt(0).getClientRects();for(let e=0;e<o.length;e++){let n=o[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)&&1==rT(t)&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&10>Math.max(Math.abs((t=this.startEvent).clientX-e.clientX),Math.abs(t.clientY-e.clientY)))return;this.select(this.lastEvent=e);let n=0,r=0,o=0,i=0,s=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=nP(this.view);e.clientX-a.left<=o+6?n=-rg(o-e.clientX):e.clientX+a.right>=s-6&&(n=rg(e.clientX-s)),e.clientY-a.top<=i+6?r=-rg(i-e.clientY):e.clientY+a.bottom>=l-6&&(r=rg(e.clientY-l)),this.setScrollSpeed(n,r)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=n7(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,!1===this.dragging))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}let rb=Object.create(null),ry=Object.create(null),rw=tf.ie&&tf.ie_version<15||tf.ios&&tf.webkit_version<604;function rx(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function rk(e,t){t=rx(e.state,no,t);let{state:n}=e,r,o=1,i=n.toText(t),s=i.lines==n.selection.ranges.length;if(null!=rA&&n.selection.ranges.every(e=>e.empty)&&rA==i.toString()){let e=-1;r=n.changeByRange(r=>{let l=n.doc.lineAt(r.from);if(l.from==e)return{range:r};e=l.from;let a=n.toText((s?i.line(o++).text:t)+n.lineBreak);return{changes:{from:l.from,insert:a},range:Q.cursor(r.from+a.length)}})}else r=s?n.changeByRange(e=>{let t=i.line(o++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Q.cursor(e.from+t.length)}}):n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}function rS(e,t,n,r){if(1==r)return Q.cursor(t,n);if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),o=e.doc.lineAt(t),i=t-o.from;if(0==o.length)return Q.cursor(t);0==i?n=1:i==o.length&&(n=-1);let s=i,l=i;n<0?s=N(o.text,i,!1):l=N(o.text,i);let a=r(o.text.slice(s,l));for(;s>0;){let e=N(o.text,s,!1);if(r(o.text.slice(e,s))!=a)break;s=e}for(;l<o.length;){let e=N(o.text,l);if(r(o.text.slice(l,e))!=a)break;l=e}return Q.range(s+o.from,l+o.from)}(e.state,t,n);{let r=e.docView.lineAt(t,n),o=e.state.doc.lineAt(r?r.posAtEnd:t),i=r?r.posAtStart:o.from,s=r?r.posAtEnd:o.to;return s<e.state.doc.length&&s==o.to&&s++,Q.range(i,s)}}ry.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},rb.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ry.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},ry.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},rb.mousedown=(e,t)=>{let n,r,o;if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of e.state.facet(t7))if(i=n(e,t))break;if(i||0!=t.button||(n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=rT(t),o=e.state.selection,i={update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),o=o.map(e.changes))},get(t,i,s){let l=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),a,c=rS(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!i){let t=rS(e,n.pos,n.assoc,r),o=Math.min(t.from,c.from),i=Math.max(t.to,c.to);c=o<c.from?Q.range(o,i):Q.range(i,o)}return i?o.replaceRange(o.main.extend(c.from,c.to)):s&&1==r&&o.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:o}=e.ranges[n];if(r<=t&&o>=t)return Q.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(o,l.pos))?a:s?o.addRange(c):Q.create([c])}}),i){let n=!e.hasFocus;e.inputState.startMouseSelection(new rv(e,t,i,n)),n&&e.observer.ignore(()=>{tF(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};let rC=tf.ie&&tf.ie_version<=11,rO=null,rE=0,rP=0;function rT(e){if(!rC)return e.detail;let t=rO,n=rP;return rO=e,rP=Date.now(),rE=!t||n>Date.now()-400&&2>Math.abs(t.clientX-e.clientX)&&2>Math.abs(t.clientY-e.clientY)?(rE+1)%3:1}function rM(e,t,n,r){let o;if(!(n=rx(e.state,no,n)))return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,l=r&&s&&((o=e.state.facet(t8)).length?o[0](t):tf.mac?!t.altKey:!t.ctrlKey)?{from:s.from,to:s.to}:null,a={from:i,insert:n},c=e.state.changes(l?[l,a]:a);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:l?"move.drop":"input.drop"}),e.inputState.draggedContent=null}rb.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=Q.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",rx(e.state,ni,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},rb.dragend=e=>(e.inputState.draggedContent=null,!1),rb.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),o=0,i=()=>{++o==n.length&&rM(e,t,r.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=i,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),i()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return rM(e,t,n,!0),!0}return!1},rb.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=rw?null:t.clipboardData;return n?(rk(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),rk(e,n.value)},50)}(e),!1)};let rA=null;rb.copy=rb.cut=(e,t)=>{let n=tP(e.root);if(n&&!tM(e.contentDOM,n))return!1;let{text:r,ranges:o,linewise:i}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let o=-1;for(let{from:r}of e.selection.ranges){let i=e.doc.lineAt(r);i.number>o&&(t.push(i.text),n.push({from:i.from,to:Math.min(e.doc.length,i.to+1)})),o=i.number}r=!0}return{text:rx(e,ni,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!r&&!i)return!1;rA=i?r:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:o,scrollIntoView:!0,userEvent:"delete.cut"});let s=rw?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",r),!0):(!function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}(e,r),!1)};let rR=ex.define();function r_(e,t){let n=[];for(let r of e.facet(nr)){let o=r(e,t);o&&n.push(o)}return n.length?e.update({effects:n,annotations:rR.of(!0)}):null}function rD(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=r_(e.state,t);n?e.dispatch(n):e.update([])}},10)}ry.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),rD(e)},ry.blur=e=>{e.observer.clearSelectionRange(),rD(e)},ry.compositionstart=ry.compositionupdate=e=>{!e.observer.editContext&&(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},ry.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,tf.chrome&&tf.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ry.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},rb.beforeinput=(e,t)=>{var n,r;let o;if(("insertText"==t.inputType||"insertCompositionText"==t.inputType)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let r=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(r&&o.length){let t=o[0],n=e.posAtDOM(t.startContainer,t.startOffset),i=e.posAtDOM(t.endContainer,t.endOffset);return ra(e,{from:n,to:i,insert:e.state.toText(r)},null),!0}}if(tf.chrome&&tf.android&&(o=rf.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(o.key,o.keyCode),"Backspace"==o.key||"Delete"==o.key)){let t=(null===(r=window.visualViewport)||void 0===r?void 0:r.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return tf.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),tf.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>ry.compositionend(e,t),20),!1};let rN=new Set,rL=["pre-wrap","normal","pre-line","break-spaces"],rI=!1;class rj{constructor(e){this.lineWrapping=e,this.doc=O.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return rL.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(10*r)]||(t=!0,this.heightSamples[Math.floor(10*r)]=!0)}return t}refresh(e,t,n,r,o,i){let s=rL.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=s||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=o,l){this.heightSamples={};for(let e=0;e<i.length;e++){let t=i[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return l}}class rB{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class rW{constructor(e,t,n,r,o){this.from=e,this.length=t,this.top=n,this.height=r,this._content=o}get type(){return"number"==typeof this._content?ty.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof tS?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new rW(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var rF=((c=rF||(rF={}))[c.ByPos=0]="ByPos",c[c.ByHeight=1]="ByHeight",c[c.ByPosNoHeight=2]="ByPosNoHeight",c);class r${constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>.001&&(rI=!0),this.height=e)}replace(e,t,n){return r$.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let o=this,i=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:l,toA:a,fromB:c,toB:u}=r[s],h=o.lineAt(l,rF.ByPosNoHeight,n.setDoc(t),0,0),d=h.to>=a?h:o.lineAt(a,rF.ByPosNoHeight,n,0,0);for(u+=d.to-a,a=d.to;s>0&&h.from<=r[s-1].toA;)l=r[s-1].fromA,c=r[s-1].fromB,s--,l<h.from&&(h=o.lineAt(l,rF.ByPosNoHeight,n,0,0));c+=h.from-l,l=h.from;let f=rQ.build(n.setDoc(i),e,c,u);o=rz(o,o.replace(l,a,f))}return o.updateHeight(n,0)}static empty(){return new rV(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,r=0,o=0;for(;;)if(t==n){if(r>2*o){let o=e[t-1];o.break?e.splice(--t,1,o.left,null,o.right):e.splice(--t,1,o.left,o.right),n+=1+o.break,r-=o.size}else if(o>2*r){let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,o-=t.size}else break}else if(r<o){let n=e[t++];n&&(r+=n.size)}else{let t=e[--n];t&&(o+=t.size)}let i=0;return null==e[t-1]?(i=1,t--):null==e[t]&&(i=1,n++),new rG(r$.of(e.slice(0,t)),i,r$.of(e.slice(n)))}}function rz(e,t){return e==t?e:(e.constructor!=t.constructor&&(rI=!0),t)}r$.prototype.size=1;let rH=tw.replace({});class rq extends r${constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new rW(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new rW(r,0,n,this.spaceAbove,rH):this.mainBlock(n,r)}lineAt(e,t,n,r,o){let i=this.mainBlock(r,o);return this.spaceAbove?this.blockAt(0,n,r,o).join(i):i}forEachLine(e,t,n,r,o,i){e<=o+this.length&&t>=o&&i(this.lineAt(0,rF.ByPos,n,r,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class rV extends rq{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new rW(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof rV||r instanceof rU&&4&r.flags)&&10>Math.abs(this.length-r.length)?(r instanceof rU?r=new rV(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):r$.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class rU extends r${constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,o=r-n+1,i,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);i=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else i=this.height/o;return{firstLine:n,lastLine:r,perLine:i,perChar:s}}blockAt(e,t,n,r){let{firstLine:o,lastLine:i,perLine:s,perChar:l}=this.heightMetrics(t,r);if(t.lineWrapping){let o=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),i=t.doc.lineAt(o),a=s+i.length*l;return new rW(i.from,i.length,Math.max(n,e-a/2),a,0)}{let r=Math.max(0,Math.min(i-o,Math.floor((e-n)/s))),{from:l,length:a}=t.doc.line(o+r);return new rW(l,a,n+s*r,s,0)}}lineAt(e,t,n,r,o){if(t==rF.ByHeight)return this.blockAt(e,n,r,o);if(t==rF.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new rW(t,r-t,0,0,0)}let{firstLine:i,perLine:s,perChar:l}=this.heightMetrics(n,o),a=n.doc.lineAt(e),c=s+a.length*l,u=a.number-i,h=r+s*u+l*(a.from-o-u);return new rW(a.from,a.length,Math.max(r,Math.min(h,r+this.height-c)),c,0)}forEachLine(e,t,n,r,o,i){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:s,perLine:l,perChar:a}=this.heightMetrics(n,o);for(let c=e,u=r;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;u+=l*n+a*(e-o-n)}let r=l+a*t.length;i(new rW(t.from,t.length,u,r,0)),u+=r,c=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof rU?n[n.length-1]=new rU(e.length+r):n.push(null,new rU(r-1))}if(e>0){let t=n[0];t instanceof rU?n[0]=new rU(e+t.length):n.unshift(new rU(e-1),null)}return r$.of(n)}decomposeLeft(e,t){t.push(new rU(e-1),null)}decomposeRight(e,t){t.push(null,new rU(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let o=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],i=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new rU(r.from-t-1).updateHeight(e,t));i<=o&&r.more;){let t=e.doc.lineAt(i).length;n.length&&n.push(null);let o=r.heights[r.index++],l=0;o<0&&(l=-o,o=r.heights[r.index++]),-1==s?s=o:Math.abs(o-s)>=.001&&(s=-2);let a=new rV(t,o,l);a.outdated=!1,n.push(a),i+=t+1}i<=o&&n.push(null,new rU(o-i).updateHeight(e,i));let l=r$.of(n);return(s<0||Math.abs(l.height-this.height)>=.001||Math.abs(s-this.heightMetrics(e,t).perLine)>=.001)&&(rI=!0),rz(this,l)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class rG extends r${constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,o,r+this.left.length+this.break)}lineAt(e,t,n,r,o){let i=r+this.left.height,s=o+this.left.length+this.break,l=t==rF.ByHeight?e<i:e<s,a=l?this.left.lineAt(e,t,n,r,o):this.right.lineAt(e,t,n,i,s);if(this.break||(l?a.to<s:a.from>s))return a;let c=t==rF.ByPosNoHeight?rF.ByPosNoHeight:rF.ByPos;return l?a.join(this.right.lineAt(s,c,n,i,s)):this.left.lineAt(s,c,n,r,o).join(a)}forEachLine(e,t,n,r,o,i){let s=r+this.left.height,l=o+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,r,o,i),t>=l&&this.right.forEachLine(e,t,n,s,l,i);else{let a=this.lineAt(l,rF.ByPos,n,r,o);e<a.from&&this.left.forEachLine(e,a.from-1,n,r,o,i),a.to>=e&&a.from<=t&&i(a),t>a.to&&this.right.forEachLine(a.to+1,t,n,s,l,i)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let o=[];e>0&&this.decomposeLeft(e,o);let i=o.length;for(let e of n)o.push(e);if(e>0&&rX(o,i-1),t<this.length){let e=o.length;this.decomposeRight(t,o),rX(o,e)}return r$.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&e>=++n&&t.push(null),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?r$.of(this.break?[e,null,t]:[e,t]):(this.left=rz(this.left,e),this.right=rz(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:o,right:i}=this,s=t+o.length+this.break,l=null;return(r&&r.from<=t+o.length&&r.more?l=o=o.updateHeight(e,t,n,r):o.updateHeight(e,t,n),r&&r.from<=s+i.length&&r.more?l=i=i.updateHeight(e,s,n,r):i.updateHeight(e,s,n),l)?this.balanced(o,i):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function rX(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof rU&&(r=e[t+1])instanceof rU&&e.splice(t-1,3,new rU(n.length+1+r.length))}class rQ{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof rV?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new rV(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let i=t-e;n.block?this.addBlock(new rq(i,r,n)):(i||o||r>=5)&&this.addLineDeco(r,o,i)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new rV(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new rU(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof rV)return e;let t=new rV(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof rV||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new rV(0,-1,0));let n=e;for(let e of this.nodes)e instanceof rV&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let o=new rQ(n,e);return eW.spans(t,n,r,o,0),o.finish(n)}}class rK{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&tO(e,t,this.changes,5)}}class rY{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1}return!0}draw(e,t){return tw.replace({widget:new rJ(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class rJ extends tb{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class rZ{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=r4,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=tG.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(ny).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new rj(t),this.stateDeco=r5(e),this.heightMap=r$.empty().applyChanges(this.stateDeco,O.empty,this.heightOracle.setDoc(e.doc),[new nM(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=tw.set(this.lineGaps.map(e=>e.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new r0(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?r4:new r3(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(r6(e,this.scaler))})}update(e,t=null){var n,r;let o;this.state=e.state;let i=this.stateDeco;this.stateDeco=r5(this.state);let s=e.changedRanges,l=nM.extendWithRanges(s,(n=this.stateDeco,r=e?e.changes:$.empty(this.state.doc.length),o=new rK,eW.compare(i,n,r,o,0),o.changes)),a=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);rI=!1,this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),l),(this.heightMap.height!=a||rI)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let u=l.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<u.from||t.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,t));let h=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,e.flags|=this.updateForViewport(),(h||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(nl)&&(this.mustEnforceCursorAssoc=!0)}measure(e){var t;let n,r,o=e.contentDOM,i=window.getComputedStyle(o),s=this.heightOracle,l=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?tG.RTL:tG.LTR;let a=this.heightOracle.mustRefreshForWrapping(l)||this.mustMeasureContent,c=o.getBoundingClientRect(),u=a||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,d=0;if(c.width&&c.height){let{scaleX:e,scaleY:t}=tj(o,c);(e>.005&&Math.abs(this.scaleX-e)>.005||t>.005&&Math.abs(this.scaleY-t)>.005)&&(this.scaleX=e,this.scaleY=t,h|=16,a=u=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,p=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=p)&&(this.paddingTop=f,this.paddingBottom=p,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(u=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=tH(e.scrollDOM);let g=(this.printing?function(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}:function(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,o=r.defaultView||window,i=Math.max(0,n.left),s=Math.min(o.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(o.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(1==t.nodeType){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();i=Math.max(i,r.left),s=Math.min(s,r.right),l=Math.max(l,r.top),a=Math.min(t==e.parentNode?o.innerHeight:a,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else if(11==t.nodeType)t=t.host;else break;return{left:i-n.left,right:Math.max(i,s)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}})(o,this.paddingTop),v=g.top-this.pixelViewport.top,b=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(u=!0)),!this.inView&&!this.scrollTarget&&(n=(t=e.dom).getBoundingClientRect(),r=t.ownerDocument.defaultView||window,!(n.left<r.innerWidth)||!(n.right>0)||!(n.top<r.innerHeight)||!(n.bottom>0)))return 0;let w=c.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),u){let t=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(t)&&(a=!0),a||s.lineWrapping&&Math.abs(w-this.contentDOMWidth)>s.charWidth){let{lineHeight:n,charWidth:r,textHeight:o}=e.docView.measureTextSize();(a=n>0&&s.refresh(l,n,r,o,Math.max(5,w/r),t))&&(e.docView.minWidth=0,h|=16)}for(let n of(v>0&&b>0?d=Math.max(v,b):v<0&&b<0&&(d=Math.min(v,b)),rI=!1,this.viewports)){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?r$.empty().applyChanges(this.stateDeco,O.empty,this.heightOracle,[new nM(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new rB(n.from,r))}rI&&(h|=2)}let x=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return x&&(2&h&&(h|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),h|=this.updateForViewport()),(2&h||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:i,visibleBottom:s}=this,l=new r0(r.lineAt(i-1e3*n,rF.ByHeight,o,0,0).from,r.lineAt(s+(1-n)*1e3,rF.ByHeight,o,0,0).to);if(t){let{head:e}=t.range;if(e<l.from||e>l.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),i=r.lineAt(e,rF.ByPos,o,0,0),s;s="center"==t.y?(i.top+i.bottom)/2-n/2:"start"==t.y||"nearest"==t.y&&e<l.from?i.top:i.bottom-n,l=new r0(r.lineAt(s-500,rF.ByHeight,o,0,0).from,r.lineAt(s+n+500,rF.ByHeight,o,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new r0(this.heightMap.lineAt(n,rF.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,rF.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,rF.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,rF.ByPos,this.heightOracle,0,0),{visibleTop:i,visibleBottom:s}=this;return(0==e||r<=i-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=s+Math.max(10,Math.min(n,250)))&&r>i-2e3&&o<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new rY(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,o=r>>1,i=r<<1;if(this.defaultTextDirection!=tG.LTR&&!n)return[];let s=[],l=(r,i,a,c)=>{if(i-r<o)return;let u=this.state.selection.main,h=[u.from];for(let e of(u.empty||h.push(u.to),h))if(e>r&&e<i){l(r,e-10,a,c),l(e+10,i,a,c);return}let d=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=a.from&&e.to<=a.to&&Math.abs(e.from-r)<o&&Math.abs(e.to-i)<o&&!h.some(t=>e.from<t&&e.to>t));if(!d){if(i<a.to&&t&&n&&t.visibleRanges.some(e=>e.from<=i&&e.to>=i)){let e=t.moveToLineBoundary(Q.cursor(i),!1,!0).head;e>r&&(i=e)}let e=this.gapSize(a,r,i,c),o=n||e<2e6?e:2e6;d=new rY(r,i,e,o)}s.push(d)},a=t=>{var o,s,a;let c,u,h,d,f;if(t.length<i||t.type!=ty.Text)return;let p=(o=t.from,s=t.to,a=this.stateDeco,h=[],d=o,f=0,eW.spans(a,o,s,{span(){},point(e,t){e>d&&(h.push({from:d,to:e}),f+=e-d),d=t}},20),d<s&&(h.push({from:d,to:s}),f+=s-d),{total:f,ranges:h});if(p.total<i)return;let m=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,o=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=m){let r=r2(p,m),i=((this.visibleBottom-this.visibleTop)/2+o)/t.height;e=r-i,n=r+i}else e=(this.visibleTop-t.top-o)/t.height,n=(this.visibleBottom-t.top+o)/t.height;c=r1(p,e),u=r1(p,n)}else{let n,o,i=p.total*this.heightOracle.charWidth,s=r*this.heightOracle.charWidth,l=0;if(i>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let a=this.pixelViewport.left+l,h=this.pixelViewport.right+l;if(null!=m){let e=r2(p,m),t=((h-a)/2+s)/i;n=e-t,o=e+t}else n=(a-s)/i,o=(h+s)/i;c=r1(p,n),u=r1(p,o)}c>t.from&&l(t.from,c,t,p),u<t.to&&l(u,t.to,t,p)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(a):a(e);return s}gapSize(e,t,n,r){let o=r2(r,n)-r2(r,t);return this.heightOracle.lineWrapping?e.height*o:r.total*this.heightOracle.charWidth*o}updateLineGaps(e){rY.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=tw.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];eW.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let o=this.visibleRanges[t],i=n[t];o.from==i.from&&o.to==i.to||(r|=4,e&&e.mapPos(o.from,-1)==i.from&&e.mapPos(o.to,1)==i.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||r6(this.heightMap.lineAt(e,rF.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||r6(this.heightMap.lineAt(this.scaler.fromDOM(e),rF.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return r6(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class r0{constructor(e,t){this.from=e,this.to=t}}function r1({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:o}=t[e],i=o-n;if(r<=i)return n+r;r-=i}}function r2(e,t){let n=0;for(let{from:r,to:o}of e.ranges){if(t<=o){n+=t-r;break}n+=o-r}return n/e.total}let r4={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function r5(e){let t=e.facet(nw).filter(e=>"function"!=typeof e),n=e.facet(nk).filter(e=>"function"!=typeof e);return n.length&&t.push(eW.join(n)),t}class r3{constructor(e,t,n){let r=0,o=0,i=0;for(let s of(this.viewports=n.map(({from:n,to:o})=>{let i=t.lineAt(n,rF.ByPos,e,0,0).top,s=t.lineAt(o,rF.ByPos,e,0,0).bottom;return r+=s-i,{from:n,to:o,top:i,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r),this.viewports))s.domTop=i+(s.top-o)*this.scale,i=s.domBottom=s.domTop+(s.bottom-s.top),o=s.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return r+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,r=o.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return n+(e-r)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,r=o.domBottom}}eq(e){return e instanceof r3&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function r6(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new rW(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>r6(e,t)):e._content)}let r9=J.define({combine:e=>e.join(" ")}),r8=J.define({combine:e=>e.indexOf(!0)>-1}),r7=e2.newName(),oe=e2.newName(),ot=e2.newName(),on={"&light":"."+oe,"&dark":"."+ot};function or(e,t,n){return new e2(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}let oo=or("."+r7,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},on),oi={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},os=tf.ie&&tf.ie_version<=11;class ol{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new tB,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(tf.ie&&tf.ie_version<=11||tf.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&tf.android&&!1!==e.constructor.EDIT_CONTEXT&&!(tf.chrome&&tf.chrome_version<126)&&(this.editContext=new ou(e),e.state.facet(nf)&&(e.contentDOM.editContext=this.editContext.editContext)),os&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){for(let t of(this.gapIntersection.disconnect(),e))this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(nf)?n.root.activeElement!=this.dom:!tM(this.dom,r))return;let o=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(tf.ie&&tf.ie_version<=11||tf.android&&tf.chrome)&&!n.state.selection.main.empty&&r.focusNode&&tR(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=tP(e.root);if(!t)return!1;let n=tf.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return oc(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?oc(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=tM(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,tL(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:r=tL(n=e)}else{if(n==e)return!0;r=t_(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(11==n.nodeType)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,oi),os&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),os&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;this.delayedAndroidKey||(this.flushingAndroidKey=this.view.win.requestAnimationFrame(()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&tz(this.dom,e.key,e.keyCode))})),this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let o of e){let e=this.readMutation(o);e&&(e.typeOver&&(r=!0),-1==t?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&tM(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new rs(this.view,e,t,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=rl(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!ru(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=oa(t,e.previousSibling||e.target.previousSibling,-1),r=oa(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(nf)!=e.state.facet(nf)&&(e.view.contentDOM.editContext=e.state.facet(nf)?this.editContext.editContext:null))}destroy(){var e,t,n;for(let r of(this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect(),this.scrollTargets))r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function oa(e,t,n){for(;t;){let r=n_.get(t);if(r&&r.parent==e)return r;let o=t.parentNode;t=o!=e.dom?o:n>0?t.nextSibling:t.previousSibling}return null}function oc(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return tR(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}class ou{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});for(let n in this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:o,head:i}=r,s=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let a=l-s>n.text.length;s==this.from&&o<this.from?s=o:l==this.to&&o>this.to&&(l=o);let c=rc(e.state.sliceDoc(s,l),n.text,(a?r.from:r.to)-s,a?"end":null);if(!c){let t=Q.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));ru(t,r)||e.dispatch({selection:t,userEvent:"select"});return}let u={from:c.from+s,to:c.toA+s,insert:O.of(n.text.slice(c.from,c.toB).split("\n"))};if((tf.mac||tf.android)&&u.from==i-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(u={from:s,to:l,insert:O.of([n.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);ra(e,u,Q.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],o=null;for(let t=this.toEditorPos(n.rangeStart),i=this.toEditorPos(n.rangeEnd);t<i;t++){let n=e.coordsForChar(t);o=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||o||new DOMRect,r.push(o)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let o=this.toEditorPos(e.rangeStart),i=this.toEditorPos(e.rangeEnd);if(o<i){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(r)?1:2}px`;n.push(tw.mark({attributes:{style:e}}).range(o,i))}}}e.dispatch({effects:nh.of(tw.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}},this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=tP(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((o,i,s,l,a)=>{if(n)return;let c=a.length-(i-o);if(r&&i>=r.to){if(r.from==o&&r.to==i&&r.insert.eq(a)){r=this.pendingContextChange=null,t+=c,this.to+=c;return}r=null,this.revertPending(e.state)}if(o+=t,(i+=t)<=this.from)this.from+=c,this.to+=c;else if(o<this.to){if(o<this.from||i>this.to||this.to-this.from+a.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(i),a.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class oh{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;for(let t of(this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new rZ(e.state||e_.create(e)),e.scrollTo&&e.scrollTo.is(nu)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(nm).map(e=>new nv(e)),this.plugins))t.update(this);this.observer=new ol(this),this.inputState=new rh(this),this.inputState.ensureHandlers(this.plugins),this.docView=new n0(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof eO?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,r,o=this.state;for(let t of e){if(t.startState!=o)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=t.state}if(this.destroyed){this.viewState.state=o;return}let i=this.hasFocus,s=0,l=null;e.some(e=>e.annotation(rR))?(this.inputState.notifiedFocused=i,s=1):i==this.inputState.notifiedFocused||(this.inputState.notifiedFocused=i,(l=r_(o,i))||(s=1));let a=this.observer.delayedAndroidKey,c=null;if(a?(this.observer.clearDelayedAndroidKey(),((c=this.observer.readChange())&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(c=null)):this.observer.clear(),o.facet(e_.phrases)!=this.state.facet(e_.phrases))return this.setState(o);r=nA.create(this,o,e),r.flags|=s;let u=this.viewState.scrollTarget;try{for(let t of(this.updateState=2,e)){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;u=new nc(e.empty?e:Q.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(nu)&&(u=e.value.clip(this.state))}this.viewState.update(r,u),this.bidiCache=op.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(nT)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(r9)!=r.state.facet(r9)&&(this.viewState.mustMeasureContent=!0),(t||n||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let e of this.state.facet(nt))try{e(r)}catch(e){nd(this.state,e,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!rl(this,c)&&a.force&&tz(this.contentDOM,a.key,a.keyCode)})}setState(e){if(0!=this.updateState)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);for(let t of(this.viewState=new rZ(e),this.plugins=e.facet(nm).map(e=>new nv(e)),this.pluginMap.clear(),this.plugins))t.update(this);this.docView.destroy(),this.docView=new n0(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(nm),n=e.state.facet(nm);if(t!=n){let r=[];for(let o of n){let n=t.indexOf(o);if(n<0)r.push(new nv(o));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){nd(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:i}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(i=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(i<0){if(tH(n))o=-1,i=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);o=e.from,i=e.top}}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&s||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(e=>{try{return e.read(this)}catch(e){return nd(this.state,e),of}}),c=nA.create(this,this.state,[]),u=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,!c.empty&&(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),(u=this.docView.update(c))&&this.docViewUpdate());for(let e=0;e<l.length;e++)if(a[e]!=of)try{let t=l[e];t.write&&t.write(a[e],this)}catch(e){nd(this.state,e)}if(u&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,i=-1;continue}{let e=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-i;if(e>1||e<-1){r+=e,n.scrollTop=r/this.scaleY,i=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(nt))e(t)}get themeClasses(){return r7+" "+(this.state.facet(r8)?ot:oe)+" "+this.state.facet(r9)}updateAttrs(){let e=om(this,nb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(nf)?"true":"false",class:"cm-content",style:`${tf.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),om(this,ny,t);let n=this.observer.ignore(()=>{let n=tv(this.contentDOM,this.contentAttrs,t),r=tv(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(oh.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(nT);let e=this.state.facet(oh.cspNonce);e2.mount(this.root,this.styleModules.concat(oo).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e&&!(this.measureRequests.indexOf(e)>-1)){if(null!=e.key){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return re(this,e,n9(this,e,t,n))}moveByGroup(e,t){return re(this,e,n9(this,e,t,t=>{var n;let r,o;return n=e.head,o=(r=this.state.charCategorizer(n))(t),e=>{let t=r(e);return o==eA.Space&&(o=t),o==t}}))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),o=n[t?n.length-1:0];return Q.cursor(o.side(t,r)+e.from,o.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let o=n6(e,t.head,t.assoc||-1),i=r&&o.type==ty.Text&&(e.lineWrapping||o.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>o.from?t.head-1:t.head):null;if(i){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(o.from),s=e.posAtCoords({x:n==(r==tG.LTR)?t.right-1:t.left+1,y:(i.top+i.bottom)/2});if(null!=s)return Q.cursor(s,n?-1:1)}return Q.cursor(n?o.to:o.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return re(this,e,function(e,t,n,r){let o=t.head,i=n?1:-1;if(o==(n?e.state.doc.length:0))return Q.cursor(o,t.assoc);let s=t.goalColumn,l,a=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(o,t.assoc||-1),u=e.documentTop;if(c)null==s&&(s=c.left-a.left),l=i<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(o);null==s&&(s=Math.min(a.right-a.left,e.defaultCharacterWidth*(o-t.from))),l=(i<0?t.top:t.bottom)+u}let h=a.left+s,d=null!=r?r:e.viewState.heightOracle.textHeight>>1,f=rn(e,{x:h,y:l+d*i},!1,i);return Q.cursor(f.pos,f.assoc,void 0,s)}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=rn(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),rn(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),o=this.bidiSpans(r);return tI(n,o[t4.find(o,e-r.from,-1,t)].dir==tG.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ns)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>od)return t3(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||function e(t,n){if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let o=t[r],i=n[r];if(o.from!=i.from||o.to!=i.to||o.direction!=i.direction||!e(o.inner,i.inner))return!1}return!0}(r.isolates,n=nO(this,e))))return r.order;n||(n=nO(this,e));let r=function(e,t,n){if(!e)return[new t4(0,0,t==tQ?1:0)];if(t==tX&&!n.length&&!t2.test(e))return t3(e.length);if(n.length)for(;e.length>t5.length;)t5[t5.length]=256;let r=[],o=t==tX?0:1;return function e(t,n,r,o,i,s,l){let a=n%2?2:1;(function(e,t,n,r,o){for(let i=0;i<=r.length;i++){let s=i?r[i-1].to:t,l=i<r.length?r[i].from:n,a=i?256:o;for(let t=s,n=a,r=a;t<l;t++){let o=t1(e.charCodeAt(t));512==o?o=n:8==o&&4==r&&(o=16),t5[t]=4==o?2:o,7&o&&(r=o),n=o}for(let e=s,t=a,r=a;e<l;e++){let o=t5[e];if(128==o)e<l-1&&t==t5[e+1]&&24&t?o=t5[e]=t:t5[e]=256;else if(64==o){let o=e+1;for(;o<l&&64==t5[o];)o++;let i=e&&8==t||o<n&&8==t5[o]?1==r?1:8:256;for(let t=e;t<o;t++)t5[t]=i;e=o-1}else 8==o&&1==r&&(t5[e]=1);t=o,7&o&&(r=o)}}})(t,i,s,o,a),function(e,t,n,r,o){let i=1==o?2:1;for(let s=0,l=0,a=0;s<=r.length;s++){let c=s?r[s-1].to:t,u=s<r.length?r[s].from:n;for(let t=c,n,r,s;t<u;t++)if(r=tZ[n=e.charCodeAt(t)]){if(r<0){for(let e=l-3;e>=0;e-=3)if(t0[e+1]==-r){let n=t0[e+2],r=2&n?o:4&n?1&n?i:o:0;r&&(t5[t]=t5[t0[e]]=r),l=e;break}}else if(189==t0.length)break;else t0[l++]=t,t0[l++]=n,t0[l++]=a}else if(2==(s=t5[t])||1==s){let e=s==o;a=e?0:1;for(let t=l-3;t>=0;t-=3){let n=t0[t+2];if(2&n)break;if(e)t0[t+2]|=2;else{if(4&n)break;t0[t+2]|=4}}}}}(t,i,s,o,a),function(e,t,n,r){for(let o=0,i=r;o<=n.length;o++){let s=o?n[o-1].to:e,l=o<n.length?n[o].from:t;for(let a=s;a<l;){let s=t5[a];if(256==s){let s=a+1;for(;;)if(s==l){if(o==n.length)break;s=n[o++].to,l=o<n.length?n[o].from:t}else if(256==t5[s])s++;else break;let c=1==i,u=c==((s<t?t5[s]:r)==1)?c?1:2:r;for(let t=s,r=o,i=r?n[r-1].to:e;t>a;)t==i&&(t=n[--r].from,i=r?n[r-1].to:e),t5[--t]=u;a=s}else i=s,a++}}}(i,s,o,a),function t(n,r,o,i,s,l,a){let c=i%2?2:1;if(i%2==s%2)for(let u=r,h=0;u<o;){let r=!0,d=!1;if(h==l.length||u<l[h].from){let e=t5[u];e!=c&&(r=!1,d=16==e)}let f=r||1!=c?null:[],p=r?i:i+1,m=u;t:for(;;)if(h<l.length&&m==l[h].from){if(d)break;let t=l[h];if(!r)for(let e=t.to,n=h+1;;){if(e==o)break t;if(n<l.length&&l[n].from==e)e=l[n++].to;else if(t5[e]==c)break t;else break}h++,f?f.push(t):(t.from>u&&a.push(new t4(u,t.from,p)),e(n,t.direction==tX!=!(p%2)?i+1:i,s,t.inner,t.from,t.to,a),u=t.to),m=t.to}else if(m==o||(r?t5[m]!=c:t5[m]==c))break;else m++;f?t(n,u,m,i+1,s,f,a):u<m&&a.push(new t4(u,m,p)),u=m}else for(let u=o,h=l.length;u>r;){let o=!0,d=!1;if(!h||u>l[h-1].to){let e=t5[u-1];e!=c&&(o=!1,d=16==e)}let f=o||1!=c?null:[],p=o?i:i+1,m=u;t:for(;;)if(h&&m==l[h-1].to){if(d)break;let t=l[--h];if(!o)for(let e=t.from,n=h;;){if(e==r)break t;if(n&&l[n-1].to==e)e=l[--n].from;else if(t5[e-1]==c)break t;else break}f?f.push(t):(t.to<u&&a.push(new t4(t.to,u,p)),e(n,t.direction==tX!=!(p%2)?i+1:i,s,t.inner,t.from,t.to,a),u=t.from),m=t.from}else if(m==r||(o?t5[m-1]!=c:t5[m-1]==c))break;else m--;f?t(n,m,u,i+1,s,f,a):m<u&&a.push(new t4(m,u,p)),u=m}}(t,i,s,n,r,o,l)}(e,o,o,n,0,e.length,r),r}(e.text,t,n);return this.bidiCache.push(new op(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||tf.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{tF(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of(this.root.activeElement==this.contentDOM&&this.contentDOM.blur(),this.plugins))e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return nu.of(new nc("number"==typeof e?Q.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return nu.of(new nc(Q.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ng.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ng.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=e2.newName(),r=[r9.of(n),nT.of(or(`.${n}`,e))];return t&&t.dark&&r.push(r8.of(!0)),r}static baseTheme(e){return el.lowest(nT.of(or("."+r7,e,on)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&n_.get(n)||n_.get(e);return(null===(t=null==r?void 0:r.root)||void 0===t?void 0:t.view)||null}}oh.styleModule=nT,oh.inputHandler=nn,oh.clipboardInputFilter=no,oh.clipboardOutputFilter=ni,oh.scrollHandler=na,oh.focusChangeEffect=nr,oh.perLineTextDirection=ns,oh.exceptionSink=ne,oh.updateListener=nt,oh.editable=nf,oh.mouseSelectionStyle=t7,oh.dragMovesSelection=t8,oh.clickAddsSelectionRange=t9,oh.decorations=nw,oh.blockWrappers=nx,oh.outerDecorations=nk,oh.atomicRanges=nS,oh.bidiIsolatedRanges=nC,oh.scrollMargins=nE,oh.darkTheme=r8,oh.cspNonce=J.define({combine:e=>e.length?e[0]:""}),oh.contentAttributes=ny,oh.editorAttributes=nb,oh.lineWrapping=oh.contentAttributes.of({class:"cm-lineWrapping"}),oh.announce=eC.define();let od=4096,of={};class op{constructor(e,t,n,r,o,i){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=o,this.order=i}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:tG.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let i=e[o];i.dir!=r||t.touchesRange(i.from,i.to)||n.push(new op(t.mapPos(i.from,1),t.mapPos(i.to,-1),i.dir,i.isolates,!1,i.order))}return n}}function om(e,t,n){for(let r=e.state.facet(t),o=r.length-1;o>=0;o--){let t=r[o],i="function"==typeof t?t(e):t;i&&tp(i,n)}return n}let og=tf.mac?"mac":tf.windows?"win":tf.linux?"linux":"key";function ov(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}let ob=el.default(oh.domEventHandlers({keydown:(e,t)=>oC(ox(t.state),e,t,"editor")})),oy=J.define({enables:ob}),ow=new WeakMap;function ox(e){let t=e.facet(oy),n=ow.get(t);return n||ow.set(t,n=function(e,t=og){let n=Object.create(null),r=Object.create(null),o=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},i=(e,r,i,s,l)=>{var a,c;let u=n[e]||(n[e]=Object.create(null)),h=r.split(/ (?!$)/).map(e=>(function(e,t){let n,r,o,i;let s=e.split(/-(?!$)/),l=s[s.length-1];"Space"==l&&(l=" ");for(let e=0;e<s.length-1;++e){let l=s[e];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))"mac"==t?i=!0:r=!0;else throw Error("Unrecognized modifier name: "+l)}return n&&(l="Alt-"+l),r&&(l="Ctrl-"+l),i&&(l="Meta-"+l),o&&(l="Shift-"+l),l})(e,t));for(let t=1;t<h.length;t++){let n=h.slice(0,t).join(" ");o(n,!0),u[n]||(u[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=ok={view:t,prefix:n,scope:e};return setTimeout(()=>{ok==r&&(ok=null)},4e3),!0}]})}let d=h.join(" ");o(d,!1);let f=u[d]||(u[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(a=u._any)||void 0===a?void 0:a.run)||void 0===c?void 0:c.slice())||[]});i&&f.run.push(i),s&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:o}=r;for(let t in e)e[t].run.push(e=>o(e,oS))}let o=r[t]||r.key;if(o)for(let t of e)i(t,o,r.run,r.preventDefault,r.stopPropagation),r.shift&&i(t,"Shift-"+o,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}let ok=null,oS=null;function oC(e,t,n,r){var o;oS=t;let i=("Esc"==(o=!(e9&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||e8&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?e6:e3)[t.keyCode]||t.key||"Unidentified")&&(o="Escape"),"Del"==o&&(o="Delete"),"Left"==o&&(o="ArrowLeft"),"Up"==o&&(o="ArrowUp"),"Right"==o&&(o="ArrowRight"),"Down"==o&&(o="ArrowDown"),o),s=j(L(i,0))==i.length&&" "!=i,l="",a=!1,c=!1,u=!1;ok&&ok.view==n&&ok.scope==r&&(l=ok.prefix+" ",0>rm.indexOf(t.keyCode)&&(c=!0,ok=null));let h=new Set,d=e=>{if(e){for(let t of e.run)if(!h.has(t)&&(h.add(t),t(n)))return e.stopPropagation&&(u=!0),!0;e.preventDefault&&(e.stopPropagation&&(u=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[l+ov(i,t,!s)])?a=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(tf.windows&&t.ctrlKey&&t.altKey)&&!(tf.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=e3[t.keyCode])&&p!=i?d(f[l+ov(p,t,!0)])?a=!0:t.shiftKey&&(m=e6[t.keyCode])!=i&&m!=p&&d(f[l+ov(m,t,!1)])&&(a=!0):s&&t.shiftKey&&d(f[l+ov(i,t,!0)])&&(a=!0),!a&&d(f._any)&&(a=!0)),c&&(a=!0),a&&u&&t.stopPropagation(),oS=null,a}class oO{constructor(e,t,n,r,o){this.className=e,this.left=t,this.top=n,this.width=r,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(!n.empty)return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),o=Math.min(n.to,e.viewport.to),i=e.textDirection==tG.LTR,s=e.contentDOM,l=s.getBoundingClientRect(),a=oE(e),c=s.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=l.right-(u?parseInt(u.paddingRight):0),f=n6(e,r,1),p=n6(e,o,-1),m=f.type==ty.Text?f:null,g=p.type==ty.Text?p:null;if(m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=oP(e,r,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=oP(e,o,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return b(y(n.from,n.to,m));{let t=m?y(n.from,null,m):w(f,!1),r=g?y(null,n.to,g):w(p,!0),o=[];return(m||f).to<(g||p).from-(m&&g?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?o.push(v(h,t.bottom,d,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==ty.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),b(t).concat(o).concat(b(r))}function v(e,n,r,o){return new oO(t,e-a.left,n-a.top,r-e,o-n)}function b({top:e,bottom:t,horizontal:n}){let r=[];for(let o=0;o<n.length;o+=2)r.push(v(n[o],e,n[o+1],t));return r}function y(t,n,r){let o=1e9,s=-1e9,l=[];function a(t,n,a,c,u){let f=e.coordsAtPos(t,t==r.to?-2:2),p=e.coordsAtPos(a,a==r.from?2:-2);f&&p&&(o=Math.min(f.top,p.top,o),s=Math.max(f.bottom,p.bottom,s),u==tG.LTR?l.push(i&&n?h:f.left,i&&c?d:p.right):l.push(!i&&c?h:p.left,!i&&n?d:f.right))}let c=null!=t?t:r.from,u=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>c&&r.from<u)for(let o=Math.max(r.from,c),i=Math.min(r.to,u);;){let r=e.state.doc.lineAt(o);for(let s of e.bidiSpans(r)){let e=s.from+r.from,l=s.to+r.from;if(e>=i)break;l>o&&a(Math.max(e,o),null==t&&e<=c,Math.min(l,i),null==n&&l>=u,s.dir)}if((o=r.to+1)>=i)break}return 0==l.length&&a(c,null==t,u,null==n,e.textDirection),{top:o,bottom:s,horizontal:l}}function w(e,t){let n=l.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n);{let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let o=oE(e);return[new oO(t,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]}}}function oE(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==tG.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function oP(e,t,n,r){let o=e.coordsAtPos(t,2*n);if(!o)return r;let i=e.dom.getBoundingClientRect(),s=(o.top+o.bottom)/2,l=e.posAtCoords({x:i.left+1,y:s}),a=e.posAtCoords({x:i.right-1,y:s});return null==l||null==a?r:{from:Math.max(r.from,Math.min(l,a)),to:Math.min(r.to,Math.max(l,a))}}class oT{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(oM)!=e.state.facet(oM)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(oM);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{var n;return n=this.drawn[t],!(e.constructor==n.constructor&&e.eq(n))})){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,tf.safari&&tf.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}let oM=J.define();function oA(e){return[ng.define(t=>new oT(t,e)),oM.of(e)]}let oR=J.define({combine:e=>eD(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function o_(e){return e.startState.facet(oR)!=e.state.facet(oR)}let oD=oA({above:!0,markers(e){let{state:t}=e,n=t.facet(oR),r=[];for(let o of t.selection.ranges){let i=o==t.selection.main;if(o.empty||n.drawRangeCursor){let t=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=o.empty?o:Q.cursor(o.head,o.head>o.anchor?-1:1);for(let o of oO.forRange(e,t,n))r.push(o)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=o_(e);return n&&oN(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){oN(t.state,e)},class:"cm-cursorLayer"});function oN(e,t){t.style.animationDuration=e.facet(oR).cursorBlinkRate+"ms"}let oL=oA({above:!1,markers:e=>e.state.selection.ranges.map(t=>t.empty?[]:oO.forRange(e,"cm-selectionBackground",t)).reduce((e,t)=>e.concat(t)),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||o_(e),class:"cm-selectionLayer"}),oI=el.highest(oh.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),oj=eC.define({map:(e,t)=>null==e?null:t.mapPos(e)}),oB=eo.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(oj)?t.value:e,e))}),oW=ng.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(oB);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(oB)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(oB),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(oB)!=e&&this.view.dispatch({effects:oj.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function oF(e,t,n,r,o){t.lastIndex=0;for(let i=e.iterRange(n,r),s=n,l;!i.next().done;s+=i.value.length)if(!i.lineBreak)for(;l=t.exec(i.value);)o(s+l.index,l)}class o${constructor(e){let{regexp:t,decoration:n,decorate:r,boundary:o,maxLength:i=1e3}=e;if(!t.global)throw RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(e,t,n,o)=>r(o,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,o)=>{let i=n(e,t,r);i&&o(r,r+e[0].length,i)};else if(n)this.addMatch=(e,t,r,o)=>o(r,r+e[0].length,n);else throw RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=i}createDeco(e){let t=new eF,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:o,to:i}of n)o=Math.max(e.state.doc.lineAt(o).from,o-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),r.length&&r[r.length-1].to>=o?r[r.length-1].to=i:r.push({from:o,to:i});return r}(e,this.maxLength))oF(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return(e.docChanged&&e.changes.iterChanges((t,o,i,s)=>{s>=e.view.viewport.from&&i<=e.view.viewport.to&&(n=Math.min(i,n),r=Math.max(s,r))}),e.viewportMoved||r-n>1e3)?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let o of e.visibleRanges){let i=Math.max(o.from,n),s=Math.min(o.to,r);if(s>=i){let n=e.state.doc.lineAt(i),r=n.to<s?e.state.doc.lineAt(s):n,l=Math.max(o.from,n.from),a=Math.min(o.to,r.to);if(this.boundary){for(;i>n.from;i--)if(this.boundary.test(n.text[i-1-n.from])){l=i;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){a=s;break}}let c=[],u,h=(e,t,n)=>c.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=l-n.from;(u=this.regexp.exec(n.text))&&u.index<a-n.from;)this.addMatch(u,e,u.index+n.from,h);else oF(e.state.doc,this.regexp,l,a,(t,n)=>this.addMatch(n,e,t,h));t=t.update({filterFrom:l,filterTo:a,filter:(e,t)=>e<l||t>a,add:c})}}return t}}let oz=null!=/x/.unicode?"gu":"g",oH=RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]",oz),oq={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},oV=null,oU=J.define({combine(e){let t=eD(e,{render:null,specialChars:oH,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==oV&&"undefined"!=typeof document&&document.body){let t=document.body.style;oV=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)!=null}return oV||!1}())&&(t.specialChars=RegExp("	|"+t.specialChars.source,oz)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,oz)),t}}),oG=null;class oX extends tb{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){var t;let n=(t=this.code)>=32?"•":10==t?"␤":String.fromCharCode(9216+t),r=e.state.phrase("Control character")+" "+(oq[this.code]||"0x"+this.code.toString(16)),o=this.options.render&&this.options.render(this.code,r,n);if(o)return o;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class oQ extends tb{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="	",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}let oK=tw.line({class:"cm-activeLine"}),oY=ng.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let o=e.lineBlockAt(r.head);o.from>t&&(n.push(oK.range(o.from)),t=o.from)}return tw.set(n)}},{decorations:e=>e.decorations});class oJ extends tb{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?tA(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=tI(t[0],"rtl"!=n.direction),o=parseInt(n.lineHeight);return r.bottom-r.top>1.5*o?{left:r.left,right:r.right,top:r.top,bottom:r.top+o}:r}ignoreEvent(){return!1}}function oZ(e,t){var n;let r,o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),i=e.state.doc.lineAt(o),s=o-i.from,l=s>2e3?-1:s==i.length?(n=t.clientX,(r=e.coordsAtPos(e.viewport.from))?Math.round(Math.abs((r.left-n)/e.defaultCharacterWidth)):-1):eY(i.text,e.state.tabSize,o-i.from);return{line:i.number,col:l,off:s}}let o0={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},o1={style:"cursor: crosshair"},o2="-10000px";class o4{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let o=null;this.tooltipViews=this.tooltips.map(e=>o=n(e,o))}update(e,t){var n;let r=e.state.facet(this.facet),o=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let i=[],s=t?[]:null;for(let n=0;n<o.length;n++){let r=o[n],l=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(l=e)}if(l<0)i[n]=this.createTooltipView(r,n?i[n-1]:null),s&&(s[n]=!!r.above);else{let r=i[n]=this.tooltipViews[l];s&&(s[n]=t[l]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)0>i.indexOf(e)&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=r,this.tooltips=o,this.tooltipViews=i,!0}}function o5(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}let o3=J.define({combine:e=>{var t,n,r;return{position:tf.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(r=e.find(e=>e.tooltipSpace))||void 0===r?void 0:r.tooltipSpace)||o5}}}),o6=new WeakMap,o9=ng.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(o3);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new o4(e,it,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver)for(let e of(this.intersectionObserver.disconnect(),this.manager.tooltipViews))this.intersectionObserver.observe(e.dom)}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(o3);if(r.position!=this.position&&!this.madeAbsolute){for(let e of(this.position=r.position,this.manager.tooltipViews))e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){for(let e of(this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer(),this.manager.tooltipViews))this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=o2,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;for(let t of(this.view.win.removeEventListener("resize",this.measureSoon),this.manager.tooltipViews))t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(tf.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}let r=this.view.scrollDOM.getBoundingClientRect(),o=nP(this.view);return{visible:{left:r.left+o.left,top:r.top+o.top,right:r.right-o.right,bottom:r.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(o3).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute)for(let e of(this.madeAbsolute=!0,this.position="absolute",this.manager.tooltipViews))e.dom.style.position="absolute";let{visible:n,space:r,scaleX:o,scaleY:i}=e,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:u}=c,h=e.pos[l],d=e.size[l];if(!h||!1!==a.clip&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){u.style.top=o2;continue}let f=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,m=d.right-d.left,g=null!==(t=o6.get(c))&&void 0!==t?t:d.bottom-d.top,v=c.offset||ie,b=this.view.textDirection==tG.LTR,y=d.width>r.right-r.left?b?r.left:r.right-d.width:b?Math.max(r.left,Math.min(h.left-(f?14:0)+v.x,r.right-m)):Math.min(Math.max(r.left,h.left-m+(f?14:0)-v.x),r.right-m),w=this.above[l];!a.strictSide&&(w?h.top-g-p-v.y<r.top:h.bottom+g+p+v.y>r.bottom)&&w==r.bottom-h.bottom>h.top-r.top&&(w=this.above[l]=!w);let x=(w?h.top-r.top:r.bottom-h.bottom)-p;if(x<g&&!1!==c.resize){if(x<this.view.defaultLineHeight){u.style.top=o2;continue}o6.set(c,g),u.style.height=(g=x)/i+"px"}else u.style.height&&(u.style.height="");let k=w?h.top-g-p-v.y:h.bottom+p+v.y,S=y+m;if(!0!==c.overlap)for(let e of s)e.left<S&&e.right>y&&e.top<k+g&&e.bottom>k&&(k=w?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(u.style.top=(k-e.parent.top)/i+"px",o8(u,(y-e.parent.left)/o)):(u.style.top=k/i+"px",o8(u,y/o)),f){let e=h.left+(b?v.x:-v.x)-(y+14-7);f.style.left=e/o+"px"}!0!==c.overlap&&s.push({left:y,top:k,right:S,bottom:k+g}),u.classList.toggle("cm-tooltip-above",w),u.classList.toggle("cm-tooltip-below",!w),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=o2}},{eventObservers:{scroll(){this.maybeMeasure()}}});function o8(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}let o7=oh.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),ie={x:0,y:0},it=J.define({enables:[o9,o7]}),ir=J.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class io{static create(e){return new io(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new o4(e,ir,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r){if(void 0===t)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}let ii=it.compute([ir],e=>{let t=e.facet(ir);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:io.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class is{constructor(e,t,n,r,o){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,o=1;if(n.isWidget())r=n.posAtStart;else{if(null==(r=e.posAtCoords(t)))return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let i=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),s=i&&i.dir==tG.RTL?-1:1;o=t.x<n.left?-s:s}let i=this.source(e,r,o);if(null==i?void 0:i.then){let t=this.pending={pos:r};i.then(n=>{this.pending==t&&(this.pending=null,n&&!(Array.isArray(n)&&!n.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>nd(e.state,t,"hover tooltip"))}else i&&!(Array.isArray(i)&&!i.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(i)?i:[i])})}get tooltip(){let e=this.view.plugin(o9),t=e?e.manager.tooltips.findIndex(e=>e.create==io.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:o}=this;if(r.length&&o&&!function(e,t){let{left:n,right:r,top:o,bottom:i}=e.getBoundingClientRect(),s;if(s=e.querySelector(".cm-tooltip-arrow")){let e=s.getBoundingClientRect();o=Math.min(e.top,o),i=Math.max(e.bottom,i)}return t.clientX>=n-4&&t.clientX<=r+4&&t.clientY>=o-4&&t.clientY<=i+4}(o.dom,e)||this.pending){let{pos:o}=r[0]||this.pending,i=null!==(n=null===(t=r[0])||void 0===t?void 0:t.end)&&void 0!==n?n:o;(o==i?this.view.posAtCoords(this.lastMove)!=o:!function(e,t,n,r,o,i){let s=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>r||s.right<r||s.top>o||Math.min(s.bottom,l)<o)return!1;let a=e.posAtCoords({x:r,y:o},!1);return a>=t&&a<=n}(this.view,o,i,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function il(e,t){let n=e.plugin(o9);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}let ia=eC.define(),ic=J.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function iu(e,t){let n=e.plugin(ih),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}let ih=ng.fromClass(class{constructor(e){this.input=e.state.facet(im),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(ic);for(let n of(this.top=new id(e,!0,t.topContainer),this.bottom=new id(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top)),this.panels))n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(ic);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new id(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new id(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(im);if(n!=this.input){let t=n.filter(e=>e),r=[],o=[],i=[],s=[];for(let n of t){let t=this.specs.indexOf(n),l;t<0?(l=n(e.view),s.push(l)):(l=this.panels[t]).update&&l.update(e),r.push(l),(l.top?o:i).push(l)}for(let e of(this.specs=t,this.panels=r,this.top.sync(o),this.bottom.sync(i),s))e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>oh.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class id{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&0>e.indexOf(t)&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=ip(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ip(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function ip(e){let t=e.nextSibling;return e.remove(),t}let im=J.define({enables:ih}),ig=eo.define({create:()=>[],update(e,t){for(let n of t.effects)n.is(iv)?e=[n.value].concat(e):n.is(ib)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>im.computeN([e],t=>t.field(e))}),iv=eC.define(),ib=eC.define();class iy extends eN{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}iy.prototype.elementClass="",iy.prototype.toDOM=void 0,iy.prototype.mapMode=W.TrackBefore,iy.prototype.startSide=iy.prototype.endSide=-1,iy.prototype.point=!0;let iw=J.define(),ix=J.define(),ik={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>eW.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},iS=J.define(),iC=J.define({combine:e=>e.some(e=>e)});function iO(e){let t=[iE];return e&&!1===e.fixed&&t.push(iC.of(!0)),t}let iE=ng.fromClass(class{constructor(e){for(let t of(this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(iS).map(t=>new iA(e,t)),this.fixed=!e.state.facet(iC),this.gutters))"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(iC)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=eW.iter(this.view.state.facet(iw),this.view.viewport.from),r=[],o=this.gutters.map(e=>new iM(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let i of e.type)if(i.type==ty.Text&&t){for(let e of(iT(n,r,i.from),o))e.line(this.view,i,r);t=!1}else if(i.widget)for(let e of o)e.widget(this.view,i)}else if(e.type==ty.Text)for(let t of(iT(n,r,e.from),o))t.line(this.view,e,r);else if(e.widget)for(let t of o)t.widget(this.view,e);for(let e of o)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(iS),n=e.state.facet(iS),r=e.docChanged||e.heightChanged||e.viewportChanged||!eW.eq(e.startState.facet(iw),e.state.facet(iw),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let o=[];for(let r of n){let n=t.indexOf(r);n<0?o.push(new iA(this.view,r)):(this.gutters[n].update(e),o.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),0>o.indexOf(e)&&e.destroy();for(let e of o)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=o}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>oh.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,o=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==tG.LTR?{left:r,right:o}:{right:r,left:o}})});function iP(e){return Array.isArray(e)?e:[e]}function iT(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class iM{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=eW.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,o=(t.top-this.height)/e.scaleY,i=t.height/e.scaleY;if(this.i==r.elements.length){let t=new iR(e,i,o,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,i,o,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];iT(this.cursor,r,t.from),n.length&&(r=r.concat(n));let o=this.gutter.config.lineMarker(e,t,r);o&&r.unshift(o);let i=this.gutter;(0!=r.length||i.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(ix)){let o=n(e,t.widget,t);o&&(r||(r=[])).push(o)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class iA{constructor(e,t){for(let n in this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),t.domEventHandlers)this.dom.addEventListener(n,r=>{let o=r.target,i;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let e=o.getBoundingClientRect();i=(e.top+e.bottom)/2}else i=r.clientY;let s=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()});this.markers=iP(t.markers(e)),t.initialSpacer&&(this.spacer=new iR(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=iP(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!eW.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class iR{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),!function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,r)&&this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let o=0,i=0;;){let s=i,l=o<t.length?t[o++]:null,a=!1;if(l){let e=l.elementClass;e&&(n+=" "+e);for(let e=i;e<this.markers.length;e++)if(this.markers[e].compare(l)){s=e,a=!0;break}}else s=this.markers.length;for(;i<s;){let e=this.markers[i++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!l)break;l.toDOM&&(a?r=r.nextSibling:this.dom.insertBefore(l.toDOM(e),r)),a&&i++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}let i_=J.define(),iD=J.define(),iN=J.define({combine:e=>eD(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],o=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||o(e,t,n):o}return n}})});class iL extends iy{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function iI(e,t){return e.state.facet(iN).formatNumber(t,e.state)}let ij=iS.compute([iN],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(i_),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new iL(iI(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(iD)){let o=r(e,t,n);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(iN)!=e.state.facet(iN),initialSpacer:e=>new iL(iI(e,iB(e.state.doc.lines))),updateSpacer(e,t){let n=iI(t.view,iB(t.view.state.doc.lines));return n==e.number?e:new iL(n)},domEventHandlers:e.facet(iN).domEventHandlers,side:"before"}));function iB(e){let t=9;for(;t<e;)t=10*t+9;return t}let iW=new class extends iy{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},iF=iw.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.head).from;o>n&&(n=o,t.push(iW.range(o)))}return eW.of(t)}),i$=0;class iz{constructor(e,t){this.from=e,this.to=t}}class iH{constructor(e={}){this.id=i$++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=iU.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}iH.closedBy=new iH({deserialize:e=>e.split(" ")}),iH.openedBy=new iH({deserialize:e=>e.split(" ")}),iH.group=new iH({deserialize:e=>e.split(" ")}),iH.isolate=new iH({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),iH.contextHash=new iH({perNode:!0}),iH.lookAhead=new iH({perNode:!0}),iH.mounted=new iH({perNode:!0});class iq{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[iH.mounted.id]}}let iV=Object.create(null);class iU{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):iV,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new iU(e.name||"",t,e.id,n);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(iH.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(iH.group),r=-1;r<(n?n.length:0);r++){let o=t[r<0?e.name:n[r]];if(o)return o}}}}iU.none=new iU("",Object.create(null),0,8);class iG{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let t of e){let e=t(n);if(e){r||(r=Object.assign({},n.props));let t=e[1],o=e[0];o.combine&&o.id in r&&(t=o.combine(r[o.id],t)),r[o.id]=t}}t.push(r?new iU(n.name,r,n.id,n.flags):n)}return new iG(t)}}let iX=new WeakMap,iQ=new WeakMap;(u=h||(h={}))[u.ExcludeBuffers=1]="ExcludeBuffers",u[u.IncludeAnonymous=2]="IncludeAnonymous",u[u.IgnoreMounts=4]="IgnoreMounts",u[u.IgnoreOverlays=8]="IgnoreOverlays",u[u.EnterBracketed=16]="EnterBracketed";class iK{constructor(e,t,n,r,o){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,o&&o.length)for(let[e,t]of(this.props=Object.create(null),o))this.props["number"==typeof e?e:e.id]=t}toString(){let e=iq.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new i7(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new i7(iX.get(this)||this.topNode);return r.moveTo(e,t),iX.set(this,r._tree),r}get topNode(){return new i2(this,0,0,null)}resolve(e,t=0){let n=i0(iX.get(this)||this.topNode,e,t,!1);return iX.set(this,n),n}resolveInner(e,t=0){let n=i0(iQ.get(this)||this.topNode,e,t,!0);return iQ.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let r=e.resolveInner(t,n),o=null;for(let e=r instanceof i2?r:r.context.parent;e;e=e.parent)if(e.index<0){let i=e.parent;(o||(o=[r])).push(i.resolve(t,n)),e=i}else{let i=iq.get(e.tree);if(i&&i.overlay&&i.overlay[0].from<=t&&i.overlay[i.overlay.length-1].to>=t){let s=new i2(i.tree,i.overlay[0].from+e.from,-1,e);(o||(o=[r])).push(i0(s,t,n,!1))}}return o?i9(o):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:o=this.length}=e,i=e.mode||0,s=(i&h.IncludeAnonymous)>0;for(let e=this.cursor(i|h.IncludeAnonymous);;){let i=!1;if(e.from<=o&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;i=!0}for(;i&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;i=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:sr(iU.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new iK(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new iK(iU.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:o=1024,reused:i=[],minRepeatType:s=r.types.length}=e,l=Array.isArray(n)?new iY(n,n.length):n,a=r.types,c=0,u=0;function h(e,t,n,o,i,s,l,a,c){let u=[],h=[];for(;e.length>o;)u.push(e.pop()),h.push(t.pop()+n-i);e.push(d(r.types[l],u,h,s-i,a-s,c)),t.push(i-n)}function d(e,t,n,r,o,i,s){if(i){let e=[iH.contextHash,i];s=s?[e].concat(s):[e]}if(o>25){let e=[iH.lookAhead,o];s=s?[e].concat(s):[e]}return new iK(e,t,n,r,s)}let f=[],p=[];for(;l.pos>0;)!function e(t,n,f,p,m,g){let{id:v,start:b,end:y,size:w}=l,x=u,k=c;if(w<0){if(l.next(),-1==w){let e=i[v];f.push(e),p.push(b-t);return}if(-3==w){c=v;return}if(-4==w){u=v;return}throw RangeError(`Unrecognized record size: ${w}`)}let S=a[v],C,O,E=b-t;if(y-b<=o&&(O=function(e,t){let n=l.fork(),r=0,i=0,a=0,c=n.end-o,u={size:0,start:0,skip:0};n:for(let o=n.pos-e;n.pos>o;){let e=n.size;if(n.id==t&&e>=0){u.size=r,u.start=i,u.skip=a,a+=4,r+=4,n.next();continue}let l=n.pos-e;if(e<0||l<o||n.start<c)break;let h=n.id>=s?4:0,d=n.start;for(n.next();n.pos>l;){if(n.size<0){if(-3==n.size||-4==n.size)h+=4;else break n}else n.id>=s&&(h+=4);n.next()}i=d,r+=e,a+=h}return(t<0||r==e)&&(u.size=r,u.start=i,u.skip=a),u.size>4?u:void 0}(l.pos-n,m))){let e=new Uint16Array(O.size-O.skip),n=l.pos-O.size,o=e.length;for(;l.pos>n;)o=function e(t,n,r){let{id:o,start:i,end:a,size:h}=l;if(l.next(),h>=0&&o<s){let s=r;if(h>4){let o=l.pos-(h-4);for(;l.pos>o;)r=e(t,n,r)}n[--r]=s,n[--r]=a-t,n[--r]=i-t,n[--r]=o}else -3==h?c=o:-4==h&&(u=o);return r}(O.start,e,o);C=new iJ(e,y-O.start,r),E=O.start-t}else{let t=l.pos-w;l.next();let n=[],i=[],a=v>=s?v:-1,c=0,u=y;for(;l.pos>t;)a>=0&&l.id==a&&l.size>=0?(l.end<=u-o&&(h(n,i,b,c,l.end,u,a,x,k),c=n.length,u=l.end),l.next()):g>2500?function(e,t,n,i){let s=[],a=0,c=-1;for(;l.pos>t;){let{id:e,start:t,end:n,size:r}=l;if(r>4)l.next();else if(c>-1&&t<c)break;else c<0&&(c=n-o),s.push(e,t,n),a++,l.next()}if(a){let t=new Uint16Array(4*a),o=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-o,t[n++]=s[e+2]-o,t[n++]=n;n.push(new iJ(t,s[2]-o,r)),i.push(o-e)}}(b,t,n,i):e(b,t,n,i,a,g+1);if(a>=0&&c>0&&c<n.length&&h(n,i,b,c,b,u,a,x,k),n.reverse(),i.reverse(),a>-1&&c>0){let e=function(e,t){return(n,r,o)=>{let i=0,s=n.length-1,l,a;if(s>=0&&(l=n[s])instanceof iK){if(!s&&l.type==e&&l.length==o)return l;(a=l.prop(iH.lookAhead))&&(i=r[s]+l.length+a)}return d(e,n,r,o,i,t)}}(S,k);C=sr(S,n,i,0,n.length,0,y-b,e,e)}else C=d(S,n,i,y-b,x-y,k)}f.push(C),p.push(E)}(e.start||0,e.bufferStart||0,f,p,-1,0);let m=null!==(t=e.length)&&void 0!==t?t:f.length?p[0]+f[0].length:0;return new iK(a[e.topID],f.reverse(),p.reverse(),m)}(e)}}iK.empty=new iK(iU.none,[],[],0);class iY{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new iY(this.buffer,this.index)}}class iJ{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return iU.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],o=r.name;if(/\W/.test(o)&&!r.isError&&(o=JSON.stringify(o)),n==(e+=4))return o;let i=[];for(;e<n;)i.push(this.childString(e)),e=this.buffer[e+3];return o+"("+i.join(",")+")"}findChild(e,t,n,r,o){let{buffer:i}=this,s=-1;for(let l=e;l!=t&&(!iZ(o,r,i[l+1],i[l+2])||(s=l,!(n>0)));l=i[l+3]);return s}slice(e,t,n){let r=this.buffer,o=new Uint16Array(t-e),i=0;for(let s=e,l=0;s<t;){o[l++]=r[s++],o[l++]=r[s++]-n;let t=o[l++]=r[s++]-n;o[l++]=r[s++]-e,i=Math.max(i,t)}return new iJ(o,i,this.set)}}function iZ(e,t,n,r){switch(e){case -2:return n<t;case -1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function i0(e,t,n,r){for(var o;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof i2&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:h.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;s=(r=s).parent)r instanceof i2&&r.index<0&&(null===(o=s.enter(t,n,i))||void 0===o?void 0:o.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}class i1{cursor(e=0){return new i7(this,e)}getChild(e,t=null,n=null){let r=i4(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return i4(this,e,t,n)}resolve(e,t=0){return i0(this,e,t,!1)}resolveInner(e,t=0){return i0(this,e,t,!0)}matchContext(e){return i5(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class i2 extends i1{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,o=0){var i;for(let s=this;;){for(let{children:l,positions:a}=s._tree,c=t>0?l.length:-1;e!=c;e+=t){let c=l[e],u=a[e]+s.from;if(o&h.EnterBracketed&&c instanceof iK&&(null===(i=iq.get(c))||void 0===i?void 0:i.overlay)===null&&(u>=n||u+c.length<=n)||iZ(r,n,u,u+c.length)){if(c instanceof iJ){if(o&h.ExcludeBuffers)continue;let i=c.findChild(0,c.buffer.length,t,n-u,r);if(i>-1)return new i6(new i3(s,c,e,u),null,i)}else if(o&h.IncludeAnonymous||!c.type.isAnonymous||se(c)){let i;if(!(o&h.IgnoreMounts)&&(i=iq.get(c))&&!i.overlay)return new i2(i.tree,u,e,s);let l=new i2(c,u,e,s);return o&h.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?c.children.length-1:0,t,n,r,o)}}}if(o&h.IncludeAnonymous||!s.type.isAnonymous||(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,!(s=s._parent)))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&h.IgnoreOverlays)&&(r=iq.get(this._tree))&&r.overlay){let o=e-this.from,i=n&h.EnterBracketed&&r.bracketed;for(let{from:e,to:n}of r.overlay)if((t>0||i?e<=o:e<o)&&(t<0||i?n>=o:n>o))return new i2(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function i4(e,t,n,r){let o=e.cursor(),i=[];if(!o.firstChild())return i;if(null!=n){for(let e=!1;!e;)if(e=o.type.is(n),!o.nextSibling())return i}for(;;){if(null!=r&&o.type.is(r))return i;if(o.type.is(t)&&i.push(o.node),!o.nextSibling())return null==r?i:[]}}function i5(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class i3{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class i6 extends i1{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new i6(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&h.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new i6(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new i6(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new i6(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,o=n.buffer[this.index+3];if(o>r){let i=n.buffer[this.index+1];e.push(n.slice(r,o,i)),t.push(0)}return new iK(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function i9(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let o=e[r];(o.from>n.from||o.to<n.to)&&(n=o,t=r)}let r=n instanceof i2&&n.index<0?null:n.parent,o=e.slice();return r?o[t]=r:o.splice(t,1),new i8(o,n)}class i8{constructor(e,t){this.heads=e,this.node=t}get next(){return i9(this.heads)}}class i7{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~h.EnterBracketed,e instanceof i2)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return!!e&&(e instanceof i2?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(o<0)&&(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&h.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&h.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&h.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,o=e<0?-1:n._tree.children.length;r!=o;r+=e){let e=n._tree.children[r];if(this.mode&h.IncludeAnonymous||e instanceof iJ||!e.type.isAnonymous||se(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)n:for(let r=this.index,o=this.stack.length;o>=0;){for(let i=e;i;i=i._parent)if(i.index==r){if(r==this.index)return i;t=i,n=o+1;break n}r=this.stack[--o]}for(let e=n;e<this.stack.length;e++)t=new i6(this.buffer,t,this.stack[e]);return this.bufferNode=new i6(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return i5(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,o=this.stack.length-1;r>=0;o--){if(o<0)return i5(this._tree,e,r);let i=n[t.buffer[this.stack[o]]];if(!i.isAnonymous){if(e[r]&&e[r]!=i.name)return!1;r--}}return!0}}function se(e){return e.children.some(e=>e instanceof iJ||!e.type.isAnonymous||se(e))}let st=new WeakMap;function sn(e,t){if(!e.isAnonymous||t instanceof iJ||t.type!=e)return 1;let n=st.get(t);if(null==n){for(let r of(n=1,t.children)){if(r.type!=e||!(r instanceof iK)){n=1;break}n+=sn(e,r)}st.set(t,n)}return n}function sr(e,t,n,r,o,i,s,l,a){let c=0;for(let n=r;n<o;n++)c+=sn(e,t[n]);let u=Math.ceil(1.5*c/8),h=[],d=[];return!function t(n,r,o,s,l){for(let c=o;c<s;){let o=c,f=r[c],p=sn(e,n[c]);for(c++;c<s;c++){let t=sn(e,n[c]);if(p+t>=u)break;p+=t}if(c==o+1){if(p>u){let e=n[o];t(e.children,e.positions,0,e.children.length,r[o]+l);continue}h.push(n[o])}else{let t=r[c-1]+n[c-1].length-f;h.push(sr(e,n,r,o,c,f,t,null,a))}d.push(f+l-i)}}(t,n,r,o,0),(l||a)(h,d,s)}class so{constructor(e,t,n,r,o=!1,i=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(o?1:0)|(i?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new so(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],o=1,i=e.length?e[0]:null;for(let s=0,l=0,a=0;;s++){let c=s<t.length?t[s]:null,u=c?c.fromA:1e9;if(u-l>=n)for(;i&&i.from<u;){let t=i;if(l>=t.from||u<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,u)-a;t=e>=n?null:new so(e,n,t.tree,t.offset+a,s>0,!!c)}if(t&&r.push(t),i.to>u)break;i=o<e.length?e[o++]:null}if(!c)break;l=c.toA,a=c.toA-c.toB}return r}}class si{startParse(e,t,n){return"string"==typeof e&&(e=new ss(e)),n=n?n.length?n.map(e=>new iz(e.from,e.to)):[new iz(0,0)]:[new iz(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class ss{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new iH({perNode:!0});let sl=0;class sa{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=sl++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){if(e instanceof sa&&(t=e),null==t?void 0:t.base)throw Error("Can not derive from a modified tag");let n=new sa("string"==typeof e?e:"?",[],null,[]);if(n.set.push(n),t)for(let e of t.set)n.set.push(e);return n}static defineModifier(e){let t=new su(e);return e=>e.modified.indexOf(t)>-1?e:su.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let sc=0;class su{constructor(e){this.name=e,this.instances=[],this.id=sc++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{var r;return n.base==e&&(r=n.modified,t.length==r.length&&t.every((e,t)=>e==r[t]))});if(n)return n;let r=[],o=new sa(e.name,r,e,t);for(let e of t)e.instances.push(o);let i=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,o=t.length;r<o;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of i)r.push(su.get(t,e));return o}}function sh(e){let t=Object.create(null);for(let n in e){let r=e[n];for(let e of(Array.isArray(r)||(r=[r]),n.split(" ")))if(e){let n=[],o=2,i=e;for(let t=0;;){if("..."==i&&t>0&&t+3==e.length){o=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(i);if(!r)throw RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),(t+=r[0].length)==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){o=0;break}if("/"!=s)throw RangeError("Invalid path: "+e);i=e.slice(t)}let s=n.length-1,l=n[s];if(!l)throw RangeError("Invalid path: "+e);let a=new sf(r,o,s>0?n.slice(0,s):null);t[l]=a.sort(t[l])}}return sd.add(t)}let sd=new iH({combine(e,t){let n,r,o;for(;e||t;){if(!e||t&&e.depth>=t.depth?(o=t,t=t.next):(o=e,e=e.next),n&&n.mode==o.mode&&!o.context&&!n.context)continue;let i=new sf(o.tags,o.mode,o.context);n?n.next=i:r=i,n=i}return r}});class sf{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function sp(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:r,all:o=null}=t||{};return{style:e=>{let t=o;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}sf.empty=new sf([],2,null);class sm{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,o){let{type:i,from:s,to:l}=e;if(s>=n||l<=t)return;i.isTop&&(o=this.highlighters.filter(e=>!e.scope||e.scope(i)));let a=r,c=function(e){let t=e.type.prop(sd);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||sf.empty,u=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(o,c.tags);if(u&&(a&&(a+=" "),a+=u,1==c.mode&&(r+=(r?" ":"")+u)),this.startSpan(Math.max(t,s),a),c.opaque)return;let h=e.tree&&e.tree.prop(iH.mounted);if(h&&h.overlay){let i=e.node.enter(h.overlay[0].from+s,1),c=this.highlighters.filter(e=>!e.scope||e.scope(h.tree.type)),u=e.firstChild();for(let d=0,f=s;;d++){let p=d<h.overlay.length?h.overlay[d]:null,m=p?p.from+s:l,g=Math.max(t,f),v=Math.min(n,m);if(g<v&&u)for(;e.from<v&&(this.highlightRange(e,g,v,r,o),this.startSpan(Math.min(v,e.to),a),!(e.to>=m)&&e.nextSibling()););if(!p||m>n)break;(f=p.to+s)>t&&(this.highlightRange(i.cursor(),Math.max(t,p.from+s),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),a))}u&&e.parent()}else if(e.firstChild()){h&&(r="");do{if(e.to<=t)continue;if(e.from>=n)break;this.highlightRange(e,t,n,r,o),this.startSpan(Math.min(n,e.to),a)}while(e.nextSibling());e.parent()}}}let sg=sa.define,sv=sg(),sb=sg(),sy=sg(sb),sw=sg(sb),sx=sg(),sk=sg(sx),sS=sg(sx),sC=sg(),sO=sg(sC),sE=sg(),sP=sg(),sT=sg(),sM=sg(sT),sA=sg(),sR={comment:sv,lineComment:sg(sv),blockComment:sg(sv),docComment:sg(sv),name:sb,variableName:sg(sb),typeName:sy,tagName:sg(sy),propertyName:sw,attributeName:sg(sw),className:sg(sb),labelName:sg(sb),namespace:sg(sb),macroName:sg(sb),literal:sx,string:sk,docString:sg(sk),character:sg(sk),attributeValue:sg(sk),number:sS,integer:sg(sS),float:sg(sS),bool:sg(sx),regexp:sg(sx),escape:sg(sx),color:sg(sx),url:sg(sx),keyword:sE,self:sg(sE),null:sg(sE),atom:sg(sE),unit:sg(sE),modifier:sg(sE),operatorKeyword:sg(sE),controlKeyword:sg(sE),definitionKeyword:sg(sE),moduleKeyword:sg(sE),operator:sP,derefOperator:sg(sP),arithmeticOperator:sg(sP),logicOperator:sg(sP),bitwiseOperator:sg(sP),compareOperator:sg(sP),updateOperator:sg(sP),definitionOperator:sg(sP),typeOperator:sg(sP),controlOperator:sg(sP),punctuation:sT,separator:sg(sT),bracket:sM,angleBracket:sg(sM),squareBracket:sg(sM),paren:sg(sM),brace:sg(sM),content:sC,heading:sO,heading1:sg(sO),heading2:sg(sO),heading3:sg(sO),heading4:sg(sO),heading5:sg(sO),heading6:sg(sO),contentSeparator:sg(sC),list:sg(sC),quote:sg(sC),emphasis:sg(sC),strong:sg(sC),link:sg(sC),monospace:sg(sC),strikethrough:sg(sC),inserted:sg(),deleted:sg(),changed:sg(),invalid:sg(),meta:sA,documentMeta:sg(sA),annotation:sg(sA),processingInstruction:sg(sA),definition:sa.defineModifier("definition"),constant:sa.defineModifier("constant"),function:sa.defineModifier("function"),standard:sa.defineModifier("standard"),local:sa.defineModifier("local"),special:sa.defineModifier("special")};for(let e in sR){let t=sR[e];t instanceof sa&&(t.name=e)}sp([{tag:sR.link,class:"tok-link"},{tag:sR.heading,class:"tok-heading"},{tag:sR.emphasis,class:"tok-emphasis"},{tag:sR.strong,class:"tok-strong"},{tag:sR.keyword,class:"tok-keyword"},{tag:sR.atom,class:"tok-atom"},{tag:sR.bool,class:"tok-bool"},{tag:sR.url,class:"tok-url"},{tag:sR.labelName,class:"tok-labelName"},{tag:sR.inserted,class:"tok-inserted"},{tag:sR.deleted,class:"tok-deleted"},{tag:sR.literal,class:"tok-literal"},{tag:sR.string,class:"tok-string"},{tag:sR.number,class:"tok-number"},{tag:[sR.regexp,sR.escape,sR.special(sR.string)],class:"tok-string2"},{tag:sR.variableName,class:"tok-variableName"},{tag:sR.local(sR.variableName),class:"tok-variableName tok-local"},{tag:sR.definition(sR.variableName),class:"tok-variableName tok-definition"},{tag:sR.special(sR.variableName),class:"tok-variableName2"},{tag:sR.definition(sR.propertyName),class:"tok-propertyName tok-definition"},{tag:sR.typeName,class:"tok-typeName"},{tag:sR.namespace,class:"tok-namespace"},{tag:sR.className,class:"tok-className"},{tag:sR.macroName,class:"tok-macroName"},{tag:sR.propertyName,class:"tok-propertyName"},{tag:sR.operator,class:"tok-operator"},{tag:sR.comment,class:"tok-comment"},{tag:sR.meta,class:"tok-meta"},{tag:sR.invalid,class:"tok-invalid"},{tag:sR.punctuation,class:"tok-punctuation"}]);let s_=new iH,sD=new iH;class sN{constructor(e,t,n=[],r=""){this.data=e,this.name=r,e_.prototype.hasOwnProperty("tree")||Object.defineProperty(e_.prototype,"tree",{get(){return sj(this)}}),this.parser=t,this.extension=[sU.of(this),e_.languageData.of((e,t,n)=>{let r=sL(e,t,n),o=r.type.prop(s_);if(!o)return[];let i=e.facet(o),s=r.type.prop(sD);if(s){let o=r.resolve(t-r.from,n);for(let t of s)if(t.test(o,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(i)}}return i})].concat(n)}isActiveAt(e,t,n=-1){return sL(e,t,n).type.prop(s_)==this.data}findRegions(e){let t=e.facet(sU);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(s_)==this.data){n.push({from:t,to:t+e.length});return}let o=e.prop(iH.mounted);if(o){if(o.tree.prop(s_)==this.data){if(o.overlay)for(let e of o.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(o.overlay){let e=n.length;if(r(o.tree,o.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let o=e.children[n];o instanceof iK&&r(o,e.positions[n]+t)}};return r(sj(e),0),n}get allowsNesting(){return!0}}function sL(e,t,n){let r=e.facet(sU),o=sj(e).topNode;if(!r||r.allowsNesting)for(let e=o;e;e=e.enter(t,n,h.ExcludeBuffers|h.EnterBracketed))e.type.isTop&&(o=e);return o}sN.setState=eC.define();class sI extends sN{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){var t;let n=(t=e.languageData,J.define({combine:t?e=>e.concat(t):void 0}));return new sI(n,e.parser.configure({props:[s_.add(e=>e.isTop?n:void 0)]}),e.name)}configure(e,t){return new sI(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function sj(e){let t=e.field(sN.state,!1);return t?t.tree:iK.empty}class sB{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let sW=null;class sF{constructor(e,t,n=[],r,o,i,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=o,this.viewport=i,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new sF(e,t,[],iK.empty,0,n,[],null)}startParse(){return this.parser.startParse(new sB(this.state.doc),this.fragments)}work(e,t){return(null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=iK.empty&&this.isDone(null!=t?t:this.state.doc.length))?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r){if(this.fragments=this.withoutTempSkipped(so.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=r,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(so.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=sW;sW=this;try{return e()}finally{sW=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=s$(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:o,viewport:i,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,r,o)=>t.push({fromA:e,toA:n,fromB:r,toB:o})),n=so.applyChanges(n,t),r=iK.empty,o=0,i={from:e.mapPos(i.from,-1),to:e.mapPos(i.to,1)},this.skipped.length)for(let t of(s=[],this.skipped)){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);n<r&&s.push({from:n,to:r})}}return new sF(this.parser,t,n,r,o,i,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=s$(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends si{createParse(t,n,r){let o=r[0].from,i=r[r.length-1].to;return{parsedPos:o,advance(){let t=sW;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=i,new iK(iU.none,[],[],i-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return sW}}function s$(e,t,n){return so.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class sz{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new sz(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=sF.create(e.facet(sU).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new sz(n)}}sN.state=eo.define({create:sz.init,update(e,t){for(let e of t.effects)if(e.is(sN.setState))return e.value;return t.startState.facet(sU)!=t.state.facet(sU)?sz.init(t.state):e.apply(t)}});let sH=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(sH=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});let sq="undefined"!=typeof navigator&&(null===(d=navigator.scheduling)||void 0===d?void 0:d.isInputPending)?()=>navigator.scheduling.isInputPending():null,sV=ng.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(sN.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(sN.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=sH(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,o=n.field(sN.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let i=Date.now()+Math.min(this.chunkBudget,100,e&&!sq?Math.max(25,e.timeRemaining()-5):1e9),s=o.context.treeLen<r&&n.doc.length>r+1e3,l=o.context.work(()=>sq&&sq()||Date.now()>i,r+(s?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:sN.setState.of(new sz(o.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>nd(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),sU=J.define({combine:e=>e.length?e[0]:null,enables:e=>[sN.state,sV,oh.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class sG{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}let sX=J.define(),sQ=J.define({combine:e=>{if(!e.length)return"  ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function sK(e){let t=e.facet(sQ);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function sY(e,t){let n="",r=e.tabSize,o=e.facet(sQ)[0];if("	"==o){for(;t>=r;)n+="	",t-=r;o=" "}for(let e=0;e<t;e++)n+=o;return n}function sJ(e,t){for(let n of(e instanceof e_&&(e=new sZ(e)),e.state.facet(sX))){let r=n(e,t);if(void 0!==r)return r}let n=sj(e.state);return n.length>=t?function(e,t,n){let r=t.resolveStack(n),o=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(o!=r.node){let e=[];for(let t=o;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return s1(r,e,n)}(e,n,t):null}class sZ{constructor(e,t={}){this.state=e,this.options=t,this.unit=sK(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:o}=this.options;return null!=r&&r>=n.from&&r<=n.to?o&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),o=this.countColumn(n,e-r),i=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return i>-1&&(o+=i-this.countColumn(n,n.search(/\S|$/))),o}countColumn(e,t=e.length){return eY(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let e=o(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}let s0=new iH;function s1(e,t,n){for(let r=e;r;r=r.next){let e=function(e){let t=e.type.prop(s0);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(iH.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>s3(e,!0,1,void 0,n&&!(e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak)?t.from:void 0)}return null==e.parent?s2:null}(r.node);if(e)return e(s4.create(t,n,r))}return 0}function s2(){return 0}class s4 extends sZ{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new s4(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(function(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return s1(this.context.next,this.base,this.pos)}}function s5({closing:e,align:t=!0,units:n=1}){return r=>s3(r,t,n,e)}function s3(e,t,n,r,o){let i=e.textAfter,s=i.match(/^\s*/)[0].length,l=r&&i.slice(s,s+r.length)==r||o==e.pos+s,a=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let o=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),s=null==o||o<=i.from?i.to:Math.min(i.to,o);for(let e=n.to;;){let o=t.childAfter(e);if(!o||o==r)return null;if(!o.type.isSkipped){if(o.from>=s)return null;let e=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+e}}e=o.to}}(e):null;return a?l?e.column(a.from):e.column(a.to):e.baseIndent+(l?0:e.unit*n)}let s6=J.define(),s9=new iH;function s8(e,t,n){for(let r of e.facet(s6)){let o=r(e,t,n);if(o)return o}return function(e,t,n){let r=sj(e);if(r.length<n)return null;let o=r.resolveStack(n,1),i=null;for(let s=o;s;s=s.next){let o=s.node;if(o.to<=n||o.from>n)continue;if(i&&o.from<t)break;let l=o.type.prop(s9);if(l&&(o.to<r.length-50||r.length==e.doc.length||!function(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}(o))){let r=l(o,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(i=r)}}return i}(e,t,n)}function s7(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}let le=eC.define({map:s7}),lt=eC.define({map:s7});function ln(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}let lr=eo.define({create:()=>tw.none,update(e,t){for(let n of(t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=lo(e,t,n)),e=e.map(t.changes),t.effects))if(n.is(le)&&!function(e,t,n){let r=!1;return e.between(t,t,(e,o)=>{e==t&&o==n&&(r=!0)}),r}(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(lu),o=r?tw.replace({widget:new lp(r(t.state,n.value))}):lf;e=e.update({add:[o.range(n.value.from,n.value.to)]})}else n.is(lt)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=lo(e,t.selection.main.head)),e},provide:e=>oh.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],o=e[n++];if("number"!=typeof r||"number"!=typeof o)throw RangeError("Invalid JSON for fold state");t.push(lf.range(r,o))}return tw.set(t,!0)}});function lo(e,t,n=t){let r=!1;return e.between(t,n,(e,o)=>{e<n&&o>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function li(e,t,n){var r;let o=null;return null===(r=e.field(lr,!1))||void 0===r||r.between(t,n,(e,t)=>{(!o||o.from>e)&&(o={from:e,to:t})}),o}function ls(e,t){return e.field(lr,!1)?t:t.concat(eC.appendConfig.of(lh()))}function ll(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,o=e.state.doc.lineAt(t.to).number;return oh.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${o}.`)}let la=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of ln(e)){let n=s8(e.state,t.from,t.to);if(n)return e.dispatch({effects:ls(e.state,[le.of(n),ll(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(lr,!1))return!1;let t=[];for(let n of ln(e)){let r=li(e.state,n.from,n.to);r&&t.push(lt.of(r),ll(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let o=e.lineBlockAt(r),i=s8(t,o.from,o.to);i&&n.push(le.of(i)),r=(i?e.lineBlockAt(i.to):o).to+1}return n.length&&e.dispatch({effects:ls(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(lr,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(lt.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],lc={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},lu=J.define({combine:e=>eD(e,lc)});function lh(e){let t=[lr,lv];return e&&t.push(lu.of(e)),t}function ld(e,t){let{state:n}=e,r=n.facet(lu),o=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=li(e.state,n.from,n.to);r&&e.dispatch({effects:lt.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,o,t);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=o,i}let lf=tw.replace({widget:new class extends tb{toDOM(e){return ld(e,null)}}});class lp extends tb{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ld(e,this.value)}}let lm={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class lg extends iy{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}let lv=oh.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class lb{constructor(e,t){let n;function r(e){let t=e2.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;let o="string"==typeof t.all?t.all:t.all?r(t.all):void 0,i=t.scope;this.scope=i instanceof sN?e=>e.prop(s_)==i.data:i?e=>e==i:void 0,this.style=sp(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:o}).style,this.module=n?new e2(n):null,this.themeType=t.themeType}static define(e,t){return new lb(e,t||{})}}let ly=J.define(),lw=J.define({combine:e=>e.length?[e[0]]:null});function lx(e){let t=e.facet(ly);return t.length?t:e.facet(lw)}function lk(e,t){let n=[lC],r;return e instanceof lb&&(e.module&&n.push(oh.styleModule.of(e.module)),r=e.themeType),(null==t?void 0:t.fallback)?n.push(lw.of(e)):r?n.push(ly.computeN([oh.darkTheme],t=>t.facet(oh.darkTheme)==("dark"==r)?[e]:[])):n.push(ly.of(e)),n}class lS{constructor(e){this.markCache=Object.create(null),this.tree=sj(e.state),this.decorations=this.buildDeco(e,lx(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=sj(e.state),n=lx(e.state),r=n!=lx(e.startState),{viewport:o}=e.view,i=e.changes.mapPos(this.decoratedTo,1);t.length<o.to&&!r&&t.type==this.tree.type&&i>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=i):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return tw.none;let n=new eF;for(let{from:r,to:o}of e.visibleRanges)!function(e,t,n,r=0,o=e.length){let i=new sm(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,o,"",i.highlighters),i.flush(o)}(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=tw.mark({class:r})))},r,o);return n.finish()}}let lC=el.high(ng.fromClass(lS,{decorations:e=>e.decorations})),lO=lb.define([{tag:sR.meta,color:"#404740"},{tag:sR.link,textDecoration:"underline"},{tag:sR.heading,textDecoration:"underline",fontWeight:"bold"},{tag:sR.emphasis,fontStyle:"italic"},{tag:sR.strong,fontWeight:"bold"},{tag:sR.strikethrough,textDecoration:"line-through"},{tag:sR.keyword,color:"#708"},{tag:[sR.atom,sR.bool,sR.url,sR.contentSeparator,sR.labelName],color:"#219"},{tag:[sR.literal,sR.inserted],color:"#164"},{tag:[sR.string,sR.deleted],color:"#a11"},{tag:[sR.regexp,sR.escape,sR.special(sR.string)],color:"#e40"},{tag:sR.definition(sR.variableName),color:"#00f"},{tag:sR.local(sR.variableName),color:"#30a"},{tag:[sR.typeName,sR.namespace],color:"#085"},{tag:sR.className,color:"#167"},{tag:[sR.special(sR.variableName),sR.macroName],color:"#256"},{tag:sR.definition(sR.propertyName),color:"#00c"},{tag:sR.comment,color:"#940"},{tag:sR.invalid,color:"#f00"}]),lE=oh.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),lP="()[]{}",lT=J.define({combine:e=>eD(e,{afterCursor:!0,brackets:lP,maxScanDistance:1e4,renderMatch:lR})}),lM=tw.mark({class:"cm-matchingBracket"}),lA=tw.mark({class:"cm-nonmatchingBracket"});function lR(e){let t=[],n=e.matched?lM:lA;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}let l_=[eo.define({create:()=>tw.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(lT);for(let e of t.state.selection.ranges){if(!e.empty)continue;let o=lI(t.state,e.head,-1,r)||e.head>0&&lI(t.state,e.head-1,1,r)||r.afterCursor&&(lI(t.state,e.head,1,r)||e.head<t.state.doc.length&&lI(t.state,e.head+1,-1,r));o&&(n=n.concat(r.renderMatch(o,t.state)))}return tw.set(n,!0)},provide:e=>oh.decorations.from(e)}),lE],lD=new iH;function lN(e,t,n){let r=e.prop(t<0?iH.openedBy:iH.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function lL(e){let t=e.type.prop(lD);return t?t(e.node):e}function lI(e,t,n,r={}){let o=r.maxScanDistance||1e4,i=r.brackets||lP,s=sj(e),l=s.resolveInner(t,n);for(let e=l;e;e=e.parent){let r=lN(e.type,n,i);if(r&&e.from<e.to){let o=lL(e);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return function(e,t,n,r,o,i,s){let l=r.parent,a={from:o.from,to:o.to},c=0,u=null==l?void 0:l.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(0==c&&i.indexOf(u.type.name)>-1&&u.from<u.to){let e=lL(u);return{start:a,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(lN(u.type,n,s))c++;else if(lN(u.type,-n,s)){if(0==c){let e=lL(u);return{start:a,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}(0,0,n,e,o,r,i)}}return function(e,t,n,r,o,i,s){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!u.next().done&&e<=i;){let i=u.value;n<0&&(e+=i.length);let l=t+e*n;for(let e=n>0?0:i.length-1,t=n>0?i.length:-1;e!=t;e+=n){let t=s.indexOf(i[e]);if(!(t<0)&&r.resolveInner(l+e,1).type==o){if(t%2==0==n>0)h++;else{if(1==h)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};h--}}}n>0&&(e+=i.length)}return u.done?{start:c,matched:!1}:null}(e,t,n,s,l.type,o,i)}let lj=Object.create(null),lB=[iU.none],lW=[],lF=Object.create(null),l$=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])l$[e]=function(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||sR[n];r?"function"==typeof r?t.length?t=t.map(r):lz(n,`Modifier ${n} used at start of tag`):t.length?lz(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:lz(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),o=r+" "+n.map(e=>e.id),i=lF[o];if(i)return i.id;let s=lF[o]=iU.define({id:lB.length,name:r,props:[sh({[r]:n})]});return lB.push(s),s.id}(lj,t);function lz(e,t){lW.indexOf(e)>-1||(lW.push(e),console.warn(t))}function lH(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(r(n.update(o)),!0)}}tG.RTL,tG.LTR;let lq=lH(function(e,t,n=t.selection.ranges){let r=[],o=-1;for(let{from:e,to:i}of n){let n=r.length,s=1e9,l=lG(t,e).line;if(l){for(let n=e;n<=i;){let a=t.doc.lineAt(n);if(a.from>o&&(e==i||i>a.from)){o=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,n=a.text.slice(e,e+l.length)==l?e:-1;e<a.text.length&&e<s&&(s=e),r.push({line:a,comment:n,token:l,indent:e,empty:t,single:!1})}n=a.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:o,empty:i,single:s}of r)(s||!i)&&e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:o}of r)if(n>=0){let r=t.from+n,i=r+o.length;" "==t.text[i-t.from]&&i++,e.push({from:r,to:i})}return{changes:e}}return null},0),lV=lH(lX,0),lU=lH((e,t)=>lX(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);o.from>r.from&&o.from==n.to&&(o=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=o.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}(t)),0);function lG(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}function lX(e,t,n=t.selection.ranges){let r=n.map(e=>lG(t,e.from).block);if(!r.every(e=>e))return null;let o=n.map((e,n)=>(function(e,{open:t,close:n},r,o){let i,s,l=e.sliceDoc(r-50,r),a=e.sliceDoc(o,o+50),c=/\s*$/.exec(l)[0].length,u=/^\s*/.exec(a)[0].length,h=l.length-c;if(l.slice(h-t.length,h)==t&&a.slice(u,u+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-r<=100?i=s=e.sliceDoc(r,o):(i=e.sliceDoc(r,r+50),s=e.sliceDoc(o-50,o));let d=/^\s*/.exec(i)[0].length,f=/\s*$/.exec(s)[0].length,p=s.length-f-n.length;return i.slice(d,d+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(i.charAt(d+t.length))?1:0},close:{pos:o-f-n.length,margin:/\s/.test(s.charAt(p-1))?1:0}}:null})(t,r[n],e.from,e.to));if(2!=e&&!o.every(e=>e))return{changes:t.changes(n.map((e,t)=>o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&o.some(e=>e)){let e=[];for(let t=0,n;t<o.length;t++)if(n=o[t]){let o=r[t],{open:i,close:s}=n;e.push({from:i.pos-o.open.length,to:i.pos+i.margin},{from:s.pos-s.margin,to:s.pos+o.close.length})}return{changes:e}}return null}let lQ=ex.define(),lK=ex.define(),lY=J.define(),lJ=J.define({combine:e=>eD(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),lZ=eo.define({create:()=>an.empty,update(e,t){let n=t.state.facet(lJ),r=t.annotation(lQ);if(r){let o=l3.fromTransaction(t,r.selection),i=r.side,s=0==i?e.undone:e.done;return s=o?l6(s,s.length,n.minDepth,o):l7(s,t.startState.selection),new an(0==i?r.rest:s,0==i?s:r.rest)}let o=t.annotation(lK);if(("full"==o||"before"==o)&&(e=e.isolate()),!1===t.annotation(eO.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let i=l3.fromTransaction(t),s=t.annotation(eO.time),l=t.annotation(eO.userEvent);return i?e=e.addChanges(i,s,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,l,n.newGroupDelay)),("full"==o||"after"==o)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new an(e.done.map(l3.fromJSON),e.undone.map(l3.fromJSON))});function l0(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(lZ,!1);if(!o)return!1;let i=o.pop(e,n,t);return!!i&&(r(i),!0)}}let l1=l0(0,!1),l2=l0(1,!1),l4=l0(0,!0),l5=l0(1,!0);class l3{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new l3(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new l3(e.changes&&$.fromJSON(e.changes),[],e.mapped&&F.fromJSON(e.mapped),e.startSelection&&Q.fromJSON(e.startSelection),e.selectionsAfter.map(Q.fromJSON))}static fromTransaction(e,t){let n=l8;for(let t of e.startState.facet(lY)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new l3(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,l8)}static selection(e){return new l3(void 0,l8,void 0,void 0,e)}}function l6(e,t,n,r){let o=e.slice(t+1>n+20?t-n-1:0,t);return o.push(r),o}function l9(e,t){return e.length?t.length?e.concat(t):e:t}let l8=[];function l7(e,t){if(!e.length)return[l3.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),l6(e,e.length-1,1e9,n.setSelAfter(r)))}}function ae(e,t){if(!e.length)return e;let n=e.length,r=l8;for(;n;){let o=function(e,t,n){let r=l9(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):l8,n);if(!e.changes)return l3.selection(r);let o=e.changes.map(t),i=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(i):i;return new l3(o,eC.mapEffects(e.effects,t),s,e.startSelection.map(i),r)}(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);return t[n-1]=o,t}t=o.mapped,n--,r=o.selectionsAfter}return r.length?[l3.selection(r)]:l8}let at=/^(input\.type|delete)($|\.)/;class an{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new an(this.done,this.undone):this}addChanges(e,t,n,r,o){var i,s;let l,a,c=this.done,u=c[c.length-1];return new an(c=u&&u.changes&&!u.changes.empty&&e.changes&&(!n||at.test(n))&&(!u.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,(i=u.changes,s=e.changes,l=[],a=!1,i.iterChangedRanges((e,t)=>l.push(e,t)),s.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<l.length;){let t=l[e++],o=l[e++];r>=t&&n<=o&&(a=!0)}}),a))||"input.type.compose"==n)?l6(c,c.length-1,r.minDepth,new l3(e.changes.compose(u.changes),l9(eC.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,l8)):l6(c,c.length,r.minDepth,e),l8,t,n)}addSelection(e,t,n,r){var o;let i=this.done.length?this.done[this.done.length-1].selectionsAfter:l8;return i.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(o=i[i.length-1]).ranges.length==e.ranges.length&&0===o.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length?this:new an(l7(this.done,e),this.undone,t,n)}addMapping(e){return new an(ae(this.done,e),ae(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let o=r[r.length-1],i=o.selectionsAfter[0]||t.selection;if(n&&o.selectionsAfter.length){let n,s;return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:lQ.of({side:e,rest:(n=r[r.length-1],(s=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),s),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}if(!o.changes)return null;{let n=1==r.length?l8:r.slice(0,r.length-1);return o.mapped&&(n=ae(n,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:lQ.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}an.empty=new an(l8,l8);let ar=[{key:"Mod-z",run:l1,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:l2,preventDefault:!0},{linux:"Ctrl-Shift-z",run:l2,preventDefault:!0},{key:"Mod-u",run:l4,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:l5,preventDefault:!0}];function ao(e,t){return Q.create(e.ranges.map(t),e.mainIndex)}function ai(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function as({state:e,dispatch:t},n){let r=ao(e.selection,n);return!r.eq(e.selection,!0)&&(t(ai(e,r)),!0)}function al(e,t){return Q.cursor(t?e.to:e.from)}function aa(e,t){return as(e,n=>n.empty?e.moveByChar(n,t):al(n,t))}function ac(e){return e.textDirectionAt(e.state.selection.main.head)==tG.LTR}let au=e=>aa(e,!ac(e)),ah=e=>aa(e,ac(e));function ad(e,t){return as(e,n=>n.empty?e.moveByGroup(n,t):al(n,t))}function af(e,t,n){let r,o,i=sj(e).resolveInner(t.head),s=n?iH.closedBy:iH.openedBy;for(let r=t.head;;){let t=n?i.childAfter(r):i.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,s)?r=n?t.to:t.from:i=t}return o=i.type.prop(s)&&(r=n?lI(e,i.from,1):lI(e,i.to,-1))&&r.matched?n?r.end.to:r.end.from:n?i.to:i.from,Q.cursor(o,n?-1:1)}function ap(e,t){return as(e,n=>{if(!n.empty)return al(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;let am=e=>ap(e,!1),ag=e=>ap(e,!0);function av(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,o;if(t){for(let t of e.state.facet(oh.scrollMargins)){let o=t(e);(null==o?void 0:o.top)&&(n=Math.max(null==o?void 0:o.top,n)),(null==o?void 0:o.bottom)&&(r=Math.max(null==o?void 0:o.bottom,r))}o=e.scrollDOM.clientHeight-n-r}else o=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,o-5)}}function ab(e,t){let n,r=av(e),{state:o}=e,i=ao(o.selection,n=>n.empty?e.moveVertically(n,t,r.height):al(n,t));if(i.eq(o.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(o.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),l=s.top+r.marginTop,a=s.bottom-r.marginBottom;t&&t.top>l&&t.bottom<a&&(n=oh.scrollIntoView(i.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(ai(o,i),{effects:n}),!0}let ay=e=>ab(e,!1),aw=e=>ab(e,!0);function ax(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from)&&(o=e.moveToLineBoundary(t,n,!1)),!n&&o.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(o=Q.cursor(r.from+n))}return o}function ak(e,t){let n=ao(e.state.selection,e=>{let n=t(e);return Q.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(ai(e.state,n)),!0)}function aS(e,t){return ak(e,n=>e.moveByChar(n,t))}let aC=e=>aS(e,!ac(e)),aO=e=>aS(e,ac(e));function aE(e,t){return ak(e,n=>e.moveByGroup(n,t))}function aP(e,t){return ak(e,n=>e.moveVertically(n,t))}let aT=e=>aP(e,!1),aM=e=>aP(e,!0);function aA(e,t){return ak(e,n=>e.moveVertically(n,t,av(e).height))}let aR=e=>aA(e,!1),a_=e=>aA(e,!0),aD=({state:e,dispatch:t})=>(t(ai(e,{anchor:0})),!0),aN=({state:e,dispatch:t})=>(t(ai(e,{anchor:e.doc.length})),!0),aL=({state:e,dispatch:t})=>(t(ai(e,{anchor:e.selection.main.anchor,head:0})),!0),aI=({state:e,dispatch:t})=>(t(ai(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function aj(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head);if(t?i.to<e.state.doc.length:i.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<i.from||r.head>i.to){o.some(e=>e.head==r.head)||o.push(r);break}if(r.head==n.head)break;n=r}}return o.length!=r.ranges.length&&(e.dispatch(ai(n,Q.create(o,o.length-1))),!0)}function aB(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange(r=>{let{from:o,to:i}=r;if(o==i){let s=t(r);s<o?(n="delete.backward",s=aW(e,s,!1)):s>o&&(n="delete.forward",s=aW(e,s,!0)),o=Math.min(o,s),i=Math.max(i,s)}else o=aW(e,o,!1),i=aW(e,i,!0);return o==i?{range:r}:{changes:{from:o,to:i},range:Q.cursor(o,o<r.head?-1:1)}});return!o.changes.empty&&(e.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?oh.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function aW(e,t,n){if(e instanceof oh)for(let r of e.state.facet(oh.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let aF=(e,t,n)=>aB(e,r=>{let o=r.from,{state:i}=e,s=i.doc.lineAt(o),l,a;if(n&&!t&&o>s.from&&o<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,o-s.from))){if("	"==l[l.length-1])return o-1;let e=eY(l,i.tabSize)%sK(i)||sK(i);for(let t=0;t<e&&" "==l[l.length-1-t];t++)o--;a=o}else(a=N(s.text,o-s.from,t,t)+s.from)==o&&s.number!=(t?i.doc.lines:1)?a+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,o-s.from))&&(a=N(s.text,a-s.from,!1,!1)+s.from);return a}),a$=e=>aF(e,!1,!0),az=e=>aF(e,!0,!1),aH=(e,t)=>aB(e,n=>{let r=n.head,{state:o}=e,i=o.doc.lineAt(r),s=o.charCategorizer(r);for(let e=null;;){if(r==(t?i.to:i.from)){r==n.head&&i.number!=(t?o.doc.lines:1)&&(r+=t?1:-1);break}let l=N(i.text,r-i.from,t)+i.from,a=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),c=s(a);if(null!=e&&c!=e)break;(" "!=a||r!=n.head)&&(e=c),r=l}return r}),aq=e=>aH(e,!1);function aV(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(r.empty||r.to!=i.from||(i=e.doc.lineAt(r.to-1)),n>=o.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(r)}else t.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return t}function aU(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let t of aV(e)){if(n?t.to==e.doc.length:0==t.from)continue;let i=e.doc.lineAt(n?t.to+1:t.from-1),s=i.length+1;if(n)for(let n of(r.push({from:t.to,to:i.to},{from:t.from,insert:i.text+e.lineBreak}),t.ranges))o.push(Q.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)));else for(let n of(r.push({from:i.from,to:t.from},{from:t.to,insert:e.lineBreak+i.text}),t.ranges))o.push(Q.range(n.anchor-s,n.head-s))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:Q.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0)}function aG(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of aV(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}let aX=aK(!1),aQ=aK(!0);function aK(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:o}=n,i=t.doc.lineAt(r),s=!e&&r==o&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=sj(e).resolveInner(t),r=n.childBefore(t),o=n.childAfter(t),i;return r&&o&&r.to<=t&&o.from>=t&&(i=r.type.prop(iH.closedBy))&&i.indexOf(o.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(r.to,o.from))?{from:r.to,to:o.from}:null}(t,r);e&&(r=o=(o<=i.to?i:t.doc.lineAt(o)).to);let l=new sZ(t,{simulateBreak:r,simulateDoubleBreak:!!s}),a=sJ(l,r);for(null==a&&(a=eY(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));o<i.to&&/\s/.test(i.text[o-i.from]);)o++;s?{from:r,to:o}=s:r>i.from&&r<i.from+100&&!/\S/.test(i.text.slice(0,r))&&(r=i.from);let c=["",sY(t,a)];return s&&c.push(sY(t,l.lineIndent(i.from,-1))),{changes:{from:r,to:o,insert:O.of(c)},range:Q.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function aY(e,t){let n=-1;return e.changeByRange(r=>{let o=[];for(let i=r.from;i<=r.to;){let s=e.doc.lineAt(i);s.number>n&&(r.empty||r.to>s.from)&&(t(s,o,r),n=s.number),i=s.to+1}let i=e.changes(o);return{changes:o,range:Q.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}let aJ=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(aY(e,(t,n)=>{n.push({from:t.from,insert:e.facet(sQ)})}),{userEvent:"input.indent"})),!0),aZ=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(aY(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let o=eY(r,e.tabSize),i=0,s=sY(e,Math.max(0,o-sK(e)));for(;i<r.length&&i<s.length&&r.charCodeAt(i)==s.charCodeAt(i);)i++;n.push({from:t.from+i,to:t.from+r.length,insert:s.slice(i)})}),{userEvent:"delete.dedent"})),!0),a0=[{key:"Ctrl-b",run:au,shift:aC,preventDefault:!0},{key:"Ctrl-f",run:ah,shift:aO},{key:"Ctrl-p",run:am,shift:aT},{key:"Ctrl-n",run:ag,shift:aM},{key:"Ctrl-a",run:e=>as(e,t=>Q.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>ak(e,t=>Q.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>as(e,t=>Q.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>ak(e,t=>Q.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:az},{key:"Ctrl-h",run:a$},{key:"Ctrl-k",run:e=>aB(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:aq},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:O.of(["",""])},range:Q.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),o=n==r.from?n-1:N(r.text,n-r.from,!1)+r.from,i=n==r.to?n+1:N(r.text,n-r.from,!0)+r.from;return{changes:{from:o,to:i,insert:e.doc.slice(n,i).append(e.doc.slice(o,n))},range:Q.cursor(i)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:aw}],a1=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>as(e,t=>af(e.state,t,!ac(e))),shift:e=>ak(e,t=>af(e.state,t,!ac(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>as(e,t=>af(e.state,t,ac(e))),shift:e=>ak(e,t=>af(e.state,t,ac(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>aU(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>aG(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>aU(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>aG(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>aj(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>aj(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Q.create([n.main]):n.main.empty||(r=Q.create([Q.cursor(n.main.head)])),!!r&&(t(ai(e,r)),!0)}},{key:"Mod-Enter",run:aQ},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=aV(e).map(({from:t,to:n})=>Q.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Q.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=ao(e.selection,t=>{let n=sj(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Q.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(ai(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:aZ},{key:"Mod-]",run:aJ},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new sZ(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=aY(e,(t,o,i)=>{let s=sJ(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let l=/^\s*/.exec(t.text)[0],a=sY(e,s);(l!=a||i.from<t.from+l.length)&&(n[t.from]=s,o.push({from:t.from,to:t.from+l.length,insert:a}))});return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(aV(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=ao(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),o=e.coordsAtPos(t.head,t.assoc||1);o&&(n=r.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let n,r;return n=!1,r=ao(e.selection,t=>{let r=lI(e,t.head,-1)||lI(e,t.head,1)||t.head>0&&lI(e,t.head-1,1)||t.head<e.doc.length&&lI(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let o=r.start.from==t.head?r.end.to:r.end.from;return Q.cursor(o)}),!!n&&(t(ai(e,r)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=lG(e.state,n.from);return r.line?lq(e):!!r.block&&lU(e)}},{key:"Alt-A",run:lV},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:au,shift:aC,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>ad(e,!ac(e)),shift:e=>aE(e,!ac(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>as(e,t=>ax(e,t,!ac(e))),shift:e=>ak(e,t=>ax(e,t,!ac(e))),preventDefault:!0},{key:"ArrowRight",run:ah,shift:aO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>ad(e,ac(e)),shift:e=>aE(e,ac(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>as(e,t=>ax(e,t,ac(e))),shift:e=>ak(e,t=>ax(e,t,ac(e))),preventDefault:!0},{key:"ArrowUp",run:am,shift:aT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:aD,shift:aL},{mac:"Ctrl-ArrowUp",run:ay,shift:aR},{key:"ArrowDown",run:ag,shift:aM,preventDefault:!0},{mac:"Cmd-ArrowDown",run:aN,shift:aI},{mac:"Ctrl-ArrowDown",run:aw,shift:a_},{key:"PageUp",run:ay,shift:aR},{key:"PageDown",run:aw,shift:a_},{key:"Home",run:e=>as(e,t=>ax(e,t,!1)),shift:e=>ak(e,t=>ax(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:aD,shift:aL},{key:"End",run:e=>as(e,t=>ax(e,t,!0)),shift:e=>ak(e,t=>ax(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:aN,shift:aI},{key:"Enter",run:aX,shift:aX},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:a$,shift:a$,preventDefault:!0},{key:"Delete",run:az,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:aq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>aH(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>aB(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>aB(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(a0.map(e=>({mac:e.key,run:e.run,shift:e.shift})))),a2={key:"Tab",run:aJ,shift:aZ},a4="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class a5{constructor(e,t,n=0,r=e.length,o,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?e=>o(a4(e)):a4,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return L(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=I(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=j(e);let r=this.normalize(t);if(r.length)for(let e=0,o=n;;e++){let i=r.charCodeAt(e),s=this.match(i,o,this.bufferPos+this.bufferStart);if(e==r.length-1){if(s)return this.value=s,this;break}o==n&&e<t.length&&t.charCodeAt(e)==i&&o++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let o=this.matches[t],i=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,i=!0)),i||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}"undefined"!=typeof Symbol&&(a5.prototype[Symbol.iterator]=function(){return this});let a3={from:-1,to:-1,match:/.*/.exec("")},a6="gm"+(null==/x/.unicode?"":"u");class a9{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=a3,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new ce(e,t,n,r,o);this.re=new RegExp(t,a6+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let i=e.lineAt(r);this.curLineStart=i.from,this.matchPos=ct(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=ct(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let a8=new WeakMap;class a7{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=a8.get(e);if(!r||r.from>=n||r.to<=t){let r=new a7(t,e.sliceString(t,n));return a8.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:o,from:i}=r;return i>t&&(o=e.sliceString(t,i)+o,i=t),r.to<n&&(o+=e.sliceString(r.to,n)),a8.set(e,new a7(i,o)),new a7(t,o.slice(t-i,n-i))}}class ce{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=a3,this.matchPos=ct(e,r),this.re=new RegExp(t,a6+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=a7.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=ct(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=a7.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function ct(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}"undefined"!=typeof Symbol&&(a9.prototype[Symbol.iterator]=ce.prototype[Symbol.iterator]=function(){return this});let cn={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},cr=J.define({combine:e=>eD(e,cn,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),co=tw.mark({class:"cm-selectionMatch"}),ci=tw.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function cs(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=eA.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=eA.Word)}let cl=ng.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(cr),{state:n}=e,r=n.selection;if(r.ranges.length>1)return tw.none;let o=r.main,i,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return tw.none;let e=n.wordAt(o.head);if(!e)return tw.none;s=n.charCategorizer(o.head),i=n.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e<t.minSelectionLength||e>200)return tw.none;if(t.wholeWords){var l,a,c;if(i=n.sliceDoc(o.from,o.to),!(cs(s=n.charCategorizer(o.head),n,o.from,o.to)&&(l=s,a=o.from,c=o.to,l(n.sliceDoc(a,a+1))==eA.Word&&l(n.sliceDoc(c-1,c))==eA.Word)))return tw.none}else if(!(i=n.sliceDoc(o.from,o.to)))return tw.none}let u=[];for(let r of e.visibleRanges){let e=new a5(n.doc,i,r.from,r.to);for(;!e.next().done;){let{from:r,to:i}=e.value;if((!s||cs(s,n,r,i))&&(o.empty&&r<=o.from&&i>=o.to?u.push(ci.range(r,i)):(r>=o.to||i<=o.from)&&u.push(co.range(r,i)),u.length>t.maxMatches))return tw.none}}return tw.set(u)}},{decorations:e=>e.decorations}),ca=oh.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),cc=({state:e,dispatch:t})=>{let{selection:n}=e,r=Q.create(n.ranges.map(t=>e.wordAt(t.head)||Q.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)},cu=J.define({combine:e=>eD(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new cW(e),scrollToMatch:e=>oh.scrollIntoView(e)})});class ch{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,a6),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new cb(this):new cp(this)}getCursor(e,t=0,n){let r=e.doc?e:e_.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?cm(this,r,t,n):cf(this,r,t,n)}}class cd{constructor(e){this.spec=e}}function cf(e,t,n,r){var o,i,s,l;let a;return e.wholeWord&&(o=t.doc,i=t.charCategorizer(t.selection.main.head),a=(e,t,n,r)=>((r>e||r+n.length<t)&&(r=Math.max(0,e-2),n=o.sliceString(r,Math.min(o.length,t+2))),(i(cg(n,e-r))!=eA.Word||i(cv(n,e-r))!=eA.Word)&&(i(cv(n,t-r))!=eA.Word||i(cg(n,t-r))!=eA.Word))),e.test&&(s=e.test,l=a,a=(e,n,r,o)=>(!l||!!l(e,n,r,o))&&s(e>=o&&n<=o+r.length?r.slice(e-o,n-o):t.doc.sliceString(e,n),t,e,n)),new a5(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),a)}class cp extends cd{constructor(e){super(e)}nextMatch(e,t,n){let r=cf(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=cf(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),o=cf(this.spec,e,n,r),i=null;for(;!o.nextOverlapping().done;)i=o.value;if(i)return i;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=cf(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=cf(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}function cm(e,t,n,r){var o,i,s;let l;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),l=(e,t,n)=>!n[0].length||(o(cg(n.input,n.index))!=eA.Word||o(cv(n.input,n.index))!=eA.Word)&&(o(cv(n.input,n.index+n[0].length))!=eA.Word||o(cg(n.input,n.index+n[0].length))!=eA.Word)),e.test&&(i=e.test,s=l,l=(e,n,r)=>(!s||s(e,n,r))&&i(r[0],t,e,n)),new a9(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:l},n,r)}function cg(e,t){return e.slice(N(e,t,!1),t)}function cv(e,t){return e.slice(t,N(e,t))}class cb extends cd{nextMatch(e,t,n){let r=cm(this.spec,e,n,e.doc.length).next();return r.done&&(r=cm(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let o=Math.max(t,n-1e4*r),i=cm(this.spec,e,o,n),s=null;for(;!i.next().done;)s=i.value;if(s&&(o==t||s.from>o+10))return s;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=cm(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=cm(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}let cy=eC.define(),cw=eC.define(),cx=eo.define({create:e=>new ck(cD(e).create(),null),update(e,t){for(let n of t.effects)n.is(cy)?e=new ck(n.value.create(),e.panel):n.is(cw)&&(e=new ck(e.query,n.value?c_:null));return e},provide:e=>im.from(e,e=>e.panel)});class ck{constructor(e,t){this.query=e,this.panel=t}}let cS=tw.mark({class:"cm-searchMatch"}),cC=tw.mark({class:"cm-searchMatch cm-searchMatch-selected"}),cO=ng.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(cx))}update(e){let t=e.state.field(cx);(t!=e.startState.field(cx)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return tw.none;let{view:n}=this,r=new eF;for(let t=0,o=n.visibleRanges,i=o.length;t<i;t++){let{from:s,to:l}=o[t];for(;t<i-1&&l>o[t+1].from-500;)l=o[++t].to;e.highlight(n.state,s,l,(e,t)=>{let o=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,o?cC:cS)})}return r.finish()}},{decorations:e=>e.decorations});function cE(e){return t=>{let n=t.state.field(cx,!1);return n&&n.query.spec.valid?e(t,n):cI(t)}}let cP=cE((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let o=Q.single(r.from,r.to),i=e.state.facet(cu);return e.dispatch({selection:o,effects:[cz(e,r),i.scrollToMatch(o.main,e)],userEvent:"select.search"}),cL(e),!0}),cT=cE((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,o=t.prevMatch(n,r,r);if(!o)return!1;let i=Q.single(o.from,o.to),s=e.state.facet(cu);return e.dispatch({selection:i,effects:[cz(e,o),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),cL(e),!0}),cM=cE((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:Q.create(n.map(e=>Q.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),cA=cE((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let i=t.nextMatch(n,r,r);if(!i)return!1;let s=i,l=[],a,c,u=[];s.from==r&&s.to==o&&(c=n.toText(t.getReplacement(s)),l.push({from:s.from,to:s.to,insert:c}),s=t.nextMatch(n,s.from,s.to),u.push(oh.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let h=e.state.changes(l);return s&&(a=Q.single(s.from,s.to).map(h),u.push(cz(e,s)),u.push(n.facet(cu).scrollToMatch(a.main,e))),e.dispatch({changes:h,selection:a,effects:u,userEvent:"input.replace"}),!0}),cR=cE((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:oh.announce.of(r),userEvent:"input.replace.all"}),!0});function c_(e){return e.state.facet(cu).createPanel(e)}function cD(e,t){var n,r,o,i,s;let l=e.selection.main,a=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!a)return t;let c=e.facet(cu);return new ch({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:c.caseSensitive,literal:null!==(o=null==t?void 0:t.literal)&&void 0!==o?o:c.literal,regexp:null!==(i=null==t?void 0:t.regexp)&&void 0!==i?i:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function cN(e){let t=iu(e,c_);return t&&t.dom.querySelector("[main-field]")}function cL(e){let t=cN(e);t&&t==e.root.activeElement&&t.select()}let cI=e=>{let t=e.state.field(cx,!1);if(t&&t.panel){let n=cN(e);if(n&&n!=e.root.activeElement){let r=cD(e.state,t.query.spec);r.valid&&e.dispatch({effects:cy.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[cw.of(!0),t?cy.of(cD(e.state,t.query.spec)):eC.appendConfig.of(cq)]});return!0},cj=e=>{let t=e.state.field(cx,!1);if(!t||!t.panel)return!1;let n=iu(e,c_);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:cw.of(!1)}),!0},cB=[{key:"Mod-f",run:cI,scope:"editor search-panel"},{key:"F3",run:cP,shift:cT,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:cP,shift:cT,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:cj,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,i=[],s=0;for(let t=new a5(e.doc,e.sliceDoc(r,o));!t.next().done;){if(i.length>1e3)return!1;t.value.from==r&&(s=i.length),i.push(Q.range(t.value.from,t.value.to))}return t(e.update({selection:Q.create(i,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{var t;let n,r,o,i,{state:s}=e,l=String(s.doc.lineAt(e.state.selection.main.head).number),{close:a,result:c}=(t={label:s.phrase("Go to line"),input:{type:"text",name:"line",value:l},focus:!0,submitLabel:s.phrase("go")},r=new Promise(e=>n=e),o=e=>(function(e,t,n){let r=t.content?t.content(e,()=>s(null)):null;if(!r){if(r=tt("form"),t.input){let e=tt("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||(e.name="input"),r.appendChild(tt("label",(t.label||"")+": ",e))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(tt("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let o="FORM"==r.nodeName?[r]:r.querySelectorAll("form");for(let e=0;e<o.length;e++){let t=o[e];t.addEventListener("keydown",e=>{27==e.keyCode?(e.preventDefault(),s(null)):13==e.keyCode&&(e.preventDefault(),s(t))}),t.addEventListener("submit",e=>{e.preventDefault(),s(t)})}let i=tt("div",r,tt("button",{onclick:()=>s(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["\xd7"]));function s(t){i.contains(i.ownerDocument.activeElement)&&e.focus(),n(t)}return t.class&&(i.className=t.class),i.classList.add("cm-dialog"),{dom:i,top:t.top,mount:()=>{if(t.focus){let e;(e="string"==typeof t.focus?r.querySelector(t.focus):r.querySelector("input")||r.querySelector("button"))&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}})(e,t,n),e.state.field(ig,!1)?e.dispatch({effects:iv.of(o)}):e.dispatch({effects:eC.appendConfig.of(ig.init(()=>[o]))}),{close:i=ib.of(o),result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(ig).indexOf(o)>-1&&e.dispatch({effects:i})}),t))});return c.then(t=>{let n=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!n){e.dispatch({effects:a});return}let r=s.doc.lineAt(s.selection.main.head),[,o,i,l,c]=n,u=l?+l.slice(1):0,h=i?+i:r.number;if(i&&c){let e=h/100;o&&(e=e*("-"==o?-1:1)+r.number/s.doc.lines),h=Math.round(s.doc.lines*e)}else i&&o&&(h=h*("-"==o?-1:1)+r.number);let d=s.doc.line(Math.max(1,Math.min(s.doc.lines,h))),f=Q.cursor(d.from+Math.max(0,Math.min(u,d.length)));e.dispatch({effects:[a,oh.scrollIntoView(f.from,{y:"center"})],selection:f})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return cc({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let o=function(e,t){let{main:n,ranges:r}=e.selection,o=e.wordAt(n.head),i=o&&o.from==n.from&&o.to==n.to;for(let n=!1,o=new a5(e.doc,t,r[r.length-1].to);;)if(o.next(),o.done){if(n)return null;o=new a5(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==o.value.from))continue;if(i){let t=e.wordAt(o.value.from);if(!t||t.from!=o.value.from||t.to!=o.value.to)continue}return o.value}}(e,r);return!!o&&(t(e.update({selection:e.selection.addRange(Q.range(o.from,o.to),!1),effects:oh.scrollIntoView(o.to)})),!0)},preventDefault:!0}];class cW{constructor(e){this.view=e;let t=this.query=e.state.field(cx).query.spec;function n(e,t,n){return tt("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=tt("input",{value:t.search,placeholder:cF(e,"Find"),"aria-label":cF(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=tt("input",{value:t.replace,placeholder:cF(e,"Replace"),"aria-label":cF(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=tt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=tt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=tt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=tt("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>cP(e),[cF(e,"next")]),n("prev",()=>cT(e),[cF(e,"previous")]),n("select",()=>cM(e),[cF(e,"all")]),tt("label",null,[this.caseField,cF(e,"match case")]),tt("label",null,[this.reField,cF(e,"regexp")]),tt("label",null,[this.wordField,cF(e,"by word")]),...e.state.readOnly?[]:[tt("br"),this.replaceField,n("replace",()=>cA(e),[cF(e,"replace")]),n("replaceAll",()=>cR(e),[cF(e,"replace all")])],tt("button",{name:"close",onclick:()=>cj(e),"aria-label":cF(e,"close"),type:"button"},["\xd7"])])}commit(){let e=new ch({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:cy.of(e)}))}keydown(e){var t,n;(t=this.view,n="search-panel",oC(ox(t.state),e,t,n))?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?cT:cP)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),cA(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(cy)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(cu).top}}function cF(e,t){return e.state.phrase(t)}let c$=/[\s\.,:;?!]/;function cz(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,i=Math.max(r.from,t-30),s=Math.min(o,n+30),l=e.state.sliceDoc(i,s);if(i!=r.from){for(let e=0;e<30;e++)if(!c$.test(l[e+1])&&c$.test(l[e])){l=l.slice(e);break}}if(s!=o){for(let e=l.length-1;e>l.length-30;e--)if(!c$.test(l[e-1])&&c$.test(l[e])){l=l.slice(0,e);break}}return oh.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}let cH=oh.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),cq=[cx,el.low(cO),cH];class cV{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=sj(this.state).resolveInner(this.pos,-1);for(;t&&0>e.indexOf(t.name);)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),o=r.search(cQ(e,!1));return o<0?null:{from:n+o,to:this.pos,text:r.slice(o)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function cU(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class cG{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function cX(e){return e.selection.main.from}function cQ(e,t){var n;let{source:r}=e,o=t&&"^"!=r[0],i="$"!=r[r.length-1];return o||i?RegExp(`${o?"^":""}(?:${r})${i?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}let cK=ex.define(),cY=new WeakMap;function cJ(e){if(!Array.isArray(e))return e;let t=cY.get(e);return t||cY.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=cU(t)+cU(n)+"*$";return[RegExp("^"+r),new RegExp(r)]}(t);return e=>{let o=e.matchBefore(r);return o||e.explicit?{from:o?o.from:e.pos,options:t,validFor:n}:null}}(e)),t}let cZ=eC.define(),c0=eC.define();class c1{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=L(e,t),r=j(n);this.chars.push(n);let o=e.slice(t,t+r),i=o.toUpperCase();this.folded.push(L(i==o?o.toLowerCase():i,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:o,byWord:i}=this;if(1==t.length){let r=L(e,0),o=j(r),i=o==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;i+=-200}return this.ret(i,[0,o])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(s<0){for(let o=0,i=Math.min(e.length,200);o<i&&a<l;){let i=L(e,o);(i==t[a]||i==n[a])&&(r[a++]=o),o+=j(i)}if(a<l)return null}let c=0,u=0,h=!1,d=0,f=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,a=Math.min(e.length,200),v=0;r<a&&u<l;){let a=L(e,r);s<0&&(c<l&&a==t[c]&&(o[c++]=r),d<l&&(a==t[d]||a==n[d]?(0==d&&(f=r),p=r+1,d++):d=0));let b,y=a<255?a>=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(b=I(a))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!r||1==y&&m||0==v&&0!=y)&&(t[u]==a||n[u]==a&&(h=!0)?i[u++]=r:i.length&&(g=!1)),v=y,r+=j(a)}return u==l&&0==i[0]&&g?this.result(-100+(h?-200:0),i,e):d==l&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==l?this.ret(-900-e.length,[f,p]):u==l?this.result(-100+(h?-200:0)+-700+(g?0:-1100),i,e):2==t.length?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],o=0;for(let e of t){let t=e+(this.astral?j(L(n,e)):1);o&&r[o-1]==e?r[o-1]=t:(r[o++]=e,r[o++]=t)}return this.ret(e-n.length,r)}}class c2{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}let c4=J.define({combine:e=>eD(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:c3,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>c5(e(n),t(n)),optionClass:(e,t)=>n=>c5(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function c5(e,t){return e?t?e+" "+t:e:t}function c3(e,t,n,r,o,i){let s=e.textDirection==tG.RTL,l=s,a=!1,c="top",u,h,d=t.left-o.left,f=o.right-t.right,p=r.right-r.left,m=r.bottom-r.top;if(l&&d<Math.min(p,f)?l=!1:!l&&f<Math.min(p,d)&&(l=!0),p<=(l?d:f))u=Math.max(o.top,Math.min(n.top,o.bottom-m))-t.top,h=Math.min(400,l?d:f);else{a=!0,h=Math.min(400,(s?t.right:o.right-t.left)-30);let e=o.bottom-t.bottom;e>=m||e>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let g=(t.bottom-t.top)/i.offsetHeight,v=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${u/g}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(a?s?"left-narrow":"right-narrow":l?"left":"right")}}function c6(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class c9{constructor(e,t,n){let r;this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let o=e.state.field(t),{options:i,selected:s}=o.open,l=e.state.facet(c4);this.optionContent=(r=l.addToOptions.slice(),l.icons&&r.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),r.push({render(e,t,n,r){let o=document.createElement("span");o.className="cm-completionLabel";let i=e.displayLabel||e.label,s=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>s&&o.appendChild(document.createTextNode(i.slice(s,t)));let l=o.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(i.slice(t,n))),l.className="cm-completionMatchedText",s=n}return s<i.length&&o.appendChild(document.createTextNode(i.slice(s))),o},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),r.sort((e,t)=>e.position-t.position).map(e=>e.render)),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=c6(i.length,s,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,o;t&&t!=this.dom;t=t.parentNode)if("LI"==t.nodeName&&(o=/-(\d+)$/.exec(t.id))&&+o[1]<r.length){this.applyCompletion(e,r[+o[1]]),n.preventDefault();return}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(c4).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:c0.of(null)})}),this.showOptions(i,o.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:o,selected:i,disabled:s}=n.open;r.open&&r.open.options==o||(this.range=c6(o.length,i,e.state.facet(c4).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),s!=(null===(t=r.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=c6(t.options.length,t.selected,this.view.state.facet(c4).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:o}=r;if(!o)return;let i="string"==typeof o?document.createTextNode(o):o(r);if(!i)return;"then"in i?i.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>nd(this.view.state,e,"completion info")):(this.addInfoPane(i,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){var t,n;let r,o,i,s=null;for(let t=this.list.firstChild,n=this.range.from;t;t=t.nextSibling,n++)"LI"==t.nodeName&&t.id?n==e?t.hasAttribute("aria-selected")||(t.setAttribute("aria-selected","true"),s=t):t.hasAttribute("aria-selected")&&(t.removeAttribute("aria-selected"),t.removeAttribute("aria-describedby")):n--;return s&&(t=this.list,n=s,r=t.getBoundingClientRect(),o=n.getBoundingClientRect(),i=r.height/t.offsetHeight,o.top<r.top?t.scrollTop-=(r.top-o.top)/i:o.bottom>r.bottom&&(t.scrollTop+=(o.bottom-r.bottom)/i)),s}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),o=this.space;if(!o){let e=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(o.bottom,t.bottom)-10||r.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(c4).positionInfo(this.view,t,r,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){let r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",e=>{e.target==r&&e.preventDefault()});let o=null;for(let i=n.from;i<n.to;i++){let{completion:s,match:l}=e[i],{section:a}=s;if(a){let e="string"==typeof a?a:a.name;e!=o&&(i>n.from||0==n.from)&&(o=e,"string"!=typeof a&&a.header?r.appendChild(a.header(a)):r.appendChild(document.createElement("completion-section")).textContent=e)}let c=r.appendChild(document.createElement("li"));c.id=t+"-"+i,c.setAttribute("role","option");let u=this.optionClass(s);for(let e of(u&&(c.className=u),this.optionContent)){let t=e(s,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function c8(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class c7{constructor(e,t,n,r,o,i){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=o,this.disabled=i}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new c7(this.options,ur(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,o,i){if(r&&!i&&e.some(e=>e.isPending))return r.setDisabled();let s=function(e,t){let n=[],r=null,o=null,i=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(c4);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)i(new cG(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),l,a=s.filterStrict?new c2(n):new c1(n);for(let t of r.result.options)if(l=a.match(t.label)){let n=t.displayLabel?e?e(t,l.matched):[]:l.matched,s=l.score+(t.boost||0);if(i(new cG(t,r.source,n,s)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;o||(o=Object.create(null)),o[e]=Math.max(s,o[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0;for(let n of r.sort((e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?o[t.name]-o[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1)))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let l=[],a=null,c=s.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;a&&a.label==t.label&&a.detail==t.detail&&(null==a.type||null==t.type||a.type==t.type)&&a.apply==t.apply&&a.boost==t.boost?c8(e.completion)>c8(a)&&(l[l.length-1]=e):l.push(e),a=e.completion}return l}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let l=t.facet(c4).selectOnOpen?0:-1;if(r&&r.selected!=l&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){l=t;break}}return new c7(s,ur(n,l),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:ud,above:o.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(e){return new c7(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new c7(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ue{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new ue(uo,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(c4),r=(n.override||t.languageDataAt("autocomplete",cX(t)).map(cJ)).map(t=>(this.active.find(e=>e.source==t)||new us(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let o=this.open,i=e.effects.some(e=>e.is(ua));for(let s of(o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let o=n==e.length,i=r==t.length;if(o||i)return o==i;if(e[n++].result!=t[r++].result)return!1}}(r,this.active)||i?o=c7.build(r,t,this.id,o,n,i):o&&o.disabled&&!r.some(e=>e.isPending)&&(o=null),!o&&r.every(e=>!e.isPending)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new us(e.source,0):e)),e.effects))s.is(uc)&&(o=o&&o.setSelected(s.value,this.id));return r==this.active&&o==this.open?this:new ue(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ut:un}}let ut={"aria-autocomplete":"list"},un={};function ur(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}let uo=[];function ui(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(cK);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class us{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=ui(e,t),r=this;for(let t of((8&n||16&n&&this.touches(e))&&(r=new us(r.source,0)),4&n&&0==r.state&&(r=new us(this.source,1)),r=r.updateFor(e,n),e.effects))if(t.is(cZ))r=new us(r.source,1,t.value);else if(t.is(c0))r=new us(r.source,0);else if(t.is(ua))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(cX(e.state))}}class ul extends us{constructor(e,t,n,r,o,i){super(e,3,t),this.limit=n,this.result=r,this.from=o,this.to=i}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let o=e.changes.mapPos(this.from),i=e.changes.mapPos(this.to,1),s=cX(e.state);if(s>i||!r||2&t&&(cX(e.startState)==this.from||s<this.limit))return new us(this.source,4&t?1:0);let l=e.changes.mapPos(this.limit);return!function(e,t,n,r){if(!e)return!1;let o=t.sliceDoc(n,r);return"function"==typeof e?e(o,n,r,t):cQ(e,!0).test(o)}(r.validFor,e.state,o,i)?r.update&&(r=r.update(r,o,i,new cV(e.state,s,!1)))?new ul(this.source,this.explicit,l,r,r.from,null!==(n=r.to)&&void 0!==n?n:cX(e.state)):new us(this.source,1,this.explicit):new ul(this.source,this.explicit,l,r,o,i)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new ul(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new us(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}let ua=eC.define({map:(e,t)=>e.map(e=>e.map(t))}),uc=eC.define(),uu=eo.define({create:()=>ue.start(),update:(e,t)=>e.update(t),provide:e=>[it.from(e,e=>e.tooltip),oh.contentAttributes.from(e,e=>e.attrs)]});function uh(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(uu).active.find(e=>e.source==t.source);return r instanceof ul&&("string"==typeof n?e.dispatch({...function(e,t,n,r){let{main:o}=e.selection,i=n-o.from,s=r-o.from;return{...e.changeByRange(l=>{if(l!=o&&n!=r&&e.sliceDoc(l.from+i,l.from+s)!=e.sliceDoc(n,r))return{range:l};let a=e.toText(t);return{changes:{from:l.from+i,to:r==o.from?l.to:l.from+s,insert:a},range:Q.cursor(l.from+i+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}(e.state,n,r.from,r.to),annotations:cK.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}let ud=e=>new c9(e,uu,uh);function uf(e,t="option"){return n=>{let r=n.state.field(uu,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(c4).interactionDelay)return!1;let o=1,i;"page"==t&&(i=il(n,r.open.tooltip))&&(o=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,l=r.open.selected>-1?r.open.selected+o*(e?1:-1):e?0:s-1;return l<0?l="page"==t?0:s-1:l>=s&&(l="page"==t?s-1:0),n.dispatch({effects:uc.of(l)}),!0}}let up=e=>!!e.state.field(uu,!1)&&(e.dispatch({effects:cZ.of(!0)}),!0);class um{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}let ug=ng.fromClass(class{constructor(e){for(let t of(this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0,e.state.field(uu).active))t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(uu),n=e.state.facet(c4);if(!e.selectionSet&&!e.docChanged&&e.startState.field(uu)==t)return;let r=e.transactions.some(e=>{let t=ui(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){nd(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(cZ)))&&(this.pendingStart=!0);let o=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),o):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(uu);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(c4).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=cX(t),r=new cV(t,n,e.explicit,this.view),o=new um(e,r);this.running.push(o),Promise.resolve(e.source(r)).then(e=>{o.context.aborted||(o.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:c0.of(null)}),nd(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(c4).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(c4),r=this.view.state.field(uu);for(let o=0;o<this.running.length;o++){let i=this.running[o];if(void 0===i.done)continue;if(this.running.splice(o--,1),i.done){let r=cX(i.updates.length?i.updates[0].startState:this.view.state),o=Math.min(r,i.done.from+(i.active.explicit?0:1)),s=new ul(i.active.source,i.active.explicit,o,i.done,i.done.from,null!==(e=i.done.to)&&void 0!==e?e:r);for(let e of i.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=r.active.find(e=>e.source==i.active.source);if(s&&s.isPending){if(null==i.done){let e=new us(i.active.source,0);for(let t of i.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:ua.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(uu,!1);if(t&&t.tooltip&&this.view.state.facet(c4).closeOnBlur){let n=t.open&&il(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:c0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:cZ.of(!1)}),20),this.composing=0}}}),uv="object"==typeof navigator&&/Win/.test(navigator.platform),ub=el.highest(oh.domEventHandlers({keydown(e,t){let n=t.state.field(uu,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(uv&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],o=n.active.find(e=>e.source==r.source),i=r.completion.commitCharacters||o.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&uh(t,r),!1}})),uy=oh.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),uw=tw.widget({widget:new class extends tb{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),ux=tw.mark({class:"cm-snippetField"});class uk{constructor(e,t){this.ranges=e,this.active=t,this.deco=tw.set(e.map(e=>(e.from==e.to?uw:ux).range(e.from,e.to)),!0)}map(e){let t=[];for(let n of this.ranges){let r=n.map(e);if(!r)return null;t.push(r)}return new uk(t,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}}let uS=eC.define({map:(e,t)=>e&&e.map(t)}),uC=eC.define(),uO=eo.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(uS))return n.value;if(n.is(uC)&&e)return new uk(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>oh.decorations.from(e,e=>e?e.deco:tw.none)});function uE(e){return({state:t,dispatch:n})=>{var r;let o=t.field(uO,!1);if(!o||e<0&&0==o.active)return!1;let i=o.active+e,s=e>0&&!o.ranges.some(t=>t.field==i+e);return n(t.update({selection:(r=o.ranges,Q.create(r.filter(e=>e.field==i).map(e=>Q.range(e.from,e.to)))),effects:uS.of(s?null:new uk(o.ranges,i)),scrollIntoView:!0})),!0}}({state:e,dispatch:t})=>!!e.field(uO,!1)&&(t(e.update({effects:uS.of(null)})),!0);let uP={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},uT=eC.define({map(e,t){let n=t.mapPos(e,-1,W.TrackAfter);return null==n?void 0:n}}),uM=new class extends eN{};uM.startSide=1,uM.endSide=-1;let uA=eo.define({create:()=>eW.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(uT)&&(e=e.update({add:[uM.range(n.value,n.value+1)]}));return e}}),uR="()[]{}<>\xab\xbb\xbb\xab［］｛｝";function u_(e){for(let t=0;t<uR.length;t+=2)if(uR.charCodeAt(t)==e)return uR.charAt(t+1);return I(e<128?e:e+1)}function uD(e,t){return e.languageDataAt("closeBrackets",t)[0]||uP}let uN="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),uL=oh.inputHandler.of((e,t,n,r)=>{if((uN?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let o=e.state.selection.main;if(r.length>2||2==r.length&&1==j(L(r,0))||t!=o.from||n!=o.to)return!1;let i=function(e,t){let n=uD(e,e.selection.main.head),r=n.brackets||uP.brackets;for(let o of r){let i=u_(L(o,0));if(t==o)return i==o?function(e,t,n,r){let o=r.stringPrefixes||uP.stringPrefixes,i=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:uT.of(r.to+t.length),range:Q.range(r.anchor+t.length,r.head+t.length)};let s=r.head,l=uB(e.doc,s),a;if(l==t){if(uW(e,s))return{changes:{insert:t+t,from:s},effects:uT.of(s+t.length),range:Q.cursor(s+t.length)};if(uj(e,s)){let r=n&&e.sliceDoc(s,s+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+r.length,insert:r},range:Q.cursor(s+r.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(a=uF(e,s-2*t.length,o))>-1&&uW(e,a))return{changes:{insert:t+t+t+t,from:s},effects:uT.of(s+t.length),range:Q.cursor(s+t.length)};else if(e.charCategorizer(s)(l)!=eA.Word&&uF(e,s,o)>-1&&!function(e,t,n,r){let o=sj(e).resolveInner(t,-1),i=r.reduce((e,t)=>Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(o.from,Math.min(o.to,o.from+n.length+i)),l=s.indexOf(n);if(!l||l>-1&&r.indexOf(s.slice(0,l))>-1){let t=o.firstChild;for(;t&&t.from==o.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=o.to==t&&o.parent;if(!a)break;o=a}return!1}(e,s,t,o))return{changes:{insert:t+t,from:s},effects:uT.of(s+t.length),range:Q.cursor(s+t.length)};return{range:i=r}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}(e,o,r.indexOf(o+o+o)>-1,n):function(e,t,n,r){let o=null,i=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:n,from:i.to}],effects:uT.of(i.to+t.length),range:Q.range(i.anchor+t.length,i.head+t.length)};let s=uB(e.doc,i.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:i.head},effects:uT.of(i.head+t.length),range:Q.cursor(i.head+t.length)}:{range:o=i}});return o?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}(e,o,i,n.before||uP.before);if(t==i&&uj(e,e.selection.main.from))return function(e,t,n){let r=null,o=e.changeByRange(t=>t.empty&&uB(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Q.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}(e,0,i)}return null}(e.state,r);return!!i&&(e.dispatch(i),!0)}),uI=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=uD(e,e.selection.main.head).brackets||uP.brackets,r=null,o=e.changeByRange(t=>{if(t.empty){var o,i;let r;let s=(o=e.doc,i=t.head,j(L(r=o.sliceString(i-2,i),0))==r.length?r:r.slice(1));for(let r of n)if(r==s&&uB(e.doc,t.head)==u_(L(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:Q.cursor(t.head-r.length)}}return{range:r=t}});return r||t(e.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function uj(e,t){let n=!1;return e.field(uA).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function uB(e,t){let n=e.sliceString(t,t+2);return n.slice(0,j(L(n,0)))}function uW(e,t){let n=sj(e).resolveInner(t+1);return n.parent&&n.from==t}function uF(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=eA.Word)return t;for(let o of n){let n=t-o.length;if(e.sliceDoc(n,t)==o&&r(e.sliceDoc(n-1,n))!=eA.Word)return n}return -1}let u$=[{key:"Ctrl-Space",run:up},{mac:"Alt-`",run:up},{mac:"Alt-i",run:up},{key:"Escape",run:e=>{let t=e.state.field(uu,!1);return!!(t&&t.active.some(e=>0!=e.state))&&(e.dispatch({effects:c0.of(null)}),!0)}},{key:"ArrowDown",run:uf(!0)},{key:"ArrowUp",run:uf(!1)},{key:"PageDown",run:uf(!0,"page")},{key:"PageUp",run:uf(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(uu,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(c4).interactionDelay)&&uh(e,t.open.options[t.open.selected])}}],uz=el.highest(oy.computeN([c4],e=>e.facet(c4).defaultKeymap?[u$]:[]));class uH{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class uq{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(u0).markerFilter;r&&(e=r(e,n));let o=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),i=new eF,s=[],l=0,a=n.doc.iter(),c=0,u=n.doc.length;for(let e=0;;){let t,n,r=e==o.length?null:o[e];if(!r&&!s.length)break;if(s.length)t=l,n=s.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if((t=r.from)>u)break;n=r.to,s.push(r),e++}for(;e<o.length;){let r=o[e];if(r.from==t&&(r.to>r.from||r.to==t))s.push(r),e++,n=Math.min(r.to,n);else{n=Math.min(r.from,n);break}}n=Math.min(n,u);let h=!1;if(s.some(e=>e.from==t&&(e.to==n||n==u))&&!(h=t==n)&&n-t<10){let e=t-(c+a.value.length);e>0&&(a.next(e),c=t);for(let e=t;;){if(e>=n){h=!0;break}if(!a.lineBreak&&c+a.value.length>e)break;e=c+a.value.length,c+=a.value.length,a.next()}}let d=function(e){let t="hint",n=1;for(let o of e){var r;let e="error"==(r=o.severity)?4:"warning"==r?3:"info"==r?2:1;e>n&&(n=e,t=o.severity)}return t}(s);if(h)i.add(t,t,tw.widget({widget:new u5(d),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");i.add(t,n,tw.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>n)}))}if((l=n)==u)break;for(let e=0;e<s.length;e++)s[e].to<=l&&s.splice(e--,1)}let h=i.finish();return new uq(h,t,uV(h))}}function uV(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:o})=>{if(!(t&&0>o.diagnostics.indexOf(t))){if(r){if(0>o.diagnostics.indexOf(r.diagnostic))return!1;r=new uH(r.from,n,r.diagnostic)}else r=new uH(e,n,t||o.diagnostics[0])}}),r}function uU(e,t){let n=t.pos,r=t.end||n,o=e.state.facet(u0).hideOn(e,n,r);if(null!=o)return o;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(uG))||e.changes.touchesRange(i.from,Math.max(i.to,r)))}let uG=eC.define(),uX=eC.define(),uQ=eC.define(),uK=eo.define({create:()=>new uq(tw.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,o=e.panel;if(e.selected){let o=t.changes.mapPos(e.selected.from,1);r=uV(n,e.selected.diagnostic,o)||uV(n,null,o)}!n.size&&o&&t.state.facet(u0).autoPanel&&(o=null),e=new uq(n,o,r)}for(let n of t.effects)if(n.is(uG)){let r=t.state.facet(u0).autoPanel?n.value.length?u6.open:null:e.panel;e=uq.init(n.value,r,t.state)}else n.is(uX)?e=new uq(e.diagnostics,n.value?u6.open:null,e.selected):n.is(uQ)&&(e=new uq(e.diagnostics,e.panel,n.value));return e},provide:e=>[im.from(e,e=>e.panel),oh.decorations.from(e,e=>e.diagnostics)]}),uY=tw.mark({class:"cm-lintRange cm-lintRange-active"}),uJ=e=>{let t=e.state.field(uK,!1);return!!t&&!!t.panel&&(e.dispatch({effects:uX.of(!1)}),!0)},uZ=[{key:"Mod-Shift-m",run:e=>{var t,n;let r=e.state.field(uK,!1);r&&r.panel||e.dispatch({effects:(t=e.state,n=[uX.of(!0)],t.field(uK,!1)?n:n.concat(eC.appendConfig.of(he)))});let o=iu(e,u6.open);return o&&o.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(uK,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return(!!r.value||!!(r=t.diagnostics.iter(0)).value&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],u0=J.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...eD(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:u1,tooltipFilter:u1,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,o)=>e(n,r,o)||t(n,r,o):e:t,autoPanel:(e,t)=>e||t})})});function u1(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function u2(e){let t=[];if(e)r:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue r}}t.push("")}return t}function u4(e,t,n){var r;let o=n?u2(t.actions):[];return tt("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},tt("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map((n,r)=>{let i=!1,s=r=>{if(r.preventDefault(),i)return;i=!0;let o=uV(e.state.field(uK).diagnostics,t);o&&n.apply(e,o.from,o.to)},{name:l}=n,a=o[r]?l.indexOf(o[r]):-1,c=a<0?l:[l.slice(0,a),tt("u",l.slice(a,a+1)),l.slice(a+1)];return tt("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${l}${a<0?"":` (access key "${o[r]})"`}.`},c)}),t.source&&tt("div",{class:"cm-diagnosticSource"},t.source))}class u5 extends tb{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return tt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class u3{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=u4(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class u6{constructor(e){this.view=e,this.items=[],this.list=tt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(!t.ctrlKey&&!t.altKey&&!t.metaKey){if(27==t.keyCode)uJ(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=u2(n.actions);for(let o=0;o<r.length;o++)if(r[o].toUpperCase().charCodeAt(0)==t.keyCode){let t=uV(this.view.state.field(uK).diagnostics,n);t&&n.actions[o].apply(e,t.from,t.to)}}t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=tt("div",{class:"cm-panel-lint"},this.list,tt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>uJ(this.view)},"\xd7")),this.update()}get selectedIndex(){let e=this.view.state.field(uK).selected;if(!e)return -1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return -1}update(){let{diagnostics:e,selected:t}=this.view.state.field(uK),n=0,r=!1,o=null,i=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:l})=>{for(let e of l.diagnostics){if(i.has(e))continue;i.add(e);let s=-1,l;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){s=t;break}s<0?(l=new u3(this.view,e),this.items.splice(n,0,l),r=!0):(l=this.items[s],s>n&&(this.items.splice(n,s-n),r=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),o=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new u3(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=uV(this.view.state.field(uK).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:uQ.of(t)})}static open(e){return new u6(e)}}function u9(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let u8=oh.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:u9("#d11")},".cm-lintRange-warning":{backgroundImage:u9("orange")},".cm-lintRange-info":{backgroundImage:u9("#999")},".cm-lintRange-hint":{backgroundImage:u9("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),u7=eC.define(),he=[uK,oh.decorations.compute([uK],e=>{let{selected:t,panel:n}=e.field(uK);return t&&n&&t.from!=t.to?tw.set([uY.range(t.from,t.to)]):tw.none}),function(e,t={}){let n=eC.define(),r=eo.define({create:()=>[],update(e,r){if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(r,e))),r.docChanged)){let t=[];for(let n of e){let e=r.changes.mapPos(n.pos,-1,W.TrackDel);if(null!=e){let o=Object.assign(Object.create(null),n);o.pos=e,null!=o.end&&(o.end=r.changes.mapPos(o.end)),t.push(o)}}e=t}for(let t of r.effects)t.is(n)&&(e=t.value),t.is(ia)&&(e=[]);return e},provide:e=>ir.from(e)});return{active:r,extension:[r,ng.define(o=>new is(o,e,r,n,t.hoverTime||300)),ii]}}(function(e,t,n){let{diagnostics:r}=e.state.field(uK),o,i=-1,s=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return o=l.diagnostics,i=e,s=r,!1});let l=e.state.facet(u0).tooltipFilter;return(o&&l&&(o=l(o,e.state)),o)?{pos:i,end:s,above:e.state.doc.lineAt(i).to<s,create:()=>{var t;return{dom:(t=e,tt("ul",{class:"cm-tooltip-lint"},o.map(e=>u4(t,e,!1))))}}}:null},{hideOn:uU}),u8];var ht=function(e){void 0===e&&(e={});var{crosshairCursor:t=!1}=e,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(uI)),!1!==e.defaultKeymap&&(n=n.concat(a1)),!1!==e.searchKeymap&&(n=n.concat(cB)),!1!==e.historyKeymap&&(n=n.concat(ar)),!1!==e.foldKeymap&&(n=n.concat(la)),!1!==e.completionKeymap&&(n=n.concat(u$)),!1!==e.lintKeymap&&(n=n.concat(uZ));var r=[];if(!1!==e.lineNumbers&&r.push(function(e={}){return[iN.of(e),iO(),ij]}()),!1!==e.highlightActiveLineGutter&&r.push(iF),!1!==e.highlightSpecialChars&&r.push(function(e={}){return[oU.of(e),oG||(oG=ng.fromClass(class{constructor(e){this.view=e,this.decorations=tw.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(oU)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new o$({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:o}=n.state,i=L(t[0],0);if(9==i){let e=o.lineAt(r),t=n.state.tabSize,i=eY(e.text,t,r-e.from);return tw.replace({widget:new oQ((t-i%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=tw.replace({widget:new oX(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(oU);e.startState.facet(oU)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}()),!1!==e.history&&r.push(function(e={}){return[lZ,lJ.of(e),oh.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?l1:"historyRedo"==e.inputType?l2:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&r.push(function(e={}){var t;let n={...lm,...e},r=new lg(n,!0),o=new lg(n,!1),i=ng.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(sU)!=e.state.facet(sU)||e.startState.field(lr,!1)!=e.state.field(lr,!1)||sj(e.startState)!=sj(e.state)||n.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new eF;for(let n of e.viewportLineBlocks){let i=li(e.state,n.from,n.to)?o:s8(e.state,n.from,n.to)?r:null;i&&t.add(n.from,n.from,i)}return t.finish()}}),{domEventHandlers:s}=n;return[i,(t={class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||eW.empty},initialSpacer:()=>new lg(n,!1),domEventHandlers:{...s,click:(e,t,n)=>{if(s.click&&s.click(e,t,n))return!0;let r=li(e.state,t.from,t.to);if(r)return e.dispatch({effects:lt.of(r)}),!0;let o=s8(e.state,t.from,t.to);return!!o&&(e.dispatch({effects:le.of(o)}),!0)}}},[iO(),iS.of({...ik,...t})]),lh()]}()),!1!==e.drawSelection&&r.push(function(e={}){return[oR.of(e),oD,oL,oI,nl.of(!0)]}()),!1!==e.dropCursor&&r.push([oB,oW]),!1!==e.allowMultipleSelections&&r.push(e_.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&r.push(e_.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,o=n.lineAt(r);if(r>o.from+200)return e;let i=n.sliceString(o.from,r);if(!t.some(e=>e.test(i)))return e;let{state:s}=e,l=-1,a=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=sJ(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],o=sY(s,n);r!=o&&a.push({from:t.from,to:t.from+r.length,insert:o})}return a.length?[e,{changes:a,sequential:!0}]:e})),!1!==e.syntaxHighlighting&&r.push(lk(lO,{fallback:!0})),!1!==e.bracketMatching&&r.push(function(e={}){return[lT.of(e),l_]}()),!1!==e.closeBrackets&&r.push([uL,uA]),!1!==e.autocompletion&&r.push(function(e={}){return[ub,uu,c4.of(e),ug,uz,uy]}()),!1!==e.rectangularSelection){let e;r.push((e=e=>e.altKey&&0==e.button,oh.mouseSelectionStyle.of((t,n)=>{let r,o;return e(n)?(r=oZ(t,n),o=t.state.selection,r?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(r.line).from),n=e.state.doc.lineAt(t);r={line:n.number,col:r.col,off:Math.min(r.off,n.length)},o=o.map(e.changes)}},get(e,n,i){let s=oZ(t,e);if(!s)return o;let l=function(e,t,n){let r=Math.min(t.line,n.line),o=Math.max(t.line,n.line),i=[];if(t.off>2e3||n.off>2e3||t.col<0||n.col<0){let s=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let t=r;t<=o;t++){let n=e.doc.line(t);n.length<=l&&i.push(Q.range(n.from+s,n.to+l))}}else{let s=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let t=r;t<=o;t++){let n=e.doc.line(t),r=eJ(n.text,s,e.tabSize,!0);if(r<0)i.push(Q.cursor(n.to));else{let t=eJ(n.text,l,e.tabSize);i.push(Q.range(n.from+r,n.from+t))}}}return i}(t.state,r,s);return l.length?i?Q.create(l.concat(o.ranges)):Q.create(l):o}}:null):null})))}if(!1!==t&&r.push(function(e={}){let[t,n]=o0[e.key||"Alt"],r=ng.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,oh.contentAttributes.of(e=>{var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?o1:null})]}()),!1!==e.highlightActiveLine&&r.push(oY),!1!==e.highlightSelectionMatches)r.push([ca,cl]);return e.tabSize&&"number"==typeof e.tabSize&&r.push(sQ.of(" ".repeat(e.tabSize))),r.concat([oy.of(n.flat())]).filter(Boolean)};let hn="#e06c75",hr="#abb2bf",ho="#7d8799",hi="#d19a66",hs="#2c313a",hl="#282c34",ha="#353a42",hc="#528bff",hu=[oh.theme({"&":{color:hr,backgroundColor:hl},".cm-content":{caretColor:hc},".cm-cursor, .cm-dropCursor":{borderLeftColor:hc},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:hr},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:hl,color:ho,border:"none"},".cm-activeLineGutter":{backgroundColor:hs},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ha},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ha,borderBottomColor:ha},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:hs,color:hr}}},{dark:!0}),lk(lb.define([{tag:sR.keyword,color:"#c678dd"},{tag:[sR.name,sR.deleted,sR.character,sR.propertyName,sR.macroName],color:hn},{tag:[sR.function(sR.variableName),sR.labelName],color:"#61afef"},{tag:[sR.color,sR.constant(sR.name),sR.standard(sR.name)],color:hi},{tag:[sR.definition(sR.name),sR.separator],color:hr},{tag:[sR.typeName,sR.className,sR.number,sR.changed,sR.annotation,sR.modifier,sR.self,sR.namespace],color:"#e5c07b"},{tag:[sR.operator,sR.operatorKeyword,sR.url,sR.escape,sR.regexp,sR.link,sR.special(sR.string)],color:"#56b6c2"},{tag:[sR.meta,sR.comment],color:ho},{tag:sR.strong,fontWeight:"bold"},{tag:sR.emphasis,fontStyle:"italic"},{tag:sR.strikethrough,textDecoration:"line-through"},{tag:sR.link,color:ho,textDecoration:"underline"},{tag:sR.heading,fontWeight:"bold",color:hn},{tag:[sR.atom,sR.bool,sR.special(sR.variableName)],color:hi},{tag:[sR.processingInstruction,sR.string,sR.inserted],color:"#98c379"},{tag:sR.invalid,color:"#ffffff"}]))];var hh=oh.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),hd=function(e){void 0===e&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:o="light",placeholder:i="",basicSetup:s=!0}=e,l=[];if(t&&l.unshift(oy.of([a2])),s&&("boolean"==typeof s?l.unshift(ht()):l.unshift(ht(s))),i){let e;l.unshift((e=ng.fromClass(class{constructor(e){this.view=e,this.placeholder=i?tw.set([tw.widget({widget:new oJ(i),side:1}).range(0)]):tw.none}get decorations(){return this.view.state.doc.length?tw.none:this.placeholder}},{decorations:e=>e.decorations}),"string"==typeof i?[e,oh.contentAttributes.of({"aria-placeholder":i})]:e))}switch(o){case"light":l.push(hh);break;case"dark":l.push(hu);break;case"none":break;default:l.push(o)}return!1===n&&l.push(oh.editable.of(!1)),r&&l.push(e_.readOnly.of(!0)),[...l]},hf=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)});class hp{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error("TimeoutLatch callback error:",e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class hm{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var hg=null,hv=()=>"undefined"==typeof window?new hm:(hg||(hg=new hm),hg),hb=ex.define(),hy=[],hw=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],hx=(0,p.forwardRef)((e,t)=>{var{className:n,value:r="",selection:o,extensions:i=[],onChange:s,onStatistics:l,onCreateEditor:a,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:v,maxHeight:b,width:y,minWidth:w,maxWidth:x,basicSetup:k,placeholder:S,indentWithTab:C,editable:O,readOnly:E,root:P,initialState:T}=e,M=(0,g.Z)(e,hw),A=(0,p.useRef)(null),{state:R,view:_,container:D,setContainer:N}=function(e){var{value:t,selection:n,onChange:r,onStatistics:o,onCreateEditor:i,onUpdate:s,extensions:l=hy,autoFocus:a,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:f=null,minWidth:m=null,maxWidth:g=null,placeholder:v="",editable:b=!0,readOnly:y=!1,indentWithTab:w=!0,basicSetup:x=!0,root:k,initialState:S}=e,[C,O]=(0,p.useState)(),[E,P]=(0,p.useState)(),[T,M]=(0,p.useState)(),A=(0,p.useState)(()=>({current:null}))[0],R=(0,p.useState)(()=>({current:null}))[0],_=oh.theme({"&":{height:u,minHeight:h,maxHeight:d,width:f,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),D=[oh.updateListener.of(e=>{e.docChanged&&"function"==typeof r&&!e.transactions.some(e=>e.annotation(hb))&&(A.current?A.current.reset():(A.current=new hp(()=>{if(R.current){var e=R.current;R.current=null,e()}A.current=null},200),hv().add(A.current)),r(e.state.doc.toString(),e)),o&&o(hf(e))}),_,...hd({theme:c,editable:b,readOnly:y,placeholder:v,indentWithTab:w,basicSetup:x})];return s&&"function"==typeof s&&D.push(oh.updateListener.of(s)),D=D.concat(l),(0,p.useLayoutEffect)(()=>{if(C&&!T){var e={doc:t,selection:n,extensions:D},r=S?e_.fromJSON(S.json,e,S.fields):e_.create(e);if(M(r),!E){var o=new oh({state:r,parent:C,root:k});P(o),i&&i(o,r)}}return()=>{E&&(M(void 0),P(void 0))}},[C,T]),(0,p.useEffect)(()=>{e.container&&O(e.container)},[e.container]),(0,p.useEffect)(()=>()=>{E&&(E.destroy(),P(void 0)),A.current&&(A.current.cancel(),A.current=null)},[E]),(0,p.useEffect)(()=>{a&&E&&E.focus()},[a,E]),(0,p.useEffect)(()=>{E&&E.dispatch({effects:eC.reconfigure.of(D)})},[c,l,u,h,d,f,m,g,v,b,y,w,x,r,s]),(0,p.useEffect)(()=>{if(void 0!==t){var e=E?E.state.doc.toString():"";if(E&&t!==e){var n=A.current&&!A.current.isDone,r=()=>{E&&t!==E.state.doc.toString()&&E.dispatch({changes:{from:0,to:E.state.doc.toString().length,insert:t||""},annotations:[hb.of(!0)]})};n?R.current=r:r()}}},[t,E]),{state:T,setState:M,view:E,setView:P,container:C,setContainer:O}}({root:P,value:r,autoFocus:u,theme:h,height:d,minHeight:v,maxHeight:b,width:y,minWidth:w,maxWidth:x,basicSetup:k,placeholder:S,indentWithTab:C,editable:O,readOnly:E,selection:o,onChange:s,onStatistics:l,onCreateEditor:a,onUpdate:c,extensions:i,initialState:T});(0,p.useImperativeHandle)(t,()=>({editor:A.current,state:R,view:_}),[A,D,R,_]);var L=(0,p.useCallback)(e=>{A.current=e,N(e)},[N]);if("string"!=typeof r)throw Error("value must be typeof string but got "+typeof r);var I="string"==typeof h?"cm-theme-"+h:"cm-theme";return(0,f.jsx)("div",(0,m.Z)({ref:L,className:""+I+(n?" "+n:"")},M))});hx.displayName="CodeMirror";var hk=n(83454);class hS{constructor(e,t,n,r,o,i,s,l,a,c=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=o,this.score=i,this.buffer=s,this.bufferBase=l,this.curContext=a,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new hS(e,[],t,n,n,0,[],0,r?new hC(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=65535&e,{parser:o}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),s=o.dynamicPrecedence(r);if(s&&(this.score+=s),0==n){this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r<o.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(r,this.reducePos);return}let l=this.stack.length-(n-1)*3-(262144&e?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,c=this.reducePos-a;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[r])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=c));let u=l?this.stack[l-1]:0,h=this.bufferBase+this.buffer.length-u;if(r<o.minRepeatTerm||131072&e){let e=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,a,e,h+4,!0)}if(262144&e)this.state=this.stack[l];else{let e=this.stack[l-3];this.state=o.getGoto(e,r,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(r,a)}storeNode(e,t,n,r=4,o=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(0==r&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&0==e.buffer[r-4]&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(o&&this.pos!=n){let o=this.buffer.length;if(o>0&&(0!=this.buffer[o-4]||this.buffer[o-1]<0)){let e=!1;for(let t=o;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}else this.buffer.push(e,t,n,r)}shift(e,t,n,r){if(131072&e)this.pushState(65535&e,this.pos);else if((262144&e)==0){let{parser:o}=this.p;this.pos=r;let i=o.stateFlag(e,1);!i&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(e,i?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}else this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4)}apply(e,t,n,r){65536&e?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new hS(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new hO(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if((65536&n)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,o;r<t.length;r+=2)(o=t[r+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[r],o);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>1&t&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let o=this.split();o.pushState(r,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[e],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((65536&t)==0)return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=65535&t,o=this.stack.length-3*n;if(o<0||0>e.getGoto(this.stack[o],r,!1)){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,o)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-o;if(n>1){let r=65535&t,o=this.stack.length-3*n;if(o>=0&&e.getGoto(this.stack[o],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,o+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new hC(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class hC{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class hO{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e>>19;0==t?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(t-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],65535&e,!0);this.state=n}}class hE{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new hE(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new hE(this.stack,this.pos,this.index)}}function hP(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let r=0,o=0;r<e.length;){let i=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(126==t){i=65535;break}t>=92&&t--,t>=34&&t--;let o=t-32;if(o>=46&&(o-=46,n=!0),i+=o,n)break;i*=46}n?n[o++]=i:n=new t(i)}return n}class hT{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}let hM=new hT;class hA{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=hM,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!r)return null;let e=this.ranges[--r];o-=n.from-e.to,n=e}for(;t<0?o>n.to:o>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];o+=e.from-n.to,n=e}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(null==t)return -1;if((n=t)>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=hM,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class hR{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;hN(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}hR.prototype.contextual=hR.prototype.fallback=hR.prototype.extend=!1;class h_{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?hP(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,o=e.resolveOffset(1,1);if(hN(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(!n&&r++,null==o)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}h_.prototype.contextual=hR.prototype.fallback=hR.prototype.extend=!1;class hD{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function hN(e,t,n,r,o,i){let s=0,l=1<<r,{dialect:a}=n.p.parser;n:for(;(l&e[s])!=0;){let n=e[s+1];for(let r=s+3;r<n;r+=2)if((e[r+1]&l)>0){let n=e[r];if(a.allows(n)&&(-1==t.token.value||t.token.value==n||function(e,t,n,r){let o=hL(n,r,t);return o<0||hL(n,r,e)<o}(n,t.token.value,o,i))){t.acceptToken(n);break}}let r=t.next,c=0,u=e[s+2];if(t.next<0&&u>c&&65535==e[n+3*u-3]){s=e[n+3*u-1];continue}for(;c<u;){let o=c+u>>1,i=n+o+(o<<1),l=e[i],a=e[i+1]||65536;if(r<l)u=o;else if(r>=a)c=o+1;else{s=e[i+2],t.advance();continue n}}break}}function hL(e,t,n){for(let r=t,o;65535!=(o=e[r]);r++)if(o==n)return r-t;return -1}let hI=void 0!==hk&&hk.env&&/\bparse\b/.test(hk.env.LOG),hj=null;function hB(e,t,n){let r=e.cursor(h.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}class hW{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?hB(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?hB(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[r],i=this.start[t]+n.positions[r];if(i>e)return this.nextStart=i,null;if(o instanceof iK){if(i==e){if(i<this.safeFrom)return null;let e=i+o.length;if(e<=this.safeTo){let t=o.prop(iH.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,i+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(i),this.index.push(0))}else this.index[t]++,this.nextStart=i+o.length}}}class hF{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new hT)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:o}=r,i=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let r=0;r<o.length;r++){if((1<<r&i)==0)continue;let a=o[r],c=this.tokens[r];if((!n||a.fallback)&&((a.contextual||c.start!=e.pos||c.mask!=i||c.context!=s)&&(this.updateCachedToken(c,a,e),c.mask=i,c.context=s),c.lookAhead>c.end+25&&(l=Math.max(c.lookAhead,l)),0!=c.value)){let r=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!a.extend&&(n=c,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),n||e.pos!=this.stream.end||((n=new hT).value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new hT,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let o=t.specializers[r](this.stream.read(e.start,e.end),n);if(o>=0&&n.p.parser.dialect.allows(o>>1)){(1&o)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:o}=e,{parser:i}=e.p,{data:s}=i;for(let e=0;e<2;e++)for(let l=i.stateSlot(o,e?2:1);;l+=3){if(65535==s[l]){if(1==s[l+1])l=hG(s,l+2);else{0==r&&2==s[l+1]&&(r=this.putAction(hG(s,l+2),t,n,r));break}}s[l]==t&&(r=this.putAction(hG(s,l+1),t,n,r))}return r}}class h${constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new hA(t,r),this.tokens=new hF(e,this.stream),this.topTerm=e.top[1];let{from:o}=r[0];this.stacks=[hS.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>4*e.bufferLength?new hW(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,r=this.minStackPos,o=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;i<n.length;i++){let s=n[i];for(;;){if(this.tokens.mainToken=null,s.pos>r)o.push(s);else{if(this.advanceStack(s,o,n))continue;e||(e=[],t=[]),e.push(s);let r=this.tokens.getMainToken(s);t.push(r.value,r.end)}break}}if(!o.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return hI&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw hI&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,o);if(n)return hI&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(o.length>e)for(o.sort((e,t)=>t.score-e.score);o.length>e;)o.pop();o.some(e=>e.reducePos>r)&&this.recovering--}else if(o.length>1){o:for(let e=0;e<o.length-1;e++){let t=o[e];for(let n=e+1;n<o.length;n++){let r=o[n];if(t.sameState(r)||t.buffer.length>500&&r.buffer.length>500){if((t.score-r.score||t.buffer.length-r.buffer.length)>0)o.splice(n--,1);else{o.splice(e--,1);continue o}}}}o.length>12&&(o.sort((e,t)=>t.score-e.score),o.splice(12,o.length-12))}this.minStackPos=o[0].pos;for(let e=1;e<o.length;e++)o[e].pos<this.minStackPos&&(this.minStackPos=o[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:o}=this,i=hI?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(r);s;){let r=this.parser.nodeSet.types[s.type.id]==s.type?o.getGoto(e.state,s.type.id):-1;if(r>-1&&s.length&&(!t||(s.prop(iH.contextHash)||0)==n))return e.useNode(s,r),hI&&console.log(i+this.stackID(e)+` (via reuse of ${o.getName(s.type.id)})`),!0;if(!(s instanceof iK)||0==s.children.length||s.positions[0]>0)break;let l=s.children[0];if(l instanceof iK&&0==s.positions[0])s=l;else break}}let s=o.stateSlot(e.state,4);if(s>0)return e.reduce(s),hI&&console.log(i+this.stackID(e)+` (via always-reduce ${o.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let s=0;s<l.length;){let a=l[s++],c=l[s++],u=l[s++],h=s==l.length||!n,d=h?e:e.split(),f=this.tokens.mainToken;if(d.apply(a,c,f?f.start:d.pos,u),hI&&console.log(i+this.stackID(d)+` (via ${(65536&a)==0?"shift":`reduce of ${o.getName(65535&a)}`} for ${o.getName(c)} @ ${r}${d==e?"":", split"})`),h)return!0;d.pos>r?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return hz(e,t),!0}}runRecovery(e,t,n){let r=null,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=t[i<<1],a=t[(i<<1)+1],c=hI?this.stackID(s)+" -> ":"";if(s.deadEnd&&(o||(o=!0,s.restart(),hI&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let u=s.split(),h=c;for(let e=0;e<10&&u.forceReduce()&&(hI&&console.log(h+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,n));e++)hI&&(h=this.stackID(u)+" -> ");for(let e of s.recoverByInsert(l))hI&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(a==s.pos&&(a++,l=0),s.recoverByDelete(l,a),hI&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),hz(s,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),iK.build({buffer:hE.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(hj||(hj=new WeakMap)).get(e);return t||hj.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function hz(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}class hH{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}let hq=e=>e;class hV{constructor(e){this.start=e.start,this.shift=e.shift||hq,this.reduce=e.reduce||hq,this.reuse=e.reuse||hq,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class hU extends si{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function o(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=iH[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)o(r,e,t[n++]);else{let i=t[n+-r];for(let s=-r;s>0;s--)o(t[n++],e,i);n++}}}this.nodeSet=new iG(t.map((t,o)=>iU.define({name:o>=this.minRepeatTerm?void 0:t,id:o,props:r[o],top:n.indexOf(o)>-1,error:0==o,skipped:e.skippedNodes&&e.skippedNodes.indexOf(o)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let i=hP(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(hX),this.states=hP(e.states,Uint32Array),this.data=hP(e.stateData),this.goto=hP(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new hR(i,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new h$(this,e,t,n);for(let o of this.wrappers)r=o(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return -1;for(let o=r[t+1];;){let t=r[o++],i=1&t,s=r[o++];if(i&&n)return s;for(let n=o+(t>>1);o<n;o++)if(r[o]==e)return s;if(i)return -1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let o=this.stateSlot(e,r?2:1),i;;o+=3){if(65535==(i=n[o])){if(1==n[o+1])i=n[o=hG(n,o+2)];else if(2==n[o+1])return hG(n,o+2);else break}if(i==t||0==i)return hG(n,o+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==r;n+=3){if(65535==this.data[n]){if(1==this.data[n+1])n=hG(this.data,n+2);else break}r=t(hG(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1==this.data[n+1])n=hG(this.data,n+2);else break}if((1&this.data[n+2])==0){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(hU.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let o=e.specializers.find(e=>e.from==n.external);if(!o)return n;let i=Object.assign(Object.assign({},n),{external:o.to});return t.specializers[r]=hX(i),i})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(" ")){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],o;65535!=(o=this.data[n++]);)(r||(r=new Uint8Array(this.maxTerm+1)))[o]=1;return new hH(e,n,r)}static deserialize(e){return new hU(e)}}function hG(e,t){return e[t]|e[t+1]<<16}function hX(e){if(e.external){let t=e.extend?1:0;return(n,r)=>e.external(n,r)<<1|t}return e.get}class hQ{constructor(e,t,n){this.parent=e,this.depth=t,this.type=n,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+n}}function hK(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let t=e.peek(r);if(hJ(t)||-1==t)return n}}function hY(e){return 32==e||9==e}function hJ(e){return 10==e||13==e}function hZ(e){var t;return e<0||hY(t=e)||hJ(t)}hQ.top=new hQ(null,-1,0);let h0=new hV({start:hQ.top,reduce:(e,t)=>3==e.type&&(20==t||34==t)?e.parent:e,shift(e,t,n,r){if(3==t)return new hQ(e,hK(r,r.pos),1);if(65==t||5==t)return new hQ(e,hK(r,r.pos),2);if(63==t)return e.parent;if(19==t||33==t)return new hQ(e,0,3);if(13==t&&4==e.type)return e.parent;if(47==t){let t=/[1-9]/.exec(r.read(r.pos,n.pos));if(t)return new hQ(e,e.depth+ +t[0],4)}return e},hash:e=>e.hash});function h1(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&hZ(e.peek(n+3))}let h2=new hD((e,t)=>{if(-1==e.next&&t.canShift(64))return e.acceptToken(64);let n=e.peek(-1);if((hJ(n)||n<0)&&3!=t.context.type){if(h1(e,45)){if(!t.canShift(63))return e.acceptToken(1,3);e.acceptToken(63)}if(h1(e,46)){if(!t.canShift(63))return e.acceptToken(2,3);e.acceptToken(63)}let n=0;for(;32==e.next;)n++,e.advance();!(n<t.context.depth)&&(n!=t.context.depth||1!=t.context.type||45==e.next&&hZ(e.peek(1)))||-1==e.next||hJ(e.next)||35==e.next||e.acceptToken(63,-n)}},{contextual:!0}),h4=new hD((e,t)=>{if(3==t.context.type){63==e.next&&(e.advance(),hZ(e.next)&&e.acceptToken(7));return}if(45==e.next)e.advance(),hZ(e.next)&&e.acceptToken(1==t.context.type&&t.context.depth==hK(e,e.pos-1)?4:3);else if(63==e.next)e.advance(),hZ(e.next)&&e.acceptToken(2==t.context.type&&t.context.depth==hK(e,e.pos-1)?6:5);else{let n=e.pos;for(;;)if(hY(e.next)){if(e.pos==n)return;e.advance()}else if(33==e.next)h6(e);else if(38==e.next)h9(e);else if(42==e.next){h9(e);break}else if(39==e.next||34==e.next){if(h8(e,!0))break;return}else if(91==e.next||123==e.next){if(!function(e){for(let t=[],n=e.pos+1024;;)if(91==e.next||123==e.next)t.push(e.next),e.advance();else if(39==e.next||34==e.next){if(!h8(e,!0))return!1}else if(93==e.next||125==e.next){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else{if(e.next<0||e.pos>n||hJ(e.next))return!1;e.advance()}}(e))return;break}else{dt(e,!0,!1,0);break}for(;hY(e.next);)e.advance();if(58==e.next){if(e.pos==n&&t.canShift(29))return;hZ(e.peek(1))&&e.acceptTokenTo(2==t.context.type&&t.context.depth==hK(e,n)?66:65,n)}}},{contextual:!0});function h5(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function h3(e,t){var n;return 37==e.next?(e.advance(),h5(e.next)&&e.advance(),h5(e.next)&&e.advance(),!0):((n=e.next)>32&&n<127&&34!=n&&37!=n&&44!=n&&60!=n&&62!=n&&92!=n&&94!=n&&96!=n&&123!=n&&124!=n&&125!=n||!!t&&44==e.next)&&(e.advance(),!0)}function h6(e){if(e.advance(),60==e.next){for(e.advance();;)if(!h3(e,!0)){62==e.next&&e.advance();break}}else for(;h3(e,!1););}function h9(e){for(e.advance();!hZ(e.next)&&"f"!=h7(e.tag);)e.advance()}function h8(e,t){let n=e.next,r=!1,o=e.pos;for(e.advance();;){let i=e.next;if(i<0)break;if(e.advance(),i==n){if(39==i){if(39==e.next)e.advance();else break}else break}else if(92==i&&34==n)e.next>=0&&e.advance();else if(hJ(i)){if(t)return!1;r=!0}else if(t&&e.pos>=o+1024)return!1}return!r}function h7(e){return e<33?"u":e>125?"s":"iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif"[e-33]}function de(e,t){let n=h7(e);return"u"!=n&&!(t&&"f"==n)}function dt(e,t,n,r){if(!("s"==h7(e.next)||(63==e.next||58==e.next||45==e.next)&&de(e.peek(1),n)))return!1;e.advance();let o=e.pos;for(;;){var i;let s=e.next,l=0,a=r+1;for(;hY(i=s)||hJ(i);){if(hJ(s)){if(t)return!1;a=0}else a++;s=e.peek(++l)}if(!(s>=0&&(58==s?de(e.peek(l+1),n):35==s?32!=e.peek(l-1):de(s,n)))||!n&&a<=r||0==a&&!n&&(h1(e,45,l)||h1(e,46,l)))break;if(t&&"f"==h7(s))return!1;for(let t=l;t>=0;t--)e.advance();if(t&&e.pos>o+1024)return!1}return!0}let dn=new hD((e,t)=>{if(33==e.next)h6(e),e.acceptToken(12);else if(38==e.next||42==e.next){let t=38==e.next?10:11;h9(e),e.acceptToken(t)}else 39==e.next||34==e.next?(h8(e,!1),e.acceptToken(9)):dt(e,!1,3==t.context.type,t.context.depth)&&e.acceptToken(8)}),dr=new hD((e,t)=>{let n=4==t.context.type?t.context.depth:-1,r=e.pos;n:for(;;){let o=0,i=e.next;for(;32==i;)i=e.peek(++o);if(!o&&(h1(e,45,o)||h1(e,46,o))||!hJ(i)&&(n<0&&(n=Math.max(t.context.depth+1,o)),o<n))break;for(;;){if(e.next<0)break n;let t=hJ(e.next);if(e.advance(),t)continue n;r=e.pos}}e.acceptTokenTo(13,r)}),di=sh({DirectiveName:sR.keyword,DirectiveContent:sR.attributeValue,"DirectiveEnd DocEnd":sR.meta,QuotedLiteral:sR.string,BlockLiteralHeader:sR.special(sR.string),BlockLiteralContent:sR.content,Literal:sR.content,"Key/Literal Key/QuotedLiteral":sR.definition(sR.propertyName),"Anchor Alias":sR.labelName,Tag:sR.typeName,Comment:sR.lineComment,": , -":sR.separator,"?":sR.punctuation,"[ ]":sR.squareBracket,"{ }":sR.brace}),ds=hU.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:h0,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[di],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[h2,h4,dn,dr,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),dl=sI.define({name:"yaml",parser:ds.configure({props:[s0.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if("BlockLiteralContent"==t.name&&t.from<t.to)return e.baseIndentFor(t);if("BlockLiteral"==t.name)return e.baseIndentFor(t)+e.unit;if("BlockSequence"==t.name||"BlockMapping"==t.name)return e.column(t.from,1);if("QuotedLiteral"==t.name)break;if("Literal"==t.name){let n=e.column(t.from,1);if(n==e.lineIndent(t.from,1))return n;if(t.to>e.pos)break}}return null},FlowMapping:s5({closing:"}"}),FlowSequence:s5({closing:"]"})}),s9.add({"FlowMapping FlowSequence":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null},"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function da(e){let{value:t,onChange:n,className:r,maxHeight:o="400px",minHeight:i,disabled:s=!1}=e;return(0,f.jsx)("div",{className:"rounded-md border border-gray-300 overflow-hidden ".concat(r||""),style:{width:"100%",maxWidth:"100%",minWidth:0},children:(0,f.jsx)(hx,{value:t,onChange:n,extensions:[new sG(dl)],editable:!s,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLineGutter:!1,highlightActiveLine:!1,indentOnInput:!0,bracketMatching:!0,autocompletion:!1},style:{fontSize:"13px",maxHeight:o,minHeight:i,overflow:"auto"},theme:"light"})})}sR.meta},470:function(e,t,n){"use strict";let r,o,i;n.d(t,{WH:function(){return rL},Kl:function(){return rX},x9:function(){return rG},$3:function(){return rj},$B:function(){return rz},Md:function(){return rI},yc:function(){return rD},Zg:function(){return rH},$N:function(){return r$},LU:function(){return rB},xn:function(){return rq},sY:function(){return rV},os:function(){return rQ},Zt:function(){return rF},Zn:function(){return rW}});var s,l,a,c,u,h,d,f=n(85893),p=n(67294);let m={},g=0,v=!1,b=null,y=null,w="undefined"!=typeof document?p.useLayoutEffect:()=>{},x={prefix:String(Math.round(1e10*Math.random())),current:0},k=p.createContext(x),S=p.createContext(!1);"undefined"!=typeof window&&window.document&&window.document.createElement;let C=new WeakMap,O="function"==typeof p.useId?function(e){let t=p.useId(),[n]=(0,p.useState)(M()),r=n?"react-aria":`react-aria${x.prefix}`;return e||`${r}-${t}`}:function(e){let t=(0,p.useContext)(k),n=function(e=!1){let t=(0,p.useContext)(k),n=(0,p.useRef)(null);if(null===n.current&&!e){var r,o;let e=null===(o=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)||void 0===o?void 0:null===(r=o.ReactCurrentOwner)||void 0===r?void 0:r.current;if(e){let n=C.get(e);null==n?C.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,C.delete(e))}n.current=++t.current}return n.current}(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`};function E(){return!1}function P(){return!0}function T(e){return()=>{}}function M(){return"function"==typeof p.useSyncExternalStore?p.useSyncExternalStore(T,E,P):(0,p.useContext)(S)}let A=!!("undefined"!=typeof window&&window.document&&window.document.createElement),R=new Map;var _=n(90512);function D(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],o=r[e];"function"==typeof n&&"function"==typeof o&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&90>=e.charCodeAt(2)?t[e]=function(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}(n,o):("className"===e||"UNSAFE_className"===e)&&"string"==typeof n&&"string"==typeof o?t[e]=(0,_.Z)(n,o):"id"===e&&n&&o?t.id=function(e,t){if(e===t)return e;let n=R.get(e);if(n)return n.forEach(e=>e(t)),t;let r=R.get(t);return r?(r.forEach(t=>t(e)),e):t}(n,o):t[e]=void 0!==o?o:n}}return t}function N(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands.some(t=>e.test(t.brand)))||e.test(window.navigator.userAgent))}function L(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function I(e){let t=null;return()=>(null==t&&(t=e()),t)}let j=I(function(){return L(/^Mac/i)}),B=I(function(){return L(/^iPhone/i)}),W=I(function(){return L(/^iPad/i)||j()&&navigator.maxTouchPoints>1}),F=I(function(){return B()||W()});I(function(){return j()||F()});let $=I(function(){return N(/AppleWebKit/i)&&!z()}),z=I(function(){return N(/Chrome/i)}),H=I(function(){return N(/Android/i)});I(function(){return N(/Firefox/i)});let q=e=>{var t;return null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document},V=e=>e&&"window"in e&&e.window===e?e:q(e).defaultView||window,U=null,G=new Set,X=new Map,Q=!1,K=!1;function Y(e,t){for(let n of G)n(e,t)}function J(e){Q=!0,e.metaKey||!j()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key||(U="keyboard",Y("keyboard",e))}function Z(e){U="pointer",("mousedown"===e.type||"pointerdown"===e.type)&&(Q=!0,Y("pointer",e))}function ee(e){(0===e.mozInputSource&&e.isTrusted||(H()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType))&&(Q=!0,U="virtual")}function et(e){e.target!==window&&e.target!==document&&(Q||K||(U="virtual",Y("virtual",e)),Q=!1,K=!1)}function en(){Q=!1,K=!0}function er(e){if("undefined"==typeof window||X.get(V(e)))return;let t=V(e),n=q(e),r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Q=!0,r.apply(this,arguments)},n.addEventListener("keydown",J,!0),n.addEventListener("keyup",J,!0),n.addEventListener("click",ee,!0),t.addEventListener("focus",et,!0),t.addEventListener("blur",en,!1),"undefined"!=typeof PointerEvent?(n.addEventListener("pointerdown",Z,!0),n.addEventListener("pointermove",Z,!0),n.addEventListener("pointerup",Z,!0)):(n.addEventListener("mousedown",Z,!0),n.addEventListener("mousemove",Z,!0),n.addEventListener("mouseup",Z,!0)),t.addEventListener("beforeunload",()=>{eo(e)},{once:!0}),X.set(t,{focus:r})}let eo=(e,t)=>{let n=V(e),r=q(e);t&&r.removeEventListener("DOMContentLoaded",t),X.has(n)&&(n.HTMLElement.prototype.focus=X.get(n).focus,r.removeEventListener("keydown",J,!0),r.removeEventListener("keyup",J,!0),r.removeEventListener("click",ee,!0),n.removeEventListener("focus",et,!0),n.removeEventListener("blur",en,!1),"undefined"!=typeof PointerEvent?(r.removeEventListener("pointerdown",Z,!0),r.removeEventListener("pointermove",Z,!0),r.removeEventListener("pointerup",Z,!0)):(r.removeEventListener("mousedown",Z,!0),r.removeEventListener("mousemove",Z,!0),r.removeEventListener("mouseup",Z,!0)),X.delete(n))};"undefined"!=typeof document&&function(e){let t;let n=q(void 0);"loading"!==n.readyState?er(void 0):(t=()=>{er(void 0)},n.addEventListener("DOMContentLoaded",t)),()=>eo(e,t)}();let ei=!1,es=0;function el(){ei=!0,setTimeout(()=>{ei=!1},50)}function ea(e){"touch"===e.pointerType&&el()}function ec(){if("undefined"!=typeof document)return"undefined"!=typeof PointerEvent?document.addEventListener("pointerup",ea):document.addEventListener("touchend",el),es++,()=>{--es>0||("undefined"!=typeof PointerEvent?document.removeEventListener("pointerup",ea):document.removeEventListener("touchend",el))}}function eu(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[i,s]=(0,p.useState)(!1),l=(0,p.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;(0,p.useEffect)(ec,[]);let{hoverProps:a,triggerHoverEnd:c}=(0,p.useMemo)(()=>{let e=(e,r)=>{if(l.pointerType=r,o||"touch"===r||l.isHovered||!e.currentTarget.contains(e.target))return;l.isHovered=!0;let i=e.currentTarget;l.target=i,t&&t({type:"hoverstart",target:i,pointerType:r}),n&&n(!0),s(!0)},i=(e,t)=>{if(l.pointerType="",l.target=null,"touch"===t||!l.isHovered)return;l.isHovered=!1;let o=e.currentTarget;r&&r({type:"hoverend",target:o,pointerType:t}),n&&n(!1),s(!1)},a={};return"undefined"!=typeof PointerEvent?(a.onPointerEnter=t=>{ei&&"mouse"===t.pointerType||e(t,t.pointerType)},a.onPointerLeave=e=>{!o&&e.currentTarget.contains(e.target)&&i(e,e.pointerType)}):(a.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},a.onMouseEnter=t=>{l.ignoreEmulatedMouseEvents||ei||e(t,"mouse"),l.ignoreEmulatedMouseEvents=!1},a.onMouseLeave=e=>{!o&&e.currentTarget.contains(e.target)&&i(e,"mouse")}),{hoverProps:a,triggerHoverEnd:i}},[t,n,r,o,l]);return(0,p.useEffect)(()=>{o&&c({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:a,isHovered:i}}let eh="undefined"!=typeof document?p.useLayoutEffect:()=>{};function ed(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands.some(t=>e.test(t.brand)))||e.test(window.navigator.userAgent))}function ef(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function ep(e){let t=null;return()=>(null==t&&(t=e()),t)}let em=ep(function(){return ef(/^Mac/i)}),eg=ep(function(){return ef(/^iPhone/i)}),ev=ep(function(){return ef(/^iPad/i)||em()&&navigator.maxTouchPoints>1}),eb=ep(function(){return eg()||ev()});ep(function(){return em()||eb()}),ep(function(){return ed(/AppleWebKit/i)&&!ey()});let ey=ep(function(){return ed(/Chrome/i)}),ew=ep(function(){return ed(/Android/i)});ep(function(){return ed(/Firefox/i)});let ex=e=>{var t;return null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document},ek=e=>e&&"window"in e&&e.window===e?e:ex(e).defaultView||window,eS=null,eC=new Set,eO=new Map,eE=!1,eP=!1;function eT(e,t){for(let n of eC)n(e,t)}function eM(e){eE=!0,e.metaKey||!em()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key||(eS="keyboard",eT("keyboard",e))}function eA(e){eS="pointer",("mousedown"===e.type||"pointerdown"===e.type)&&(eE=!0,eT("pointer",e))}function eR(e){(0===e.mozInputSource&&e.isTrusted||(ew()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType))&&(eE=!0,eS="virtual")}function e_(e){e.target!==window&&e.target!==document&&e.isTrusted&&(eE||eP||(eS="virtual",eT("virtual",e)),eE=!1,eP=!1)}function eD(){eE=!1,eP=!0}function eN(e){if("undefined"==typeof window||"undefined"==typeof document||eO.get(ek(e)))return;let t=ek(e),n=ex(e),r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){eE=!0,r.apply(this,arguments)},n.addEventListener("keydown",eM,!0),n.addEventListener("keyup",eM,!0),n.addEventListener("click",eR,!0),t.addEventListener("focus",e_,!0),t.addEventListener("blur",eD,!1),"undefined"!=typeof PointerEvent&&(n.addEventListener("pointerdown",eA,!0),n.addEventListener("pointermove",eA,!0),n.addEventListener("pointerup",eA,!0)),t.addEventListener("beforeunload",()=>{eL(e)},{once:!0}),eO.set(t,{focus:r})}let eL=(e,t)=>{let n=ek(e),r=ex(e);t&&r.removeEventListener("DOMContentLoaded",t),eO.has(n)&&(n.HTMLElement.prototype.focus=eO.get(n).focus,r.removeEventListener("keydown",eM,!0),r.removeEventListener("keyup",eM,!0),r.removeEventListener("click",eR,!0),n.removeEventListener("focus",e_,!0),n.removeEventListener("blur",eD,!1),"undefined"!=typeof PointerEvent&&(r.removeEventListener("pointerdown",eA,!0),r.removeEventListener("pointermove",eA,!0),r.removeEventListener("pointerup",eA,!0)),eO.delete(n))};"undefined"!=typeof document&&function(e){let t;let n=ex(void 0);"loading"!==n.readyState?eN(void 0):(t=()=>{eN(void 0)},n.addEventListener("DOMContentLoaded",t)),()=>eL(e,t)}();let eI=(e=document)=>e.activeElement,ej=new Map,eB=new Set;function eW(){if("undefined"==typeof window)return;function e(e){return"propertyName"in e}let t=n=>{if(!e(n)||!n.target)return;let r=ej.get(n.target);if(r&&(r.delete(n.propertyName),0===r.size&&(n.target.removeEventListener("transitioncancel",t),ej.delete(n.target)),0===ej.size)){for(let e of eB)e();eB.clear()}};document.body.addEventListener("transitionrun",n=>{if(!e(n)||!n.target)return;let r=ej.get(n.target);r||(r=new Set,ej.set(n.target,r),n.target.addEventListener("transitioncancel",t,{once:!0})),r.add(n.propertyName)}),document.body.addEventListener("transitionend",t)}function eF(e){if(function(){if(null==e$){e$=!1;try{document.createElement("div").focus({get preventScroll(){return e$=!0,!0}})}catch{}}return e$}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}(e);e.focus(),function(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}"undefined"!=typeof document&&("loading"!==document.readyState?eW():document.addEventListener("DOMContentLoaded",eW));let e$=null;function ez(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented:()=>n.isDefaultPrevented(),stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped:()=>t}),t&&n.stopPropagation()}}"undefined"!=typeof window&&window.document&&window.document.createElement;let eH=new Map;function eq(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],o=r[e];"function"==typeof n&&"function"==typeof o&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&90>=e.charCodeAt(2)?t[e]=function(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}(n,o):("className"===e||"UNSAFE_className"===e)&&"string"==typeof n&&"string"==typeof o?t[e]=(0,_.Z)(n,o):"id"===e&&n&&o?t.id=function(e,t){if(e===t)return e;let n=eH.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=eH.get(t);return r?(r.forEach(t=>t.current=e),e):t}(n,o):t[e]=void 0!==o?o:n}}return t}"undefined"!=typeof FinalizationRegistry&&new FinalizationRegistry(e=>{eH.delete(e)});let eV=p.createContext(null),eU=new Set(["id"]),eG=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),eX=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),eQ=/^(data-.*)$/;function eK(e,t=-1/0,n=1/0){return Math.min(Math.max(e,t),n)}let eY={top:"top",bottom:"top",left:"left",right:"left"},eJ={top:"bottom",bottom:"top",left:"right",right:"left"},eZ={top:"left",left:"top"},e0={top:"height",left:"width"},e1={width:"totalWidth",height:"totalHeight"},e2={},e4="undefined"!=typeof document?window.visualViewport:null;function e5(e){var t,n,r,o,i;let s=0,l=0,a=0,c=0,u=0,h=0,d={},f=(null!==(t=null==e4?void 0:e4.scale)&&void 0!==t?t:1)>1;if("BODY"===e.tagName){let t=document.documentElement;a=t.clientWidth,c=t.clientHeight,s=null!==(n=null==e4?void 0:e4.width)&&void 0!==n?n:a,l=null!==(r=null==e4?void 0:e4.height)&&void 0!==r?r:c,d.top=t.scrollTop||e.scrollTop,d.left=t.scrollLeft||e.scrollLeft,e4&&(u=e4.offsetTop,h=e4.offsetLeft)}else({width:s,height:l,top:u,left:h}=e7(e)),d.top=e.scrollTop,d.left=e.scrollLeft,a=s,c=l;return $()&&("BODY"===e.tagName||"HTML"===e.tagName)&&f&&(d.top=0,d.left=0,u=null!==(o=null==e4?void 0:e4.pageTop)&&void 0!==o?o:0,h=null!==(i=null==e4?void 0:e4.pageLeft)&&void 0!==i?i:0),{width:s,height:l,totalWidth:a,totalHeight:c,scroll:d,top:u,left:h}}function e3(e,t,n,r,o,i,s){var l;let a=null!==(l=o.scroll[e])&&void 0!==l?l:0,c=r[e0[e]],u=r.scroll[eY[e]]+i,h=c+r.scroll[eY[e]]-i,d=t-a+s[e]-r[eY[e]],f=t-a+n+s[e]-r[eY[e]];return d<u?u-d:f>h?Math.max(h-f,u-d):0}function e6(e){if(e2[e])return e2[e];let[t,n]=e.split(" "),r=eY[t]||"right",o=eZ[r];eY[n]||(n="center");let i=e0[r],s=e0[o];return e2[e]={placement:t,crossPlacement:n,axis:r,crossAxis:o,size:i,crossSize:s},e2[e]}function e9(e,t,n,r,o,i,s,l,a,c){var u,h,d,f,p;let{placement:m,crossPlacement:g,axis:v,crossAxis:b,size:y,crossSize:w}=r,x={};x[b]=null!==(u=e[b])&&void 0!==u?u:0,"center"===g?x[b]+=((null!==(h=e[w])&&void 0!==h?h:0)-(null!==(d=n[w])&&void 0!==d?d:0))/2:g!==b&&(x[b]+=(null!==(f=e[w])&&void 0!==f?f:0)-(null!==(p=n[w])&&void 0!==p?p:0)),x[b]+=i;let k=e[b]-n[w]+a+c,S=e[b]+e[w]-a-c;if(x[b]=eK(x[b],k,S),m===v){let n=l?s[y]:t[e1[y]];x[eJ[v]]=Math.floor(n-e[v]+o)}else x[v]=Math.floor(e[v]+e[y]+o);return x}function e8(e,t,n,r,o,i){var s,l,a;let{placement:c,axis:u,size:h}=i;return c===u?Math.max(0,n[u]-e[u]-(null!==(s=e.scroll[u])&&void 0!==s?s:0)+t[u]-(null!==(l=r[u])&&void 0!==l?l:0)-r[eJ[u]]-o):Math.max(0,e[h]+e[u]+e.scroll[u]-t[u]-n[u]-n[h]-(null!==(a=r[u])&&void 0!==a?a:0)-r[eJ[u]]-o)}function e7(e){let{top:t,left:n,width:r,height:o}=e.getBoundingClientRect(),{scrollTop:i,scrollLeft:s,clientTop:l,clientLeft:a}=document.documentElement;return{top:t+i-l,left:n+s-a,width:r,height:o}}function te(e,t){let n,r=window.getComputedStyle(e);if("fixed"===r.position){let{top:t,left:r,width:o,height:i}=e.getBoundingClientRect();n={top:t,left:r,width:o,height:i}}else{n=e7(e);let r=e7(t),o=window.getComputedStyle(t);r.top+=(parseInt(o.borderTopWidth,10)||0)-t.scrollTop,r.left+=(parseInt(o.borderLeftWidth,10)||0)-t.scrollLeft,n.top-=r.top,n.left-=r.left}return n.top-=parseInt(r.marginTop,10)||0,n.left-=parseInt(r.marginLeft,10)||0,n}function tt(e){let t=window.getComputedStyle(e);return"none"!==t.transform||/transform|perspective/.test(t.willChange)||"none"!==t.filter||"paint"===t.contain||"backdropFilter"in t&&"none"!==t.backdropFilter||"WebkitBackdropFilter"in t&&"none"!==t.WebkitBackdropFilter}let tn=new WeakMap;function tr(e){let{ref:t,box:n,onResize:r}=e;(0,p.useEffect)(()=>{let e=null==t?void 0:t.current;if(e){if(!(void 0!==window.ResizeObserver))return window.addEventListener("resize",r,!1),()=>{window.removeEventListener("resize",r,!1)};{let t=new window.ResizeObserver(e=>{e.length&&r()});return t.observe(e,{box:n}),()=>{e&&t.unobserve(e)}}}},[r,t,n])}let to=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),ti=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]),ts=Symbol.for("react-aria.i18n.locale");function tl(){let e="undefined"!=typeof window&&window[ts]||"undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e="en-US"}return{locale:e,direction:!function(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n="function"==typeof t.getTextInfo?t.getTextInfo():t.textInfo;if(n)return"rtl"===n.direction;if(t.script)return to.has(t.script)}let t=e.split("-")[0];return ti.has(t)}(e)?"ltr":"rtl"}}let ta=tl(),tc=new Set;function tu(){for(let e of(ta=tl(),tc))e(ta)}let th=p.createContext(null),td="undefined"!=typeof document?window.visualViewport:null;function tf(e,t){return!!e&&!!t&&t.some(t=>t.contains(e))}class tp{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(null!=t?t:null);if(!r)return;let o=new tm({scopeRef:e});r.addChild(o),o.parent=r,this.fastMap.set(e,o),n&&(o.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(null===e)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&tf(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(null!=e.scopeRef&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){var e,t;let n=new tp;for(let r of this.traverse())n.addTreeNode(r.scopeRef,null!==(t=null===(e=r.parent)||void 0===e?void 0:e.scopeRef)&&void 0!==t?t:null,r.nodeToRestore);return n}constructor(){this.fastMap=new Map,this.root=new tm({scopeRef:null}),this.fastMap.set(null,this.root)}}class tm{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}let tg=new tp;function tv(e){let t=(0,p.useRef)(null);return w(()=>{t.current=e},[e]),(0,p.useCallback)((...e)=>{let n=t.current;return null==n?void 0:n(...e)},[])}function tb(e,t){if(e.button>0)return!1;if(e.target){let t=e.target.ownerDocument;if(!t||!t.documentElement.contains(e.target)||e.target.closest("[data-react-aria-top-layer]"))return!1}return t.current&&!t.current.contains(e.target)}class ty{isDefaultPrevented(){return this.nativeEvent.defaultPrevented}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPropagationStopped=()=>!0}isPropagationStopped(){return!1}persist(){}constructor(e,t){this.nativeEvent=t,this.target=t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget,this.bubbles=t.bubbles,this.cancelable=t.cancelable,this.defaultPrevented=t.defaultPrevented,this.eventPhase=t.eventPhase,this.isTrusted=t.isTrusted,this.timeStamp=t.timeStamp,this.type=e}}let tw=[];var[tx,tk]=function(e={}){let{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,o=p.createContext(void 0);return o.displayName=r,[o.Provider,function e(){var r;let i=p.useContext(o);if(!i&&t){let t=Error(n);throw t.name="ContextError",null==(r=Error.captureStackTrace)||r.call(Error,t,e),t}return i},o]}({name:"ProviderContext",strict:!1}),tS=(e,t,n=!0)=>{if(!t)return[e,{}];let r=t.reduce((t,n)=>n in e?{...t,[n]:e[n]}:t,{});return n?[Object.keys(e).filter(e=>!t.includes(e)).reduce((t,n)=>({...t,[n]:e[n]}),{}),r]:[e,r]},tC=["small","medium","large"],tO={theme:{opacity:["disabled"],spacing:["divider"],borderWidth:tC,borderRadius:tC},classGroups:{shadow:[{shadow:tC}],"font-size":[{text:["tiny",...tC]}],"bg-image":["bg-stripe-gradient-default","bg-stripe-gradient-primary","bg-stripe-gradient-secondary","bg-stripe-gradient-success","bg-stripe-gradient-warning","bg-stripe-gradient-danger"]}},tE=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,tP=e=>!e||"object"!=typeof e||0===Object.keys(e).length,tT=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function tM(e){let t=[];return function e(t,n){t.forEach(function(t){Array.isArray(t)?e(t,n):n.push(t)})}(e,t),t}var tA=(...e)=>tM(e).filter(Boolean),tR=(e,t)=>{let n={},r=Object.keys(e),o=Object.keys(t);for(let i of r)if(o.includes(i)){let r=e[i],o=t[i];"object"==typeof r&&"object"==typeof o?n[i]=tR(r,o):Array.isArray(r)||Array.isArray(o)?n[i]=tA(o,r):n[i]=o+" "+r}else n[i]=e[i];for(let e of o)r.includes(e)||(n[e]=t[e]);return n},t_=e=>e&&"string"==typeof e?e.replace(/\s+/g," ").trim():e,tD=/^\[(.+)\]$/;function tN(e,t){var n=e;return t.split("-").forEach(function(e){n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n}var tL=/\s+/;function tI(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=function e(t){if("string"==typeof t)return t;for(var n,r="",o=0;o<t.length;o++)t[o]&&(n=e(t[o]))&&(r&&(r+=" "),r+=n);return r}(e))&&(r&&(r+=" "),r+=t);return r}function tj(){for(var e,t,n,r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=arguments[i];var s=function(r){var i=o[0];return t=(e=function(e){var t,n,r,o,i,s,l,a,c,u,h;return{cache:function(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function o(o,i){n.set(o,i),++t>e&&(t=0,r=n,n=new Map)}return{get:function(e){var t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(o(e,t),t):void 0},set:function(e,t){n.has(e)?n.set(e,t):o(e,t)}}}(e.cacheSize),splitModifiers:(n=1===(t=e.separator||":").length,r=t[0],o=t.length,function(e){for(var i,s=[],l=0,a=0,c=0;c<e.length;c++){var u=e[c];if(0===l){if(u===r&&(n||e.slice(c,c+o)===t)){s.push(e.slice(a,c)),a=c+o;continue}if("/"===u){i=c;continue}}"["===u?l++:"]"===u&&l--}var h=0===s.length?e:e.substring(a),d=h.startsWith("!"),f=d?h.substring(1):h;return{modifiers:s,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:i&&i>a?i-a:void 0}}),...(a=e.theme,c=e.prefix,u={nextPart:new Map,validators:[]},(h=Object.entries(e.classGroups),c?h.map(function(e){return[e[0],e[1].map(function(e){return"string"==typeof e?c+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(function(e){return[c+e[0],e[1]]})):e})]}):h).forEach(function(e){var t=e[0];(function e(t,n,r,o){t.forEach(function(t){if("string"==typeof t){(""===t?n:tN(n,t)).classGroupId=r;return}if("function"==typeof t){if(t.isThemeGetter){e(t(o),n,r,o);return}n.validators.push({validator:t,classGroupId:r});return}Object.entries(t).forEach(function(t){var i=t[0];e(t[1],tN(n,i),r,o)})})})(e[1],u,t,a)}),i=e.conflictingClassGroups,l=void 0===(s=e.conflictingClassGroupModifiers)?{}:s,{getClassGroupId:function(e){var t=e.split("-");return""===t[0]&&1!==t.length&&t.shift(),function e(t,n){if(0===t.length)return n.classGroupId;var r=t[0],o=n.nextPart.get(r),i=o?e(t.slice(1),o):void 0;if(i)return i;if(0!==n.validators.length){var s=t.join("-");return n.validators.find(function(e){return(0,e.validator)(s)})?.classGroupId}}(t,u)||function(e){if(tD.test(e)){var t=tD.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}(e)},getConflictingClassGroupIds:function(e,t){var n=i[e]||[];return t&&l[e]?[].concat(n,l[e]):n}})}}(o.slice(1).reduce(function(e,t){return t(e)},i()))).cache.get,n=e.cache.set,s=l,l(r)};function l(r){var o,i,s,l,a,c=t(r);if(c)return c;var u=(i=(o=e).splitModifiers,s=o.getClassGroupId,l=o.getConflictingClassGroupIds,a=new Set,r.trim().split(tL).map(function(e){var t=i(e),n=t.modifiers,r=t.hasImportantModifier,o=t.baseClassName,l=t.maybePostfixModifierPosition,a=s(l?o.substring(0,l):o),c=!!l;if(!a){if(!l||!(a=s(o)))return{isTailwindClass:!1,originalClassName:e};c=!1}var u=(function(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(e){"["===e[0]?(t.push.apply(t,n.sort().concat([e])),n=[]):n.push(e)}),t.push.apply(t,n.sort()),t})(n).join(":");return{isTailwindClass:!0,modifierId:r?u+"!":u,classGroupId:a,originalClassName:e,hasPostfixModifier:c}}).reverse().filter(function(e){if(!e.isTailwindClass)return!0;var t=e.modifierId,n=e.classGroupId,r=e.hasPostfixModifier,o=t+n;return!a.has(o)&&(a.add(o),l(n,r).forEach(function(e){return a.add(t+e)}),!0)}).reverse().map(function(e){return e.originalClassName}).join(" "));return n(r,u),u}return function(){return s(tI.apply(null,arguments))}}function tB(e){var t=function(t){return t[e]||[]};return t.isThemeGetter=!0,t}var tW=/^\[(?:([a-z-]+):)?(.+)\]$/i,tF=/^\d+\/\d+$/,t$=new Set(["px","full","screen"]),tz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tH=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tq=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function tV(e){return tY(e)||t$.has(e)||tF.test(e)||tU(e)}function tU(e){return t5(e,"length",t3)}function tG(e){return t5(e,"size",t6)}function tX(e){return t5(e,"position",t6)}function tQ(e){return t5(e,"url",t9)}function tK(e){return t5(e,"number",tY)}function tY(e){return!Number.isNaN(Number(e))}function tJ(e){return e.endsWith("%")&&tY(e.slice(0,-1))}function tZ(e){return t8(e)||t5(e,"number",t8)}function t0(e){return tW.test(e)}function t1(){return!0}function t2(e){return tz.test(e)}function t4(e){return t5(e,"",t7)}function t5(e,t,n){var r=tW.exec(e);return!!r&&(r[1]?r[1]===t:n(r[2]))}function t3(e){return tH.test(e)}function t6(){return!1}function t9(e){return e.startsWith("url(")}function t8(e){return Number.isInteger(Number(e))}function t7(e){return tq.test(e)}function ne(){var e=tB("colors"),t=tB("spacing"),n=tB("blur"),r=tB("brightness"),o=tB("borderColor"),i=tB("borderRadius"),s=tB("borderSpacing"),l=tB("borderWidth"),a=tB("contrast"),c=tB("grayscale"),u=tB("hueRotate"),h=tB("invert"),d=tB("gap"),f=tB("gradientColorStops"),p=tB("gradientColorStopPositions"),m=tB("inset"),g=tB("margin"),v=tB("opacity"),b=tB("padding"),y=tB("saturate"),w=tB("scale"),x=tB("sepia"),k=tB("skew"),S=tB("space"),C=tB("translate"),O=function(){return["auto","contain","none"]},E=function(){return["auto","hidden","clip","visible","scroll"]},P=function(){return["auto",t0,t]},T=function(){return[t0,t]},M=function(){return["",tV]},A=function(){return["auto",tY,t0]},R=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},_=function(){return["solid","dashed","dotted","double","none"]},D=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},N=function(){return["start","end","center","between","around","evenly","stretch"]},L=function(){return["","0",t0]},I=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},j=function(){return[tY,tK]},B=function(){return[tY,t0]};return{cacheSize:500,theme:{colors:[t1],spacing:[tV],blur:["none","",t2,t0],brightness:j(),borderColor:[e],borderRadius:["none","","full",t2,t0],borderSpacing:T(),borderWidth:M(),contrast:j(),grayscale:L(),hueRotate:B(),invert:L(),gap:T(),gradientColorStops:[e],gradientColorStopPositions:[tJ,tU],inset:P(),margin:P(),opacity:j(),padding:T(),saturate:j(),scale:j(),sepia:L(),skew:B(),space:T(),translate:T()},classGroups:{aspect:[{aspect:["auto","square","video",t0]}],container:["container"],columns:[{columns:[t2]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(R(),[t0])}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",tZ]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",t0]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",tZ]}],"grid-cols":[{"grid-cols":[t1]}],"col-start-end":[{col:["auto",{span:["full",tZ]},t0]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[t1]}],"row-start-end":[{row:["auto",{span:[tZ]},t0]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",t0]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",t0]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal"].concat(N())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(N(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(N(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",t0,t]}],"min-w":[{"min-w":["min","max","fit",t0,tV]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[t2]},t2,t0]}],h:[{h:[t0,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",t0,tV]}],"max-h":[{"max-h":[t0,t,"min","max","fit"]}],"font-size":[{text:["base",t2,tU]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tK]}],"font-family":[{font:[t1]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",t0]}],"line-clamp":[{"line-clamp":["none",tY,tK]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",t0,tV]}],"list-image":[{"list-image":["none",t0]}],"list-style-type":[{list:["none","disc","decimal",t0]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(_(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",tV]}],"underline-offset":[{"underline-offset":["auto",t0,tV]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",t0]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",t0]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(R(),[tX])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tG]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},tQ]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[].concat(_(),["hidden"])}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:_()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:[""].concat(_())}],"outline-offset":[{"outline-offset":[t0,tV]}],"outline-w":[{outline:[tV]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[tV]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",t2,t4]}],"shadow-color":[{shadow:[t1]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":D()}],"bg-blend":[{"bg-blend":D()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",t2,t0]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",t0]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",t0]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",t0]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[tZ,t0]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",t0]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",t0]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",t0]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[tV,tK]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var nt=tj(ne),nn=Object.prototype.hasOwnProperty,nr=new Set(["string","number","boolean"]),no={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},ni=e=>e||void 0,ns=(...e)=>ni(tM(e).filter(Boolean).join(" ")),nl=null,na={},nc=!1,nu=(...e)=>t=>t.twMerge?((!nl||nc)&&(nc=!1,nl=tP(na)?nt:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?tj.apply(void 0,[ne,e].concat(n)):tj.apply(void 0,[function(){return function(e,t){for(var n in t)(function e(t,n,r){if(!nn.call(t,n)||nr.has(typeof r)||null===r){t[n]=r;return}if(Array.isArray(r)&&Array.isArray(t[n])){t[n]=t[n].concat(r);return}if("object"==typeof r&&"object"==typeof t[n]){if(null===t[n]){t[n]=r;return}for(var o in r)e(t[n],o,r[o])}})(e,n,t[n]);return e}(ne(),e)}].concat(n))}(na)),ni(nl(ns(e)))):ns(e),nh=(e,t)=>{for(let n in t)e.hasOwnProperty(n)?e[n]=ns(e[n],t[n]):e[n]=t[n];return e},nd=((e,t)=>{let{extend:n=null,slots:r={},variants:o={},compoundVariants:i=[],compoundSlots:s=[],defaultVariants:l={}}=e,a={...no,...t},c=null!=n&&n.base?ns(n.base,null==e?void 0:e.base):null==e?void 0:e.base,u=null!=n&&n.variants&&!tP(n.variants)?tR(o,n.variants):o,h=null!=n&&n.defaultVariants&&!tP(n.defaultVariants)?{...n.defaultVariants,...l}:l;tP(a.twMergeConfig)||tT(a.twMergeConfig,na)||(nc=!0,na=a.twMergeConfig);let d=tP(null==n?void 0:n.slots),f=tP(r)?{}:{base:ns(null==e?void 0:e.base,d&&(null==n?void 0:n.base)),...r},p=d?f:nh({...null==n?void 0:n.slots},tP(f)?{base:null==e?void 0:e.base}:f),m=e=>{if(tP(u)&&tP(r)&&d)return nu(c,null==e?void 0:e.class,null==e?void 0:e.className)(a);if(i&&!Array.isArray(i))throw TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof i}`);if(s&&!Array.isArray(s))throw TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof s}`);let t=(e,t,n=[],r)=>{let o=n;if("string"==typeof t)o=o.concat(t_(t).split(" ").map(t=>`${e}:${t}`));else if(Array.isArray(t))o=o.concat(t.reduce((t,n)=>t.concat(`${e}:${n}`),[]));else if("object"==typeof t&&"string"==typeof r){for(let n in t)if(t.hasOwnProperty(n)&&n===r){let i=t[n];if(i&&"string"==typeof i){let t=t_(i);o[r]?o[r]=o[r].concat(t.split(" ").map(t=>`${e}:${t}`)):o[r]=t.split(" ").map(t=>`${e}:${t}`)}else Array.isArray(i)&&i.length>0&&(o[r]=i.reduce((t,n)=>t.concat(`${e}:${n}`),[]))}}return o},o=(n,r=u,o=null,i=null)=>{var s;let l=r[n];if(!l||tP(l))return null;let c=null!=(s=null==i?void 0:i[n])?s:null==e?void 0:e[n];if(null===c)return null;let d=tE(c),f=Array.isArray(a.responsiveVariants)&&a.responsiveVariants.length>0||!0===a.responsiveVariants,p=null==h?void 0:h[n],m=[];if("object"==typeof d&&f)for(let[e,n]of Object.entries(d)){let r=l[n];if("initial"===e){p=n;continue}Array.isArray(a.responsiveVariants)&&!a.responsiveVariants.includes(e)||(m=t(e,r,m,o))}let g=l[d]||l[tE(p)];return"object"==typeof m&&"string"==typeof o&&m[o]?nh(m,g):m.length>0?(m.push(g),m):g},l=(e,t)=>{if(!u||"object"!=typeof u)return null;let n=[];for(let r in u){let i=o(r,u,e,t),s="base"===e&&"string"==typeof i?i:i&&i[e];s&&(n[n.length]=s)}return n},f={};for(let t in e)void 0!==e[t]&&(f[t]=e[t]);let m=(t,n)=>{var r;let o="object"==typeof(null==e?void 0:e[t])?{[t]:null==(r=e[t])?void 0:r.initial}:{};return{...h,...f,...o,...n}},g=(e=[],t)=>{let n=[];for(let{class:r,className:o,...i}of e){let e=!0;for(let[n,r]of Object.entries(i)){let o=m(n,t);if(Array.isArray(r)){if(!r.includes(o[n])){e=!1;break}}else if(o[n]!==r){e=!1;break}}e&&(r&&n.push(r),o&&n.push(o))}return n},v=e=>{let t=g(i,e);return tA(g(null==n?void 0:n.compoundVariants,e),t)},b=e=>{let t=v(e);if(!Array.isArray(t))return t;let n={};for(let e of t)if("string"==typeof e&&(n.base=nu(n.base,e)(a)),"object"==typeof e)for(let[t,r]of Object.entries(e))n[t]=nu(n[t],r)(a);return n},y=e=>{if(s.length<1)return null;let t={};for(let{slots:n=[],class:r,className:o,...i}of s){if(!tP(i)){let t=!0;for(let n of Object.keys(i)){let r=m(n,e)[n];if(void 0===r||(Array.isArray(i[n])?!i[n].includes(r):i[n]!==r)){t=!1;break}}if(!t)continue}for(let e of n)t[e]=t[e]||[],t[e].push([r,o])}return t};if(!tP(r)||!d){let e={};if("object"==typeof p&&!tP(p))for(let t of Object.keys(p))e[t]=e=>{var n,r;return nu(p[t],l(t,e),(null!=(n=b(e))?n:[])[t],(null!=(r=y(e))?r:[])[t],null==e?void 0:e.class,null==e?void 0:e.className)(a)};return e}return nu(c,u?Object.keys(u).map(e=>o(e,u)):null,v(),null==e?void 0:e.class,null==e?void 0:e.className)(a)};return m.variantKeys=(()=>{if(!(!u||"object"!=typeof u))return Object.keys(u)})(),m.extend=n,m.base=c,m.slots=p,m.variants=u,m.defaultVariants=h,m.compoundSlots=s,m.compoundVariants=i,m})({slots:{base:["z-0","relative","bg-transparent","before:content-['']","before:hidden","before:z-[-1]","before:absolute","before:rotate-45","before:w-2.5","before:h-2.5","before:rounded-sm","data-[arrow=true]:before:block","data-[placement=top]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]","data-[placement=top]:before:left-1/2","data-[placement=top]:before:-translate-x-1/2","data-[placement=top-start]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]","data-[placement=top-start]:before:left-3","data-[placement=top-end]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]","data-[placement=top-end]:before:right-3","data-[placement=bottom]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]","data-[placement=bottom]:before:left-1/2","data-[placement=bottom]:before:-translate-x-1/2","data-[placement=bottom-start]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]","data-[placement=bottom-start]:before:left-3","data-[placement=bottom-end]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]","data-[placement=bottom-end]:before:right-3","data-[placement=left]:before:-right-[calc(theme(spacing.5)/4_-_2px)]","data-[placement=left]:before:top-1/2","data-[placement=left]:before:-translate-y-1/2","data-[placement=left-start]:before:-right-[calc(theme(spacing.5)/4_-_3px)]","data-[placement=left-start]:before:top-1/4","data-[placement=left-end]:before:-right-[calc(theme(spacing.5)/4_-_3px)]","data-[placement=left-end]:before:bottom-1/4","data-[placement=right]:before:-left-[calc(theme(spacing.5)/4_-_2px)]","data-[placement=right]:before:top-1/2","data-[placement=right]:before:-translate-y-1/2","data-[placement=right-start]:before:-left-[calc(theme(spacing.5)/4_-_3px)]","data-[placement=right-start]:before:top-1/4","data-[placement=right-end]:before:-left-[calc(theme(spacing.5)/4_-_3px)]","data-[placement=right-end]:before:bottom-1/4","outline-none","data-[focus-visible=true]:z-10","data-[focus-visible=true]:outline-2","data-[focus-visible=true]:outline-focus","data-[focus-visible=true]:outline-offset-2"],content:["z-10","px-2.5","py-1","w-full","inline-flex","flex-col","items-center","justify-center","box-border","subpixel-antialiased","outline-none","box-border"],trigger:["z-10"],backdrop:["hidden"],arrow:[]},variants:{size:{sm:{content:"text-tiny"},md:{content:"text-small"},lg:{content:"text-medium"}},color:{default:{base:"before:bg-content1 before:shadow-small",content:"bg-content1"},foreground:{base:"before:bg-foreground",content:"bg-foreground text-background"},primary:{base:"before:bg-primary",content:"bg-primary text-primary-foreground"},secondary:{base:"before:bg-secondary",content:"bg-secondary text-secondary-foreground"},success:{base:"before:bg-success",content:"bg-success text-success-foreground"},warning:{base:"before:bg-warning",content:"bg-warning text-warning-foreground"},danger:{base:"before:bg-danger",content:"bg-danger text-danger-foreground"}},radius:{none:{content:"rounded-none"},sm:{content:"rounded-small"},md:{content:"rounded-medium"},lg:{content:"rounded-large"},full:{content:"rounded-full"}},shadow:{sm:{content:"shadow-small"},md:{content:"shadow-medium"},lg:{content:"shadow-large"}},backdrop:{transparent:{},opaque:{backdrop:"bg-overlay/50 backdrop-opacity-disabled"},blur:{backdrop:"backdrop-blur-sm backdrop-saturate-150 bg-overlay/30"}},triggerScaleOnOpen:{true:{trigger:["aria-expanded:scale-[0.97]","aria-expanded:opacity-70","subpixel-antialiased"]},false:{}},disableAnimation:{true:{base:"animate-none"}},isTriggerDisabled:{true:{trigger:"opacity-disabled pointer-events-none"},false:{}}},defaultVariants:{color:"default",radius:"lg",size:"md",shadow:"md",backdrop:"transparent",triggerScaleOnOpen:!0},compoundVariants:[{backdrop:["opaque","blur"],class:{backdrop:"block w-full h-full fixed inset-0 -z-30"}}]},{...s,twMerge:null==(l=null==s?void 0:s.twMerge)||l,twMergeConfig:{...null==s?void 0:s.twMergeConfig,theme:{...null==(a=null==s?void 0:s.twMergeConfig)?void 0:a.theme,...tO.theme},classGroups:{...null==(c=null==s?void 0:s.twMergeConfig)?void 0:c.classGroups,...tO.classGroups}}}),nf=Object.create,np=Object.defineProperty,nm=Object.getOwnPropertyDescriptor,ng=Object.getOwnPropertyNames,nv=Object.getPrototypeOf,nb=Object.prototype.hasOwnProperty,ny=(e,t)=>function(){return t||(0,e[ng(e)[0]])((t={exports:{}}).exports,t),t.exports},nw=ny({"../../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.production.min.js"(e){var t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),d=Symbol.iterator,f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p=Object.assign,m={};function g(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||f}function v(){}function b(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||f}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): 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")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=g.prototype;var y=b.prototype=new v;y.constructor=b,p(y,g.prototype),y.isPureReactComponent=!0;var w=Array.isArray,x=Object.prototype.hasOwnProperty,k={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function C(e,n,r){var o,i={},s=null,l=null;if(null!=n)for(o in void 0!==n.ref&&(l=n.ref),void 0!==n.key&&(s=""+n.key),n)x.call(n,o)&&!S.hasOwnProperty(o)&&(i[o]=n[o]);var a=arguments.length-2;if(1===a)i.children=r;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(o in a=e.defaultProps)void 0===i[o]&&(i[o]=a[o]);return{$$typeof:t,type:e,key:s,ref:l,props:i,_owner:k.current}}function O(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var E=/\/+/g;function P(e,t){var n,r;return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36)}function T(e,r,o){if(null==e)return e;var i=[],s=0;return!function e(r,o,i,s,l){var a,c,u,h=typeof r;("undefined"===h||"boolean"===h)&&(r=null);var f=!1;if(null===r)f=!0;else switch(h){case"string":case"number":f=!0;break;case"object":switch(r.$$typeof){case t:case n:f=!0}}if(f)return l=l(f=r),r=""===s?"."+P(f,0):s,w(l)?(i="",null!=r&&(i=r.replace(E,"$&/")+"/"),e(l,o,i,"",function(e){return e})):null!=l&&(O(l)&&(a=l,c=i+(!l.key||f&&f.key===l.key?"":(""+l.key).replace(E,"$&/")+"/")+r,l={$$typeof:t,type:a.type,key:c,ref:a.ref,props:a.props,_owner:a._owner}),o.push(l)),1;if(f=0,s=""===s?".":s+":",w(r))for(var p=0;p<r.length;p++){var m=s+P(h=r[p],p);f+=e(h,o,i,m,l)}else if("function"==typeof(m=null===(u=r)||"object"!=typeof u?null:"function"==typeof(u=d&&u[d]||u["@@iterator"])?u:null))for(r=m.call(r),p=0;!(h=r.next()).done;)m=s+P(h=h.value,p++),f+=e(h,o,i,m,l);else if("object"===h)throw Error("Objects are not valid as a React child (found: "+("[object Object]"===(o=String(r))?"object with keys {"+Object.keys(r).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.");return f}(e,i,"","",function(e){return r.call(o,e,s++)}),i}function M(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var A={current:null},R={transition:null};e.Children={map:T,forEach:function(e,t,n){T(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return T(e,function(){t++}),t},toArray:function(e){return T(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},e.Component=g,e.Fragment=r,e.Profiler=i,e.PureComponent=b,e.StrictMode=o,e.Suspense=c,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED={ReactCurrentDispatcher:A,ReactCurrentBatchConfig:R,ReactCurrentOwner:k},e.cloneElement=function(e,n,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=p({},e.props),i=e.key,s=e.ref,l=e._owner;if(null!=n){if(void 0!==n.ref&&(s=n.ref,l=k.current),void 0!==n.key&&(i=""+n.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in n)x.call(n,c)&&!S.hasOwnProperty(c)&&(o[c]=void 0===n[c]&&void 0!==a?a[c]:n[c])}var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];o.children=a}return{$$typeof:t,type:e.type,key:i,ref:s,props:o,_owner:l}},e.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},e.createElement=C,e.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:a,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},e.startTransition=function(e){var t=R.transition;R.transition={};try{e()}finally{R.transition=t}},e.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},e.useCallback=function(e,t){return A.current.useCallback(e,t)},e.useContext=function(e){return A.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return A.current.useDeferredValue(e)},e.useEffect=function(e,t){return A.current.useEffect(e,t)},e.useId=function(){return A.current.useId()},e.useImperativeHandle=function(e,t,n){return A.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return A.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return A.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return A.current.useMemo(e,t)},e.useReducer=function(e,t,n){return A.current.useReducer(e,t,n)},e.useRef=function(e){return A.current.useRef(e)},e.useState=function(e){return A.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return A.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return A.current.useTransition()},e.version="18.2.0"}});ny({"../../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js"(e,t){}}),i=null!=(r=ny({"../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.js"(e,t){t.exports=nw()}})())?nf(nv(r)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of ng(t))nb.call(e,o)||o===n||np(e,o,{get:()=>t[o],enumerable:!(r=nm(t,o))||r.enumerable})})(!o&&r&&r.__esModule?i:np(i,"default",{value:r,enumerable:!0}),r);var nx=e=>e?"true":void 0;"undefined"!=typeof window&&window.document&&window.document.createElement;var nk=e=>{let t={top:{originY:1},bottom:{originY:0},left:{originX:1},right:{originX:0},"top-start":{originX:0,originY:1},"top-end":{originX:1,originY:1},"bottom-start":{originX:0,originY:0},"bottom-end":{originX:1,originY:0},"right-start":{originX:0,originY:0},"right-end":{originX:0,originY:1},"left-start":{originX:1,originY:0},"left-end":{originX:1,originY:1}};return(null==t?void 0:t[e])||{}},nS=e=>({top:"top",bottom:"bottom",left:"left",right:"right","top-start":"top start","top-end":"top end","bottom-start":"bottom start","bottom-end":"bottom end","left-start":"left top","left-end":"left bottom","right-start":"right top","right-end":"right bottom"})[e],nC=(e,t)=>{if(t.includes("-")){let[,n]=t.split("-");return`${e}-${n}`}return e},nO=(null==globalThis?void 0:globalThis.document)?p.useLayoutEffect:p.useEffect,nE=n(73935);let nP=p.createContext(null);function nT(e){let{children:t}=e,n=(0,p.useContext)(nP),[r,o]=(0,p.useState)(0),i=(0,p.useMemo)(()=>({parent:n,modalCount:r,addModal(){o(e=>e+1),n&&n.addModal()},removeModal(){o(e=>e-1),n&&n.removeModal()}}),[n,r]);return p.createElement(nP.Provider,{value:i},t)}function nM(e){let t;let{modalProviderProps:n}={modalProviderProps:{"aria-hidden":!!(t=(0,p.useContext)(nP))&&t.modalCount>0||void 0}};return p.createElement("div",{"data-overlay-container":!0,...e,...n})}function nA(e){return p.createElement(nT,null,p.createElement(nM,e))}function nR(e){let t=M(),{portalContainer:n=t?null:document.body,...r}=e;if(p.useEffect(()=>{if(null==n?void 0:n.closest("[data-overlay-container]"))throw Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[n]),!n)return null;let o=p.createElement(nA,r);return nE.createPortal(o,n)}let n_=(0,p.createContext)({strict:!1});var nD=n(9442);function nN(e){for(let t in e)nD.featureDefinitions[t]={...nD.featureDefinitions[t],...e[t]}}function nL({children:e,features:t,strict:n=!1}){let[,r]=(0,p.useState)(!nI(t)),o=(0,p.useRef)(void 0);if(!nI(t)){let{renderer:e,...n}=t;o.current=e,nN(n)}return(0,p.useEffect)(()=>{nI(t)&&t().then(({renderer:e,...t})=>{nN(t),o.current=e,r(!0)})},[]),(0,f.jsx)(n_.Provider,{value:{renderer:o.current,strict:n},children:e})}function nI(e){return"function"==typeof e}let nj=(0,p.createContext)({}),nB=(0,p.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),nW=(0,p.createContext)({});var nF=n(7504),n$=n(97732);function nz(e){return Array.isArray(e)?e.join(" "):e}var nH=n(11741);let nq=Symbol.for("motionComponentSymbol");function nV(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let{schedule:nU,cancel:nG}=(0,n(93674).Z)(queueMicrotask,!1);var nX=n(68588);let nQ=(0,p.createContext)(null),nK=(0,p.createContext)({}),nY=nH.j?p.useLayoutEffect:p.useEffect;var nJ=n(32558),nZ=n(96728),n0=n(41069);let n1=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function n2(e,t,n){for(let r in t)(0,nJ.i)(t[r])||(0,nZ.j)(r,n)||(e[r]=t[r])}var n4=n(42617);let n5=()=>({...n1(),attrs:{}});var n3=n(79854);let n6=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function n9(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||n6.has(e)}let n8=e=>!n9(e);try{u=require("@emotion/is-prop-valid").default,"function"==typeof u&&(n8=e=>e.startsWith("on")?!n9(e):u(e))}catch{}var n7=n(62627),re=n(2445),rt=n(79432);function rn(e){let t=(0,p.useRef)(null);return null===t.current&&(t.current=e()),t.current}let rr=e=>(t,n)=>{let r=(0,p.useContext)(nW),o=(0,p.useContext)(nQ),i=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,o){return{latestValues:function(e,t,n,r){let o={},i=r(e,{});for(let e in i){var s;o[e]=(s=i[e],(0,nJ.i)(s)?s.get():s)}let{initial:l,animate:a}=e,c=(0,nF.G)(e),u=(0,nF.M)(e);t&&u&&!c&&!1!==e.inherit&&(void 0===l&&(l=t.initial),void 0===a&&(a=t.animate));let h=!!n&&!1===n.initial,d=(h=h||!1===l)?a:l;if(d&&"boolean"!=typeof d&&!(0,re.H)(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=(0,rt.o)(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=h?t.length-1:0;t=t[e]}null!==t&&(o[e]=t)}for(let t in e)o[t]=e[t]}}}return o}(n,r,o,e),renderState:t()}})(e,t,r,o);return n?i():rn(i)},ro={useVisualState:rr({scrapeMotionValuesFromProps:n(50189).U,createRenderState:n1})},ri={useVisualState:rr({scrapeMotionValuesFromProps:n(16832).U,createRenderState:n5})},rs=function(e){if("undefined"==typeof Proxy)return e;let t=new Map;return new Proxy((...t)=>e(...t),{get:(n,r)=>"create"===r?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}(function(e,{forwardMotionProps:t}={forwardMotionProps:!1}){return function({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:o}){function i(e,i){var s;let l;let a={...(0,p.useContext)(nB),...e,layoutId:function({layoutId:e}){let t=(0,p.useContext)(nj).id;return t&&void 0!==e?t+"-"+e:e}(e)},{isStatic:c}=a,u=function(e){let{initial:t,animate:n}=function(e,t){if((0,nF.G)(e)){let{initial:t,animate:n}=e;return{initial:!1===t||(0,n$.$)(t)?t:void 0,animate:(0,n$.$)(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,p.useContext)(nW));return(0,p.useMemo)(()=>({initial:t,animate:n}),[nz(t),nz(n)])}(e),h=r(e,c);if(!c&&nH.j){(0,p.useContext)(n_).strict;let e=function(e){let{drag:t,layout:n}=nD.featureDefinitions;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(a);l=e.MeasureLayout,u.visualElement=function(e,t,n,r,o){let{visualElement:i}=(0,p.useContext)(nW),s=(0,p.useContext)(n_),l=(0,p.useContext)(nQ),a=(0,p.useContext)(nB).reducedMotion,c=(0,p.useRef)(null);r=r||s.renderer,!c.current&&r&&(c.current=r(e,{visualState:t,parent:i,props:n,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:a}));let u=c.current,h=(0,p.useContext)(nK);u&&!u.projection&&o&&("html"===u.type||"svg"===u.type)&&function(e,t,n,r){let{layoutId:o,layout:i,drag:s,dragConstraints:l,layoutScroll:a,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:!!s||l&&nV(l),visualElement:e,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:a,layoutRoot:c})}(c.current,n,o,h);let d=(0,p.useRef)(!1);(0,p.useInsertionEffect)(()=>{u&&d.current&&u.update(n,l)});let f=n[nX.M],m=(0,p.useRef)(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return nY(()=>{u&&(d.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),nU.render(u.render),m.current&&u.animationState&&u.animationState.animateChanges())}),(0,p.useEffect)(()=>{u&&(!m.current&&u.animationState&&u.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),m.current=!1))}),u}(o,h,a,t,e.ProjectionNode)}return(0,f.jsxs)(nW.Provider,{value:u,children:[l&&u.visualElement?(0,f.jsx)(l,{visualElement:u.visualElement,...a}):null,n(o,e,(s=u.visualElement,(0,p.useCallback)(e=>{e&&h.onMount&&h.onMount(e),s&&(e?s.mount(e):s.unmount()),i&&("function"==typeof i?i(e):nV(i)&&(i.current=e))},[s])),h,c,u.visualElement)]})}e&&nN(e),i.displayName=`motion.${"string"==typeof o?o:`create(${o.displayName??o.name??""})`}`;let s=(0,p.forwardRef)(i);return s[nq]=o,s}({...(0,n7.q)(e)?ri:ro,preloadedFeatures:void 0,useRender:function(e=!1){return(t,n,r,{latestValues:o},i)=>{let s=((0,n7.q)(t)?function(e,t,n,r){let o=(0,p.useMemo)(()=>{let n=n5();return(0,n4.i)(n,t,(0,n3.a)(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};n2(t,e.style,e),o.style={...t,...o.style}}return o}:function(e,t){let n={},r=function(e,t){let n=e.style||{},r={};return n2(r,n,e),Object.assign(r,function({transformTemplate:e},t){return(0,p.useMemo)(()=>{let n=n1();return(0,n0.r)(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),r}(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n})(n,o,i,t),l=function(e,t,n){let r={};for(let o in e)("values"!==o||"object"!=typeof e.values)&&(n8(o)||!0===n&&n9(o)||!t&&!n9(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}(n,"string"==typeof t,e),a=t!==p.Fragment?{...l,...s,ref:r}:{},{children:c}=n,u=(0,p.useMemo)(()=>(0,nJ.i)(c)?c.get():c,[c]);return(0,p.createElement)(t,{...a,children:u})}}(t),createVisualElement:void 0,Component:e})});var rl=n(77596);class ra extends p.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=(0,rl.R)(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=n-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}}function rc({children:e,isPresent:t,anchorX:n}){let r=(0,p.useId)(),o=(0,p.useRef)(null),i=(0,p.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:s}=(0,p.useContext)(nB);return(0,p.useInsertionEffect)(()=>{let{width:e,height:l,top:a,left:c,right:u}=i.current;if(t||!o.current||!e||!l)return;let h="left"===n?`left: ${c}`:`right: ${u}`;o.current.dataset.motionPopId=r;let d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(`
          [data-motion-pop-id="${r}"] {
            position: absolute !important;
            width: ${e}px !important;
            height: ${l}px !important;
            ${h}px !important;
            top: ${a}px !important;
          }
        `),()=>{document.head.contains(d)&&document.head.removeChild(d)}},[t]),(0,f.jsx)(ra,{isPresent:t,childRef:o,sizeRef:i,children:p.cloneElement(e,{ref:o})})}let ru=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:i,mode:s,anchorX:l})=>{let a=rn(rh),c=(0,p.useId)(),u=!0,h=(0,p.useMemo)(()=>(u=!1,{id:c,initial:t,isPresent:n,custom:o,onExitComplete:e=>{for(let t of(a.set(e,!0),a.values()))if(!t)return;r&&r()},register:e=>(a.set(e,!1),()=>a.delete(e))}),[n,a,r]);return i&&u&&(h={...h}),(0,p.useMemo)(()=>{a.forEach((e,t)=>a.set(t,!1))},[n]),p.useEffect(()=>{n||a.size||!r||r()},[n]),"popLayout"===s&&(e=(0,f.jsx)(rc,{isPresent:n,anchorX:l,children:e})),(0,f.jsx)(nQ.Provider,{value:h,children:e})};function rh(){return new Map}let rd=e=>e.key||"";function rf(e){let t=[];return p.Children.forEach(e,e=>{(0,p.isValidElement)(e)&&t.push(e)}),t}let rp=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:i="sync",propagate:s=!1,anchorX:l="left"})=>{let[a,c]=function(e=!0){let t=(0,p.useContext)(nQ);if(null===t)return[!0,null];let{isPresent:n,onExitComplete:r,register:o}=t,i=(0,p.useId)();(0,p.useEffect)(()=>{if(e)return o(i)},[e]);let s=(0,p.useCallback)(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,s]:[!0]}(s),u=(0,p.useMemo)(()=>rf(e),[e]),h=s&&!a?[]:u.map(rd),d=(0,p.useRef)(!0),m=(0,p.useRef)(u),g=rn(()=>new Map),[v,b]=(0,p.useState)(u),[y,w]=(0,p.useState)(u);nY(()=>{d.current=!1,m.current=u;for(let e=0;e<y.length;e++){let t=rd(y[e]);h.includes(t)?g.delete(t):!0!==g.get(t)&&g.set(t,!1)}},[y,h.length,h.join("-")]);let x=[];if(u!==v){let e=[...u];for(let t=0;t<y.length;t++){let n=y[t],r=rd(n);h.includes(r)||(e.splice(t,0,n),x.push(n))}return"wait"===i&&x.length&&(e=x),w(rf(e)),b(u),null}let{forceRender:k}=(0,p.useContext)(nj);return(0,f.jsx)(f.Fragment,{children:y.map(e=>{let p=rd(e),v=(!s||!!a)&&(u===y||h.includes(p));return(0,f.jsx)(ru,{isPresent:v,initial:(!d.current||!!n)&&void 0,custom:t,presenceAffectsLayout:o,mode:i,onExitComplete:v?void 0:()=>{if(!g.has(p))return;g.set(p,!0);let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(k?.(),w(m.current),s&&c?.(),r&&r())},anchorX:l,children:e},p)})})};var rm={enter:{transform:"scale(1)",opacity:1,transition:{type:"spring",bounce:0,duration:.2}},exit:{transform:"scale(0.85)",opacity:0,transition:{type:"easeOut",duration:.15}}},rg={},rv=()=>n.e(937).then(n.bind(n,83937)).then(e=>e.default),rb=(h=(e,t)=>{let n;let{Component:r,children:o,content:i,isOpen:s,portalContainer:l,placement:a,disableAnimation:c,motionProps:u,getTriggerProps:h,getTooltipProps:d,getTooltipContentProps:x}=function(e){var t,n;let r=tk(),[o,i]=tS(e,nd.variantKeys),{ref:s,as:l,isOpen:a,content:c,children:u,defaultOpen:h,onOpenChange:d,isDisabled:f,trigger:x,shouldFlip:k=!0,containerPadding:S=12,placement:C="top",delay:E=0,closeDelay:P=500,showArrow:T=!1,offset:_=7,crossOffset:N=0,isDismissable:L,shouldCloseOnBlur:I=!0,portalContainer:j,isKeyboardDismissDisabled:B=!1,updatePositionDeps:W=[],shouldCloseOnInteractOutside:F,className:$,onClose:z,motionProps:H,classNames:V,...G}=o,X=null!=(n=null!=(t=null==e?void 0:e.disableAnimation)?t:null==r?void 0:r.disableAnimation)&&n,Q=function(e={}){let{delay:t=1500,closeDelay:n=500}=e,{isOpen:r,open:o,close:i}=function(e){let[t,n]=function(e,t,n){let[r,o]=(0,p.useState)(e||t),i=(0,p.useRef)(void 0!==e),s=void 0!==e;(0,p.useEffect)(()=>{let e=i.current;e!==s&&console.warn(`WARN: A component changed from ${e?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}.`),i.current=s},[s]);let l=s?e:r,a=(0,p.useCallback)((e,...t)=>{let r=(e,...t)=>{n&&!Object.is(l,e)&&n(e,...t),s||(l=e)};"function"==typeof e?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),o((n,...o)=>{let i=e(s?l:n,...o);return(r(i,...t),s)?n:i})):(s||o(e),r(e,...t))},[s,l,n]);return[l,a]}(e.isOpen,e.defaultOpen||!1,e.onOpenChange),r=(0,p.useCallback)(()=>{n(!0)},[n]),o=(0,p.useCallback)(()=>{n(!1)},[n]),i=(0,p.useCallback)(()=>{n(!t)},[n,t]);return{isOpen:t,setOpen:n,open:r,close:o,toggle:i}}(e),s=(0,p.useMemo)(()=>`${++g}`,[]),l=(0,p.useRef)(null),a=(0,p.useRef)(i),c=()=>{m[s]=d},u=()=>{for(let e in m)e!==s&&(m[e](!0),delete m[e])},h=()=>{l.current&&clearTimeout(l.current),l.current=null,u(),c(),v=!0,o(),b&&(clearTimeout(b),b=null),y&&(clearTimeout(y),y=null)},d=e=>{e||n<=0?(l.current&&clearTimeout(l.current),l.current=null,a.current()):l.current||(l.current=setTimeout(()=>{l.current=null,a.current()},n)),b&&(clearTimeout(b),b=null),v&&(y&&clearTimeout(y),y=setTimeout(()=>{delete m[s],y=null,v=!1},Math.max(500,n)))},f=()=>{u(),c(),r||b||v?r||h():b=setTimeout(()=>{b=null,v=!0,h()},t)};return(0,p.useEffect)(()=>{a.current=i},[i]),(0,p.useEffect)(()=>()=>{l.current&&clearTimeout(l.current),m[s]&&delete m[s]},[s]),{isOpen:r,open:e=>{e||!(t>0)||l.current?h():f()},close:d}}({delay:E,closeDelay:P,isDisabled:f,defaultOpen:h,isOpen:a,onOpenChange:e=>{null==d||d(e),e||null==z||z()}}),K=(0,p.useRef)(null),Y=(0,p.useRef)(null),J=(0,p.useId)(),Z=Q.isOpen&&!f;(0,p.useImperativeHandle)(s,()=>({UNSAFE_getDOMNode:()=>Y.current}));let{triggerProps:ee,tooltipProps:et}=function(e,t,n){let{isDisabled:r,trigger:o}=e,i=function(e){let[t,n]=(0,p.useState)(void 0),r=(0,p.useRef)(null),o=O(t),i=(0,p.useCallback)(e=>{r.current=e},[]);return A&&(R.has(o)&&!R.get(o).includes(i)?R.set(o,[...R.get(o),i]):R.set(o,[i])),w(()=>()=>{R.delete(o)},[o]),(0,p.useEffect)(()=>{let e=r.current;e&&(r.current=null,n(e))}),o}(),s=(0,p.useRef)(!1),l=(0,p.useRef)(!1),a=()=>{(s.current||l.current)&&t.open(l.current)},c=e=>{s.current||l.current||t.close(e)};(0,p.useEffect)(()=>{let e=e=>{n&&n.current&&"Escape"===e.key&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[n,t]);let u=()=>{l.current=!1,s.current=!1,c(!0)},{hoverProps:h}=eu({isDisabled:r,onHoverStart:()=>{"focus"!==o&&("pointer"===U?s.current=!0:s.current=!1,a())},onHoverEnd:()=>{"focus"!==o&&(l.current=!1,s.current=!1,c())}}),{focusableProps:d}=function(e,t){let{focusProps:n}=function(e){let t,n,{isDisabled:r,onFocus:o,onBlur:i,onFocusChange:s}=e,l=(0,p.useCallback)(e=>{if(e.target===e.currentTarget)return i&&i(e),s&&s(!1),!0},[i,s]),a=(t=(0,p.useRef)({isFocused:!1,observer:null}),eh(()=>{let e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),n=function(e){let t=(0,p.useRef)(null);return eh(()=>{t.current=e},[e]),(0,p.useCallback)((...e)=>{let n=t.current;return null==n?void 0:n(...e)},[])}(e=>{null==l||l(e)}),(0,p.useCallback)(e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target;r.addEventListener("focusout",e=>{t.current.isFocused=!1,r.disabled&&n((e.nativeEvent=e,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e)),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;null===(e=t.current.observer)||void 0===e||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent("blur",{relatedTarget:n})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[n])),c=(0,p.useCallback)(e=>{let t=ex(e.target),n=t?eI(t):eI();e.target===e.currentTarget&&n===e.nativeEvent.target&&(o&&o(e),s&&s(!0),a(e))},[s,o,a]);return{focusProps:{onFocus:!r&&(o||s||i)?c:void 0,onBlur:!r&&(i||s)?l:void 0}}}(e),{keyboardProps:r}={keyboardProps:e.isDisabled?{}:{onKeyDown:ez(e.onKeyDown),onKeyUp:ez(e.onKeyUp)}},o=eq(n,r),i=function(e){let t=(0,p.useContext)(eV)||{};eh(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}});let{ref:n,...r}=t;return r}(t),s=e.isDisabled?{}:i,l=(0,p.useRef)(e.autoFocus);(0,p.useEffect)(()=>{l.current&&t.current&&function(e){let t=ex(e),n=eI(t);if("virtual"===eS){var r;r=()=>{eI(t)===n&&e.isConnected&&eF(e)},requestAnimationFrame(()=>{(function(){for(let[e]of ej)"isConnected"in e&&!e.isConnected&&ej.delete(e)})(),0===ej.size?r():eB.add(r)})}else eF(e)}(t.current),l.current=!1},[t]);let a=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(a=void 0),{focusableProps:eq({...o,tabIndex:a},s)}}({isDisabled:r,onFocus:()=>{"pointer"!==U&&(l.current=!0,a())},onBlur:()=>{l.current=!1,s.current=!1,c(!0)}},n);return{triggerProps:{"aria-describedby":t.isOpen?i:void 0,...D(d,h,{onPointerDown:u,onKeyDown:u})},tooltipProps:{id:i}}}({isDisabled:f,trigger:x},Q,K),{tooltipProps:en}=function(e,t){let n=function(e,t={}){let{labelable:n,isLink:r,propNames:o}=t,i={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(eU.has(t)||n&&eG.has(t)||r&&eX.has(t)||(null==o?void 0:o.has(t))||eQ.test(t))&&(i[t]=e[t]);return i}(e,{labelable:!0}),{hoverProps:r}=eu({onHoverStart:()=>null==t?void 0:t.open(!0),onHoverEnd:()=>null==t?void 0:t.close()});return{tooltipProps:D(n,r,{role:"tooltip"})}}({isOpen:Z,...D(o,et)},Q),{overlayProps:er,placement:eo,updatePosition:ei}=function(e){var t,n,r;let o;let{direction:i}=(o=function(){let e=M(),[t,n]=(0,p.useState)(ta);return((0,p.useEffect)(()=>(0===tc.size&&window.addEventListener("languagechange",tu),tc.add(n),()=>{tc.delete(n),0===tc.size&&window.removeEventListener("languagechange",tu)}),[]),e)?{locale:"en-US",direction:"ltr"}:t}(),(0,p.useContext)(th)||o),{arrowSize:s=0,targetRef:l,overlayRef:a,scrollRef:c=a,placement:u="bottom",containerPadding:h=12,shouldFlip:d=!0,boundaryElement:f="undefined"!=typeof document?document.body:null,offset:m=0,crossOffset:g=0,shouldUpdatePosition:v=!0,isOpen:b=!0,onClose:y,maxHeight:x,arrowBoundaryOffset:k=0}=e,[S,C]=(0,p.useState)(null),O=[v,u,a.current,l.current,c.current,h,d,f,m,g,b,i,x,k,s],E=(0,p.useRef)(null==td?void 0:td.scale);(0,p.useEffect)(()=>{b&&(E.current=null==td?void 0:td.scale)},[b]);let P=(0,p.useCallback)(()=>{var e,t,n,r,o;if(!1===v||!b||!a.current||!l.current||!f||(null==td?void 0:td.scale)!==E.current)return;let p=null;if(c.current&&c.current.contains(document.activeElement)){let r=null===(e=document.activeElement)||void 0===e?void 0:e.getBoundingClientRect(),o=c.current.getBoundingClientRect();(p={type:"top",offset:(null!==(t=null==r?void 0:r.top)&&void 0!==t?t:0)-o.top}).offset>o.height/2&&(p.type="bottom",p.offset=(null!==(n=null==r?void 0:r.bottom)&&void 0!==n?n:0)-o.bottom)}let y=a.current;!x&&a.current&&(y.style.top="0px",y.style.bottom="",y.style.maxHeight=(null!==(o=null===(r=window.visualViewport)||void 0===r?void 0:r.height)&&void 0!==o?o:window.innerHeight)+"px");let w=function(e){var t,n,r,o;let i;let{placement:s,targetNode:l,overlayNode:a,scrollNode:c,padding:u,shouldFlip:h,boundaryElement:d,offset:f,crossOffset:p,maxHeight:m,arrowSize:g=0,arrowBoundaryOffset:v=0}=e,b=a instanceof HTMLElement?function(e){let t=e.offsetParent;if(t&&t===document.body&&"static"===window.getComputedStyle(t).position&&!tt(t)&&(t=document.documentElement),null==t)for(t=e.parentElement;t&&!tt(t);)t=t.parentElement;return t||document.documentElement}(a):document.documentElement,y=b===document.documentElement,w=window.getComputedStyle(b).position,x=y?e7(l):te(l,b);if(!y){let{marginTop:e,marginLeft:t}=window.getComputedStyle(l);x.top+=parseInt(e,10)||0,x.left+=parseInt(t,10)||0}let k=e7(a),S={top:parseInt((i=window.getComputedStyle(a)).marginTop,10)||0,bottom:parseInt(i.marginBottom,10)||0,left:parseInt(i.marginLeft,10)||0,right:parseInt(i.marginRight,10)||0};k.width+=(null!==(t=S.left)&&void 0!==t?t:0)+(null!==(n=S.right)&&void 0!==n?n:0),k.height+=(null!==(r=S.top)&&void 0!==r?r:0)+(null!==(o=S.bottom)&&void 0!==o?o:0);let C={top:c.scrollTop,left:c.scrollLeft,width:c.scrollWidth,height:c.scrollHeight},O=e5(d),E=e5(b),P="BODY"===d.tagName?e7(b):te(b,d);return"HTML"===b.tagName&&"BODY"===d.tagName&&(E.scroll.top=0,E.scroll.left=0),function(e,t,n,r,o,i,s,l,a,c,u,h,d,f,p,m){var g,v,b,y;let w=e6(e),{size:x,crossAxis:k,crossSize:S,placement:C,crossPlacement:O}=w,E=e9(t,l,n,w,u,h,c,d,p,m),P=u,T=e8(l,c,t,o,i+u,w);if(s&&r[x]>T){let e=e6(`${eJ[C]} ${O}`),r=e9(t,l,n,e,u,h,c,d,p,m);e8(l,c,t,o,i+u,e)>T&&(w=e,E=r,P=u)}let M="bottom";"top"===w.axis?"top"===w.placement?M="top":"bottom"===w.placement&&(M="bottom"):"top"===w.crossAxis&&("top"===w.crossPlacement?M="bottom":"bottom"===w.crossPlacement&&(M="top"));let A=e3(k,E[k],n[S],l,a,i,c);E[k]+=A;let R=function(e,t,n,r,o,i,s,l){var a,c,u,h,d,f,p;let m=r?n.height:t[e1.height],g=null!=e.top?n.top+e.top:n.top+(m-(null!==(a=e.bottom)&&void 0!==a?a:0)-s),v="top"!==l?Math.max(0,t.height+t.top+(null!==(c=t.scroll.top)&&void 0!==c?c:0)-g-((null!==(u=o.top)&&void 0!==u?u:0)+(null!==(h=o.bottom)&&void 0!==h?h:0)+i)):Math.max(0,g+s-(t.top+(null!==(d=t.scroll.top)&&void 0!==d?d:0))-((null!==(f=o.top)&&void 0!==f?f:0)+(null!==(p=o.bottom)&&void 0!==p?p:0)+i));return Math.min(t.height-2*i,v)}(E,l,c,d,o,i,n.height,M);f&&f<R&&(R=f),n.height=Math.min(n.height,R),A=e3(k,(E=e9(t,l,n,w,P,h,c,d,p,m))[k],n[S],l,a,i,c),E[k]+=A;let _={},D=t[k]+.5*t[S]-E[k]-o[eY[k]],N=p/2+m,L="left"===eY[k]?(null!==(g=o.left)&&void 0!==g?g:0)+(null!==(v=o.right)&&void 0!==v?v:0):(null!==(b=o.top)&&void 0!==b?b:0)+(null!==(y=o.bottom)&&void 0!==y?y:0),I=n[S]-L-p/2-m,j=eK(D,t[k]+p/2-(E[k]+o[eY[k]]),t[k]+t[S]-p/2-(E[k]+o[eY[k]]));return _[k]=eK(j,N,I),{position:E,maxHeight:R,arrowOffsetLeft:_.left,arrowOffsetTop:_.top,placement:w.placement}}(s,x,k,C,S,u,h,O,E,P,f,p,!!w&&"static"!==w,m,g,v)}({placement:"rtl"===i?u.replace("start","right").replace("end","left"):u.replace("start","left").replace("end","right"),overlayNode:a.current,targetNode:l.current,scrollNode:c.current||a.current,padding:h,shouldFlip:d,boundaryElement:f,offset:m,crossOffset:g,maxHeight:x,arrowSize:s,arrowBoundaryOffset:k});if(w.position){if(y.style.top="",y.style.bottom="",y.style.left="",y.style.right="",Object.keys(w.position).forEach(e=>y.style[e]=w.position[e]+"px"),y.style.maxHeight=null!=w.maxHeight?w.maxHeight+"px":"",p&&document.activeElement&&c.current){let e=document.activeElement.getBoundingClientRect(),t=c.current.getBoundingClientRect(),n=e[p.type]-t[p.type];c.current.scrollTop+=n-p.offset}C(w)}},O);w(P,O),w(()=>(window.addEventListener("resize",r,!1),()=>{window.removeEventListener("resize",r,!1)}),[r=P]),tr({ref:a,onResize:P}),tr({ref:l,onResize:P});let T=(0,p.useRef)(!1);w(()=>{let e;let t=()=>{T.current=!0,clearTimeout(e),e=setTimeout(()=>{T.current=!1},500),P()},n=()=>{T.current&&t()};return null==td||td.addEventListener("resize",t),null==td||td.addEventListener("scroll",n),()=>{null==td||td.removeEventListener("resize",t),null==td||td.removeEventListener("scroll",n)}},[P]);let A=(0,p.useCallback)(()=>{T.current||null==y||y()},[y,T]);return function(e){let{triggerRef:t,isOpen:n,onClose:r}=e;(0,p.useEffect)(()=>{if(!n||null===r)return;let e=e=>{let n=e.target;if(!t.current||n instanceof Node&&!n.contains(t.current)||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)return;let o=r||tn.get(t.current);o&&o()};return window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("scroll",e,!0)}},[n,r,t])}({triggerRef:l,isOpen:b,onClose:y&&A}),{overlayProps:{style:{position:"absolute",zIndex:1e5,...null==S?void 0:S.position,maxHeight:null!==(t=null==S?void 0:S.maxHeight)&&void 0!==t?t:"100vh"}},placement:null!==(n=null==S?void 0:S.placement)&&void 0!==n?n:null,arrowProps:{"aria-hidden":"true",role:"presentation",style:{left:null==S?void 0:S.arrowOffsetLeft,top:null==S?void 0:S.arrowOffsetTop}},updatePosition:P}}({isOpen:Z,targetRef:K,placement:nS(C),overlayRef:Y,offset:T?_+3:_,crossOffset:N,shouldFlip:k,containerPadding:S});nO(()=>{W.length&&ei()},W);let{overlayProps:es}=function(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:o,isDismissable:i=!1,isKeyboardDismissDisabled:s=!1,shouldCloseOnInteractOutside:l}=e;(0,p.useEffect)(()=>(o&&tw.push(t),()=>{let e=tw.indexOf(t);e>=0&&tw.splice(e,1)}),[o,t]);let a=()=>{tw[tw.length-1]===t&&n&&n()};!function(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:o}=e,i=(0,p.useRef)({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=tv(e=>{n&&tb(e,t)&&(o&&o(e),i.current.isPointerDown=!0)}),l=tv(e=>{n&&n(e)});(0,p.useEffect)(()=>{let e=i.current;if(r)return;let n=q(t.current);if("undefined"!=typeof PointerEvent){let r=n=>{e.isPointerDown&&tb(n,t)&&l(n),e.isPointerDown=!1};return n.addEventListener("pointerdown",s,!0),n.addEventListener("pointerup",r,!0),()=>{n.removeEventListener("pointerdown",s,!0),n.removeEventListener("pointerup",r,!0)}}{let r=n=>{e.ignoreEmulatedMouseEvents?e.ignoreEmulatedMouseEvents=!1:e.isPointerDown&&tb(n,t)&&l(n),e.isPointerDown=!1},o=n=>{e.ignoreEmulatedMouseEvents=!0,e.isPointerDown&&tb(n,t)&&l(n),e.isPointerDown=!1};return n.addEventListener("mousedown",s,!0),n.addEventListener("mouseup",r,!0),n.addEventListener("touchstart",s,!0),n.addEventListener("touchend",o,!0),()=>{n.removeEventListener("mousedown",s,!0),n.removeEventListener("mouseup",r,!0),n.removeEventListener("touchstart",s,!0),n.removeEventListener("touchend",o,!0)}}},[t,r,s,l])}({ref:t,onInteractOutside:i&&o?e=>{(!l||l(e.target))&&(tw[tw.length-1]===t&&(e.stopPropagation(),e.preventDefault()),a())}:void 0,onInteractOutsideStart:e=>{(!l||l(e.target))&&tw[tw.length-1]===t&&(e.stopPropagation(),e.preventDefault())}});let{focusWithinProps:c}=function(e){let t,n,{isDisabled:r,onBlurWithin:o,onFocusWithin:i,onFocusWithinChange:s}=e,l=(0,p.useRef)({isFocusWithin:!1}),a=(0,p.useCallback)(e=>{l.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(l.current.isFocusWithin=!1,o&&o(e),s&&s(!1))},[o,s,l]),c=(t=(0,p.useRef)({isFocused:!1,observer:null}),w(()=>{let e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),n=tv(e=>{null==a||a(e)}),(0,p.useCallback)(e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target;r.addEventListener("focusout",e=>{t.current.isFocused=!1,r.disabled&&n(new ty("blur",e)),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;null===(e=t.current.observer)||void 0===e||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent("blur",{relatedTarget:n})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[n])),u=(0,p.useCallback)(e=>{l.current.isFocusWithin||document.activeElement!==e.target||(i&&i(e),s&&s(!0),l.current.isFocusWithin=!0,c(e))},[i,s,c]);return r?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}({isDisabled:!r,onBlurWithin:e=>{!(!e.relatedTarget||function(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:n}of tg.traverse(tg.getTreeNode(t)))if(n&&tf(e,n.current))return!0;return!1}(e.relatedTarget,null))&&(!l||l(e.relatedTarget))&&(null==n||n())}});return{overlayProps:{onKeyDown:e=>{"Escape"!==e.key||s||e.nativeEvent.isComposing||(e.stopPropagation(),e.preventDefault(),a())},...c},underlayProps:{onPointerDown:e=>{e.target===e.currentTarget&&e.preventDefault()}}}}({isOpen:Z,onClose:Q.close,isDismissable:L,shouldCloseOnBlur:I,isKeyboardDismissDisabled:B,shouldCloseOnInteractOutside:F},Y),el=(0,p.useMemo)(()=>{var t,n,r;return nd({...i,disableAnimation:X,radius:null!=(t=null==e?void 0:e.radius)?t:"md",size:null!=(n=null==e?void 0:e.size)?n:"md",shadow:null!=(r=null==e?void 0:e.shadow)?r:"sm"})},[function(e){if(!e||"object"!=typeof e)return"";try{return JSON.stringify(e)}catch(e){return""}}(i),X,null==e?void 0:e.radius,null==e?void 0:e.size,null==e?void 0:e.shadow]),ea=(0,p.useCallback)((e={},t=null)=>({...D(ee,e),ref:function(...e){return t=>{e.forEach(e=>(function(e,t){if(null!=e){if("function"==typeof e){e(t);return}try{e.current=t}catch(n){throw Error(`Cannot assign value '${t}' to ref '${e}'`)}}})(e,t))}}(t,K),"aria-describedby":Z?J:void 0}),[ee,Z,J,Q]),ec=(0,p.useCallback)(()=>({ref:Y,"data-slot":"base","data-open":nx(Z),"data-arrow":nx(T),"data-disabled":nx(f),"data-placement":nC(eo||"top",C),...D(en,es,G),style:D(er.style,G.style,o.style),className:el.base({class:null==V?void 0:V.base}),id:J}),[el,Z,T,f,eo,C,en,es,G,er,o,J]),ed=(0,p.useCallback)(()=>({"data-slot":"content","data-open":nx(Z),"data-arrow":nx(T),"data-disabled":nx(f),"data-placement":nC(eo||"top",C),className:el.content({class:function(...e){for(var t,n,r=0,o="";r<e.length;)(t=e[r++])&&(n=function e(t){var n,r,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t){if(Array.isArray(t))for(n=0;n<t.length;n++)t[n]&&(r=e(t[n]))&&(o&&(o+=" "),o+=r);else for(n in t)t[n]&&(o&&(o+=" "),o+=n)}return o}(t))&&(o&&(o+=" "),o+=n);return o}(null==V?void 0:V.content,$)})}),[el,Z,T,f,eo,C,V]);return{Component:l||"div",content:c,children:u,isOpen:Z,triggerRef:K,showArrow:T,portalContainer:j,placement:C,disableAnimation:X,isDisabled:f,motionProps:H,getTooltipContentProps:ed,getTriggerProps:ea,getTooltipProps:ec}}({...e,ref:t});try{let e=p.Children.count(o);if(1!==e)throw Error();n=(0,p.isValidElement)(o)?(0,p.cloneElement)(o,h(o.props,o.ref)):(0,f.jsx)("p",{...h(),children:o})}catch(e){n=(0,f.jsx)("span",{}),function(e,t,...n){let r=`[Next UI] : ${e}`;"undefined"!=typeof console&&(rg[r]||(rg[r]=!0))}("Tooltip must have only one child node. Please, check your code.")}let{ref:k,id:S,style:C,...E}=d(),P=(0,f.jsx)("div",{ref:k,id:S,style:C,children:(0,f.jsx)(nL,{features:rv,children:(0,f.jsx)(rs.div,{animate:"enter",exit:"exit",initial:"exit",variants:rm,...D(u,E),style:{...nk(a)},children:(0,f.jsx)(r,{...x(),children:i})})})});return(0,f.jsxs)(f.Fragment,{children:[n,c&&s?(0,f.jsx)(nR,{portalContainer:l,children:(0,f.jsx)("div",{ref:k,id:S,style:C,...E,children:(0,f.jsx)(r,{...x(),children:i})})}):(0,f.jsx)(rp,{children:s?(0,f.jsx)(nR,{portalContainer:l,children:P}):null})]})},(0,p.forwardRef)(h));function ry(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}function rw(e,t){let n=ry(e),r=ry(t),o=n.getTime()-r.getTime();return o<0?-1:o>0?1:o}rb.displayName="NextUI.Tooltip";let rx={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function rk(e){return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}let rS={date:rk({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:rk({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:rk({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},rC={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function rO(e){return(t,n)=>{let r;if("formatting"===((null==n?void 0:n.context)?String(n.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,o=(null==n?void 0:n.width)?String(n.width):t;r=e.formattingValues[o]||e.formattingValues[t]}else{let t=e.defaultWidth,o=(null==n?void 0:n.width)?String(n.width):e.defaultWidth;r=e.values[o]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function rE(e){return function(t){let n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.width,i=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;let l=s[0],a=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}(a,e=>e.test(l)):function(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}(a,e=>e.test(l));return n=e.valueCallback?e.valueCallback(c):c,{value:n=r.valueCallback?r.valueCallback(n):n,rest:t.slice(l.length)}}}let rP={code:"en-US",formatDistance:(e,t,n)=>{let r;let o=rx[e];return(r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null==n?void 0:n.addSuffix)?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:rS,formatRelative:(e,t,n,r)=>rC[e],localize:{ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:rO({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:rO({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:rO({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:rO({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:rO({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(d={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(d.matchPattern);if(!n)return null;let r=n[0],o=e.match(d.parsePattern);if(!o)return null;let i=d.valueCallback?d.valueCallback(o[0]):o[0];return{value:i=t.valueCallback?t.valueCallback(i):i,rest:e.slice(r.length)}}),era:rE({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:rE({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:rE({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:rE({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:rE({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},rT={};function rM(e){let t=ry(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}n(62935);var rA=n(51214),rR=n(41664),r_=n.n(rR);let rD=rA.nb.REFRESH_INTERVAL,rN={placement:"bottom",color:"default"},rL=e=>{let{children:t,...n}=e,r=n.content;return n.content=void 0,(0,f.jsx)(rb,{...rN,...n,content:(0,f.jsx)("span",{className:"left-full w-max px-2 py-1 text-sm text-gray-100 bg-gray-500 text-sm capitalize rounded",children:r}),children:t})},rI=e=>{let{children:t,...n}=e,r=n.content;n.content=void 0;let{className:o,...i}=n;return(0,f.jsx)(rb,{...rN,...i,content:(0,f.jsx)("span",{className:"left-full w-max px-2 py-1 text-sm text-gray-100 bg-gray-500 rounded whitespace-pre-line normal-case",children:r}),children:t})},rj=e=>{let t,{timestamp:n,className:r=""}=e,[,o]=(0,p.useState)(0);if((0,p.useEffect)(()=>{if(!n)return;let e=setInterval(()=>{o(e=>e+1)},1e4);return()=>clearInterval(e)},[n]),!n)return null;let i=new Date-n;return t=i<5e3?"just now":i<6e4?"".concat(Math.floor(i/1e3),"s ago"):i<36e5?"".concat(Math.floor(i/6e4),"m ago"):i<864e5?"".concat(Math.floor(i/36e5),"h ago"):"".concat(Math.floor(i/864e5),"d ago"),(0,f.jsx)(rI,{content:"Last updated: ".concat(n.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!1,timeZoneName:"short"}).replace(",","")),className:"text-sm text-muted-foreground",children:(0,f.jsxs)("span",{className:"text-xs text-gray-500 ".concat(r),children:["Updated ",t]})})};function rB(e){if(!e&&0!==e)return"-";let t=e=Math.floor(e),n="",r=0;for(let e of[{value:31536e3,label:"y"},{value:2592e3,label:"mo"},{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(t>=e.value&&r<2){let o=Math.floor(t/e.value);n+="".concat(o).concat(e.label," "),t%=e.value,r++}return n.trim()||"0s"}function rW(e){return e.replace(/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGKH]/g,"")}function rF(e){return!!(!e||e.includes("<sky-payload")||/rich_(init|update|start|exit)/i.test(e)||/<rich_.*?>.*<\/rich_.*?>/i.test(e)||/^├──/.test(e)||/^└──/.test(e))}function r$(e){let t;let n=/\((head|worker\d+),/g,r=new Set;for(;null!==(t=n.exec(e));)r.add(t[1]);return Array.from(r).sort((e,t)=>"head"===e?-1:"head"===t?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}))}function rz(e){let{logs:t,controller:n=!1,isLoading:r=!1,selectedNode:o="all"}=e,i=t?Array.isArray(t)?t:"string"==typeof t?t.split("\n").filter(e=>""!==e):[]:[],[s,l]=(0,p.useState)(i);return(0,p.useEffect)(()=>{"all"===o?l(i):l(i.filter(e=>e.includes("(".concat(o,","))))},[o,i]),(0,f.jsxs)("div",{children:[(0,f.jsx)("style",{children:'\n  .logs-container {\n    background-color: #f7f7f7;\n    padding: 16px;\n    max-height: calc(100vh - 300px);\n    overflow-y: auto;\n    overflow-x: hidden;\n    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;\n    line-height: 1.5;\n    border-radius: 6px;\n    min-height: fit-content;\n  }\n\n  .log-line {\n    display: block;\n    white-space: pre-wrap;\n    margin: 2px 0;\n  }\n\n  .log-line .level {\n    display: inline;\n    width: 1ch;\n    margin-right: 1ch;\n    font-weight: bold;\n  }\n\n  .log-line.INFO .level {\n    color: #2563eb;\n  }\n\n  .log-line.WARNING .level {\n    color: #d97706;\n  }\n\n  .log-line.ERROR .level {\n    color: #dc2626;\n  }\n\n  .log-line.DEBUG .level {\n    color: #6b7280;\n  }\n\n  .log-line .timestamp {\n    color: #059669;\n    margin-right: 1ch;\n    white-space: nowrap;\n  }\n\n  .log-line .location {\n    color: #6366f1;\n    margin-right: 1ch;\n    white-space: nowrap;\n  }\n\n  .log-line .message {\n    color: #111827;\n    word-break: break-word;\n    white-space: pre-wrap;\n  }\n\n  .log-line .log-prefix {\n    color: #6366f1;\n    font-weight: 500;\n  }\n\n  .log-line .log-rest {\n    color: #111827;\n    word-break: break-word;\n    white-space: pre-wrap;\n  }\n'}),(0,f.jsx)("div",{className:"logs-container whitespace-pre-wrap break-all font-mono text-sm text-gray-900","aria-label":"job-logs",children:r?(0,f.jsxs)("div",{className:"flex items-center justify-center py-8 text-gray-500",children:[(0,f.jsxs)("svg",{className:"animate-spin h-5 w-5 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,f.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,f.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,f.jsx)("span",{children:"Loading logs..."})]}):s.join("\n")})]})}function rH(e){let t,{date:n}=e;if(!n)return"N/A";let r=new Date,o=n.getFullYear()+"-"+String(n.getMonth()+1).padStart(2,"0")+"-"+String(n.getDate()).padStart(2,"0"),i=n.toLocaleString("en-US",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0,timeZoneName:"short"});return t=function(e){if(!e||"string"!=typeof e)return e;if("just now"===e)return"now";if("less than a minute ago"===e.toLowerCase())return"Less than 1m ago";let t=e.match(/^about\s+(\d+)\s+(\w+)\s+ago$/i);if(t){let e=t[1],n=t[2],r={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",month:"mo",months:"mo",year:"yr",years:"yr"};if(r[n])return"".concat(e).concat(r[n]," ago")}let n=e.match(/^a[n]?\s+(\w+)\s+ago$/i);if(n){let e=n[1],t={second:"s",minute:"m",hour:"h",day:"d",month:"mo",year:"yr"};if(t[e])return"1".concat(t[e]," ago")}let r=e.match(/^(\d+)\s+(\w+)\s+ago$/i);if(r){let e=r[1],t=r[2],n={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",month:"mo",months:"mo",year:"yr",years:"yr"};if(n[t])return"".concat(e).concat(n[t]," ago")}return e}(function(e,t,n){var r,o,i,s,l,a;let c,u,h;let d=null!==(o=null!==(r=null==n?void 0:n.locale)&&void 0!==r?r:rT.locale)&&void 0!==o?o:rP,f=rw(e,t);if(isNaN(f))throw RangeError("Invalid time value");let p=Object.assign({},n,{addSuffix:null==n?void 0:n.addSuffix,comparison:f});f>0?(c=ry(t),u=ry(e)):(c=ry(e),u=ry(t));let m=(i=u,s=c,(a=null==void 0?void 0:(void 0).roundingMethod,e=>{let t=(a?Math[a]:Math.trunc)(e);return 0===t?0:t})((+ry(i)-+ry(s))/1e3)),g=Math.round((m-(rM(u)-rM(c))/1e3)/60);if(g<2){if(null==n?void 0:n.includeSeconds){if(m<5)return d.formatDistance("lessThanXSeconds",5,p);if(m<10)return d.formatDistance("lessThanXSeconds",10,p);if(m<20)return d.formatDistance("lessThanXSeconds",20,p);if(m<40)return d.formatDistance("halfAMinute",0,p);else if(m<60)return d.formatDistance("lessThanXMinutes",1,p);else return d.formatDistance("xMinutes",1,p)}return 0===g?d.formatDistance("lessThanXMinutes",1,p):d.formatDistance("xMinutes",g,p)}if(g<45)return d.formatDistance("xMinutes",g,p);if(g<90)return d.formatDistance("aboutXHours",1,p);if(g<1440)return d.formatDistance("aboutXHours",Math.round(g/60),p);if(g<2520)return d.formatDistance("xDays",1,p);if(g<43200)return d.formatDistance("xDays",Math.round(g/1440),p);if(g<86400)return h=Math.round(g/43200),d.formatDistance("aboutXMonths",h,p);if((h=function(e,t){let n;let r=ry(e),o=ry(t),i=rw(r,o),s=Math.abs(function(e,t){let n=ry(e),r=ry(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}(r,o));if(s<1)n=0;else{1===r.getMonth()&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*s);let t=rw(r,o)===-i;(function(e){let t=ry(e);return+function(e){let t=ry(e);return t.setHours(23,59,59,999),t}(t)==+function(e){let t=ry(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)})(ry(e))&&1===s&&1===rw(e,o)&&(t=!1),n=i*(s-Number(t))}return 0===n?0:n}(u,c))<12)return d.formatDistance("xMonths",Math.round(g/43200),p);{let e=h%12,t=Math.trunc(h/12);return e<3?d.formatDistance("aboutXYears",t,p):e<9?d.formatDistance("overXYears",t,p):d.formatDistance("almostXYears",t+1,p)}}(n,r,{addSuffix:!0})),(0,f.jsx)(rL,{content:o+" "+i,className:"text-sm text-muted-foreground",children:(0,f.jsx)("span",{className:"border-b border-dotted border-gray-400 cursor-help",children:t})})}function rq(e){return e?e.getFullYear()+"-"+String(e.getMonth()+1).padStart(2,"0")+"-"+String(e.getDate()).padStart(2,"0")+" "+e.toLocaleString("en-US",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0,timeZoneName:"short"}):"N/A"}let rV=e=>e&&e.jobCounts?e.jobCounts:{},rU=e=>{if(!e||0===e.length)return{};let t=e.filter(e=>"READY"===e.status),n={};t.forEach(e=>{try{let t=e.cloud&&""!==e.cloud.trim()&&"undefined"!==e.cloud,r=e.region&&"undefined"!==e.region&&null!==e.region&&""!==e.region.trim();if(!t&&!r)return;let o=t?e.cloud:"Unknown",i=r?e.region:null;n[o]||(n[o]={count:0,regions:new Set}),n[o].count+=1,i&&n[o].regions.add(i)}catch(e){n.Unknown||(n.Unknown={count:0,regions:new Set}),n.Unknown.count+=1}});let r={};return Object.entries(n).forEach(e=>{let[t,n]=e,o=n.regions.size,i=t.toLowerCase().includes("kubernetes")||t.toLowerCase().includes("k8s")?"context":"region",s=1===o?"1 ".concat(i):"".concat(o," ").concat(i,"s");r[o>0?"".concat(t," (").concat(s,")"):t]=n.count}),r},rG=e=>{let{jobCounts:t,getStatusStyle:n}=e;return t&&0!==Object.keys(t).length?(0,f.jsx)("div",{className:"flex flex-wrap gap-1",children:Object.entries(t).map(e=>{let[t,r]=e,o=n(t);return(0,f.jsxs)("span",{className:"px-2 py-1 rounded-full flex items-center space-x-2 text-xs font-medium ".concat(o),children:[(0,f.jsx)("span",{children:t}),(0,f.jsx)("span",{className:"text-xs bg-white/50 px-1.5 py-0.5 rounded",children:r})]},t)})}):(0,f.jsx)("span",{className:"text-gray-1000",children:"No active jobs"})},rX=e=>{let{replicaInfo:t}=e,n=rU(t);if(0===Object.keys(n).length)return(0,f.jsx)("span",{className:"text-gray-500 text-sm",children:"-"});let r=rA.MO.NAME_TRUNCATE_LENGTH,o=e=>{let t=e.indexOf("(");if(-1===t)return e;let n=e.substring(0,t).trim(),o=e.substring(t+1,e.length-1);if(o.length<=r)return e;let i="".concat(o.substring(0,Math.floor((r-3)/2)),"...").concat(o.substring(o.length-Math.ceil((r-3)/2)));return"".concat(n," (").concat(i,")")};return(0,f.jsx)("div",{className:"flex flex-wrap gap-1",children:Object.entries(n).map(e=>{let[t,n]=e,r=o(t),i=r!==t;return(0,f.jsxs)("span",{className:"px-2 py-1 rounded-full flex items-center space-x-2 text-xs font-medium bg-blue-50 text-blue-700",children:[i?(0,f.jsx)(rI,{content:t,className:"text-sm text-muted-foreground",children:(0,f.jsx)("span",{children:r})}):(0,f.jsx)("span",{children:t}),(0,f.jsx)("span",{className:"text-xs bg-white/50 px-1.5 py-0.5 rounded",children:n})]},t)})})},rQ=(e,t,n)=>{if(!e)return"-";if(n.find(n=>n.name===e&&n.hash===t)&&t)return(0,f.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,f.jsx)(rI,{content:"This pool is running",placement:"top",children:(0,f.jsx)("div",{className:"w-2 h-2 bg-green-700 rounded-full"})}),(0,f.jsx)(r_(),{href:"/jobs/pools/".concat(e),className:"text-gray-700 hover:text-blue-600 hover:underline",children:e})]});let r=t?t.substring(0,4):"";return(0,f.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,f.jsx)(rI,{content:"This pool is terminated",placement:"top",children:(0,f.jsx)("div",{className:"w-2 h-2 bg-gray-800"})}),(0,f.jsxs)("span",{children:[e," (",r,")"]})]})}},47145:function(e,t,n){"use strict";n.d(t,{x:function(){return u}});var r=n(94545),o=n(93225);let i=null,s=null;async function l(){return i||s||(s=(async()=>{try{let e=window.location.origin,t=await fetch("".concat(e,"/internal/dashboard/users/role"));if(t.ok){let e=await t.json();i={id:e.id||"local",name:e.name||e.id||"local"}}else i={id:"local",name:"local"}}catch(e){console.error("Failed to get user info:",e),i={id:"local",name:"local"}}return i})())}let a=null;async function c(){return window.__skyPluginsReady?void 0:a||(document.querySelector('script[src*="/plugins/"][data-requires-early-init="true"]')?a=new Promise(e=>{let t=Date.now(),n=setInterval(()=>{(window.__skyPluginsReady||Date.now()-t>=1e3)&&(clearInterval(n),e())},50)}):void 0)}let u={fetchImmediate:async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};await c();let i="POST"===n?{"Content-Type":"application/json",...r.headers||{}}:{...r.headers||{}},s=window.location.origin,a="".concat(s).concat(o.f4).concat(e);if(void 0!==t){let e=await l();t.env_vars={...t.env_vars||{},SKYPILOT_IS_FROM_DASHBOARD:"true",SKYPILOT_USER_ID:e.id,SKYPILOT_USER:e.name}}return await fetch(a,{method:n,headers:i,body:"POST"===n?JSON.stringify(t):void 0,signal:r.signal})},fetch:async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST";try{let i=window.location.origin,s=await u.fetchImmediate(e,t,n);if(!s.ok){let t="Initial API request ".concat(e," failed with status ").concat(s.status);throw Error(t)}let l=s.headers.get("X-Skypilot-Request-ID");if(!l){let t="No request ID received from server for ".concat(e);throw Error(t)}let a=await fetch("".concat(i).concat(o.f4,"/api/get?request_id=").concat(l));if(!a.ok){let t=await (0,r.oN)(a),n="API request to get ".concat(e," result failed with status ").concat(a.status,", error: ").concat(t);throw Error(n)}let c=await a.json();return c.return_value?JSON.parse(c.return_value):[]}catch(n){let t="Error in apiClient.fetch for ".concat(e,": ").concat(n);throw console.error(t),Error(t)}},post:async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={"Content-Type":"application/json",...n.headers||{}},i=window.location.origin,s="".concat(i).concat(o.f4).concat(e);return await fetch(s,{method:"POST",headers:r,body:JSON.stringify(t),signal:n.signal})},stream:async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=await u.post(e,t,r);if(!o.ok){let t="API request ".concat(e," failed with status ").concat(o.status);throw console.error(t),Error(t)}let i=o.body.getReader();try{for(;;){let{done:e,value:t}=await i.read();if(e)break;let r=new TextDecoder().decode(t);n(r)}}catch(e){throw console.error("Error in stream:",e),e}},get:async e=>{let t=window.location.origin,n="".concat(t).concat(o.f4).concat(e);return await fetch(n)}}},23266:function(e,t,n){"use strict";n.d(t,{GH:function(){return f},QL:function(){return m},Sl:function(){return d},getClusters:function(){return u},r7:function(){return g},uR:function(){return h}});var r=n(67294),o=n(15821),i=n(47145),s=n(93225),l=n(6378),a=n(10410);let c={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",PENDING:"PENDING",null:"TERMINATED"};async function u(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=await i.x.fetch("/status",{cluster_names:e,all_users:!0,include_credentials:!1,include_handle:!1,summary_response:null==e}),n=t.map(e=>{let t="";t=e.zone?e.zone:e.region,"SSH"===e.cloud&&(null==t?void 0:t.startsWith("ssh-"))&&(t=t.substring(4));let n=t;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let n=Math.floor((t-3)/2),r=n+(t-3)%2;return 0===n?e.substring(0,r)+"...":e.substring(0,r)+"..."+e.substring(e.length-n)}(t,25)),{status:c[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:n?"".concat(e.cloud," (").concat(n,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,last_event:e.last_event,to_down:e.to_down,cluster_name_on_cloud:e.cluster_name_on_cloud,labels:e.labels||{},node_names:e.node_names||null,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}});return await (0,a.M)(n,"clusters",{dashboardCache:l.ZP,rawData:t})}catch(e){throw console.error("Error fetching clusters:",e),e}}async function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;try{let n={days:t,dashboard_summary_response:!0};e&&(n.cluster_hashes=[e]);let r=await i.x.fetch("/cost_report",n),o=r.map(e=>{let t="Unknown";e.cloud?t=e.cloud:e.resources&&e.resources.cloud&&(t=e.resources.cloud);let n=e.user_name||"-";return{status:e.status?c[e.status]:"TERMINATED",cluster:e.name,user:n,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:t,region:"",infra:t,full_infra:t,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:e.launched_at?new Date(1e3*e.launched_at):null,num_nodes:e.num_nodes||1,duration:e.duration,total_cost:e.total_cost,workspace:e.workspace||"default",autostop:-1,last_event:e.last_event,to_down:!1,cluster_name_on_cloud:null,node_names:e.node_names||null,usage_intervals:e.usage_intervals,command:e.last_creation_command||"",task_yaml:e.last_creation_yaml||"{}",events:[{time:e.launched_at?new Date(1e3*e.launched_at):new Date,event:"Cluster created."}]}});return await (0,a.M)(o,"clusters",{dashboardCache:l.ZP,rawData:r})}catch(e){throw console.error("Error fetching cluster history:",e),e}}async function d(e){let{clusterName:t,jobId:n,onNewLog:r,workspace:s,signal:l}=e;try{await i.x.stream("/logs",{follow:!1,cluster_name:t,job_id:n,tail:5e3,override_skypilot_config:{active_workspace:s||"default"}},r,{signal:l})}catch(e){if((null==e?void 0:e.name)==="AbortError")return;console.error("Error in streamClusterJobLogs:",e),(0,o.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function f(e){let{clusterName:t,jobIds:n=null,workspace:r}=e;try{let e=await i.x.fetch("/download_logs",{cluster_name:t,job_ids:n?n.map(String):null,override_skypilot_config:{active_workspace:r||"default"}}),l=Object.values(e||{});if(!l.length){(0,o.C)("No logs found to download.","warning");return}let a=window.location.origin,c="".concat(a).concat(s.f4,"/download"),u=await fetch("".concat(c,"?relative=items"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder_paths:l})});if(!u.ok){let e=await u.text();throw Error("Download failed: ".concat(u.status," ").concat(e))}let h=await u.blob(),d=window.URL.createObjectURL(h),f=document.createElement("a"),p=new Date().toISOString().replace(/[:.]/g,"-"),m=n&&1===n.length?"job-".concat(n[0]):"jobs";f.href=d,f.download="".concat(t,"-").concat(m,"-logs-").concat(p,".zip"),document.body.appendChild(f),f.click(),f.remove(),window.URL.revokeObjectURL(d)}catch(e){console.error("Error downloading logs:",e),(0,o.C)("Error downloading logs: ".concat(e.message),"error")}}async function p(e){let{clusterName:t,workspace:n}=e;try{return(await i.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:n}})).map(e=>{var r;let o=e.end_at?e.end_at:Date.now()/1e3,i=0,s=0;return e.submitted_at&&(i=o-e.submitted_at),e.start_at&&(s=o-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,user_hash:e.user_hash,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:i,job_duration:s,infra:"",logs:"",workspace:n||"default",git_commit:(null===(r=e.metadata)||void 0===r?void 0:r.git_commit)||"-"}})}catch(e){throw console.error("Error fetching cluster jobs:",e),e}}function m(e){let{cluster:t,job:n=null}=e,[o,i]=(0,r.useState)(null),[s,a]=(0,r.useState)(null),[c,h]=(0,r.useState)(!0),[d,f]=(0,r.useState)(!0),m=(0,r.useCallback)(async()=>{if(t)try{h(!0);let e=await l.ZP.get(u,[{clusterNames:[t]}]);if(e.length>0)return i(e[0]),e[0];return console.error("No cluster data found for cluster:",t),null}catch(e){console.error("Error fetching cluster data:",e)}finally{h(!1)}return null},[t]),g=(0,r.useCallback)(async e=>{if(t)try{f(!0);let n=await l.ZP.get(p,[{clusterName:t,workspace:e||"default"}]);a(n)}catch(e){console.error("Error fetching cluster job data:",e)}finally{f(!1)}},[t]),v=(0,r.useCallback)(async()=>{l.ZP.invalidate(u,[{clusterNames:[t]}]);let e=await m();e&&(l.ZP.invalidate(p,[{clusterName:t,workspace:e.workspace||"default"}]),await g(e.workspace))},[m,g,t]),b=(0,r.useCallback)(async()=>{o&&(l.ZP.invalidate(p,[{clusterName:t,workspace:o.workspace||"default"}]),await g(o.workspace))},[g,o,t]);return(0,r.useEffect)(()=>{(async()=>{let e=await m();e&&g(e.workspace)})()},[t,n,m,g]),{clusterData:o,clusterJobData:s,loading:c,clusterDetailsLoading:c,clusterJobsLoading:d,refreshData:v,refreshClusterJobsOnly:b}}function g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{showHistory:t=!1,historyDays:n=1,refreshInterval:o=null,sortConfig:i={key:null,direction:"ascending"},filters:s=[]}=e,a=i.key||"launched_at",c=i.key&&"ascending"===i.direction?"asc":"desc",d=JSON.stringify(s),[f,p]=(0,r.useState)([]),[m,g]=(0,r.useState)([]),[v,b]=(0,r.useState)(!0),[y,w]=(0,r.useState)(1),[x,k]=(0,r.useState)(10),[S,C]=(0,r.useState)(0),[O,E]=(0,r.useState)(1),[P,T]=(0,r.useState)(!1),[M,A]=(0,r.useState)(!1),[R,_]=(0,r.useState)(null),[D,N]=(0,r.useState)(!1);(0,r.useEffect)(()=>{w(1)},[d]);let L=(0,r.useCallback)(async()=>{console.log("[useClusterData] Using server-side pagination");let e=window.__skyPaginationFetch,r=await l.ZP.get(e,[{page:y,limit:x,showHistory:t,historyDays:n,sortBy:a,sortOrder:c,filters:s}]),o=r.total||0,i=r.totalPages||r.total_pages||1,u=r.hasNext||r.has_next||!1,h=r.hasPrev||r.has_prev||!1,d=r.items||r.data||[];p(d),g(d),C(o),E(i),T(u),A(h),N(!0),u&&l.ZP.get(e,[{page:y+1,limit:x,showHistory:t,historyDays:n,sortBy:a,sortOrder:c,filters:s}],{ttl:3e4}).then(()=>console.log("[useClusterData] Prefetched page",y+1)).catch(e=>console.warn("[useClusterData] Prefetch failed:",e))},[y,x,t,n,a,c,s]),I=(0,r.useCallback)(async()=>{let e;console.log("[useClusterData] Using client-side pagination");let r=await l.ZP.get(u);if(t){let t=[];try{t=await l.ZP.get(h,[null,n])}catch(e){console.error("Error fetching cluster history:",e)}let o=r.map(e=>({...e,isHistorical:!1})),i=t.map(e=>({...e,isHistorical:!0}));e=[...o],i.forEach(t=>{r.some(e=>e.cluster_hash===t.cluster_hash)||e.push(t)})}else e=r.map(e=>({...e,isHistorical:!1}));let o=e.length,i=Math.ceil(o/x)||1,s=(y-1)*x;p(e.slice(s,s+x)),g(e),C(o),E(i),T(y<i),A(y>1),N(!1)},[t,n,y,x]),j=(0,r.useCallback)(async()=>{b(!0),_(null);try{"function"==typeof window.__skyPaginationFetch?await L():await I()}catch(e){console.error("[useClusterData] Error fetching clusters:",e),_(e),p([]),g([])}b(!1)},[L,I]);(0,r.useEffect)(()=>{j()},[j]),(0,r.useEffect)(()=>{if(!o)return;let e=setInterval(()=>{"visible"===document.visibilityState&&j()},o);return()=>clearInterval(e)},[o,j]);let B=(0,r.useCallback)(e=>{k(e),w(1)},[]);return{data:f,allData:m,total:S,page:y,limit:x,totalPages:O,hasNext:P,hasPrev:M,setPage:w,setLimit:B,loading:v,error:R,refresh:j,isServerPagination:D}}},93225:function(e,t,n){"use strict";n.d(t,{$m:function(){return a},Bo:function(){return s},GW:function(){return o},Z2:function(){return c},f4:function(){return r},iW:function(){return l},mF:function(){return i}}),n(83454);let r=function(){{let e=window.location.pathname,t=e.indexOf("/dashboard");if(-1!==t){let n=e.substring(0,t);return"".concat(n,"/internal/dashboard")}return"/internal/dashboard"}}(),o=function(){{let e=window.location.pathname,t=e.indexOf("/dashboard");return -1!==t?e.substring(0,t+10):"/dashboard"}}();"/api/v1".replace(/^http/,"ws");let i="ClusterDoesNotExist",s="NotSupportedError",l="ClusterNotUpError",a=["AWS","Azure","GCP","IBM","Lambda","SCP","OCI","RunPod","VAST","vSphere","Cudo","FluidStack","Paperspace","DO","Nebius"],c=Object.fromEntries([...a.map(e=>[e.toLowerCase(),e]),["kubernetes","Kubernetes"],["ssh","SSH Node Pool"]])},32045:function(e,t,n){"use strict";n.d(t,{CI:function(){return h},F5:function(){return g},R8:function(){return m},UU:function(){return d},Ve:function(){return y},Xg:function(){return u},ef:function(){return c},oD:function(){return a}});var r=n(93225),o=n(47145),i=n(94545),s=n(6378),l=n(30017);async function a(){let{getWorkspaces:e,getEnabledClouds:t}=await Promise.resolve().then(n.bind(n,17324));try{let n=await s.ZP.get(e).catch(()=>({})),o=Object.keys(n||{});if(0===o.length)return{clouds:[],totalClouds:r.$m.length,enabledClouds:0};let i=new Set;await Promise.all(o.map(async e=>{try{let n=await s.ZP.get(t,[e,!1]);Array.isArray(n)&&n.forEach(e=>{e&&i.add(e.toLowerCase())})}catch(t){console.error("Error fetching enabled clouds for workspace ".concat(e,":"),t)}}));let l=Array.from(i),a=r.$m.filter(e=>l.includes(e.toLowerCase())).map(e=>({name:e,enabled:!0})).sort((e,t)=>e.name.localeCompare(t.name));return{clouds:a,totalClouds:r.$m.length,enabledClouds:a.length}}catch(e){return console.error("Error fetching enabled clouds list:",e),{clouds:[],totalClouds:r.$m.length,enabledClouds:0}}}async function c(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];let{getClusters:e}=await Promise.resolve().then(n.bind(n,23266)),{getManagedJobs:t}=await Promise.resolve().then(n.bind(n,68969)),{getWorkspaces:o,getEnabledClouds:i}=await Promise.resolve().then(n.bind(n,17324));try{let[n,l,a]=await Promise.all([s.ZP.get(t,[{allUsers:!0,skipFinished:!0}]).catch(e=>(console.error("Error fetching managed jobs:",e),{jobs:[]})),s.ZP.get(e).catch(e=>(console.error("Error fetching clusters:",e),[])),s.ZP.get(o).catch(e=>(console.error("Error fetching workspaces:",e),{}))]),c=(null==n?void 0:n.jobs)||[],u=[],h=Object.keys(a||{});if(0===h.length)console.warn("No accessible workspaces found"),u=[];else{let e=new Set;await Promise.all(h.map(async t=>{try{let n=await s.ZP.get(i,[t,!1]);Array.isArray(n)&&n.forEach(t=>{t&&e.add(t.toLowerCase())})}catch(e){console.error("Error fetching enabled clouds for workspace ".concat(t,":"),e)}})),u=Array.from(e),console.log("Aggregated enabled clouds across all workspaces:",u)}let d={};r.$m.forEach(e=>{let t=u.includes(e.toLowerCase());d[e]={name:e,clusters:0,jobs:0,enabled:t}}),(l||[]).forEach(e=>{if(e.cloud){let t=e.cloud;d[t]&&(d[t].clusters+=1,d[t].enabled=!0)}}),c.forEach(e=>{if(e.cloud){let t=e.cloud;d[t]&&(d[t].jobs+=1,d[t].enabled=!0)}});let f=r.$m.length,p=Object.values(d).filter(e=>e.enabled).length;return{clouds:Object.values(d).filter(e=>e.enabled).sort((e,t)=>e.name.localeCompare(t.name)),totalClouds:f,enabledClouds:p}}catch(e){throw console.error("Error fetching cloud infrastructure:",e),e}}async function u(){try{console.log("[DEBUG] Starting workspace-aware infrastructure fetch");let{getWorkspaces:e}=await Promise.resolve().then(n.bind(n,17324));console.log("[DEBUG] About to call getWorkspaces() via cache");let t=await s.ZP.get(e);if(console.log("[DEBUG] Workspaces data received:",t),console.log("[DEBUG] Number of accessible workspaces:",Object.keys(t||{}).length),console.log("[DEBUG] Workspace names:",Object.keys(t||{})),!t||0===Object.keys(t).length)return console.log("[DEBUG] No accessible workspaces found - returning empty result"),{workspaces:{},allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[],contextStats:{},contextWorkspaceMap:{},contextErrors:{}};let{getEnabledClouds:r}=await Promise.resolve().then(n.bind(n,17324)),o={},i=[],l={};await Promise.allSettled(Object.entries(t).map(async e=>{let[t,n]=e;console.log("Fetching infrastructure for workspace: ".concat(t));try{console.log("[DEBUG] Fetching enabled clouds for workspace: ".concat(t," via cache"));let e=await s.ZP.get(r,[t,!0]);console.log("[DEBUG] Expanded clouds for ".concat(t,":"),e),o[t]={config:n,clouds:e,contexts:[]},console.log("[DEBUG] Processing expandedClouds for ".concat(t,":"),e),e&&Array.isArray(e)?e.forEach(e=>{if(console.log("[DEBUG] Processing infraItem: ".concat(e)),e.toLowerCase().startsWith("kubernetes/")){let n=e.replace(/^kubernetes\//i,"");console.log("[DEBUG] Extracted kubernetes context: ".concat(n)),i.push(n),l[n]||(l[n]=[]),l[n].includes(t)||l[n].push(t),o[t].contexts.push(n)}else if(e.toLowerCase().startsWith("ssh/")){let n=e.replace(/^ssh\//i,""),r="ssh-".concat(n);console.log("[DEBUG] Extracted SSH context: ".concat(r)),i.push(r),l[r]||(l[r]=[]),l[r].includes(t)||l[r].push(t),o[t].contexts.push(r)}}):console.log("[DEBUG] No expanded clouds or not an array for ".concat(t))}catch(e){throw console.error("Failed to fetch infrastructure for workspace ".concat(t,":"),e),e}}));let{getClusters:a}=await Promise.resolve().then(n.bind(n,23266)),c=[];try{c=await s.ZP.get(a)}catch(e){console.error("Error fetching clusters:",e)}let u=c||[],h={};try{h=await g(u)}catch(e){console.error("Error fetching context clusters:",e)}let d=[...new Set(i)].filter(e=>e&&"string"==typeof e),p={allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextErrors:{}};try{p=await f(d)}catch(e){console.error("Error fetching Kubernetes GPUs:",e)}let m={workspaces:o,allContextNames:[...new Set(i)].sort(),allGPUs:p.allGPUs||[],perContextGPUs:p.perContextGPUs||[],perNodeGPUs:p.perNodeGPUs||[],contextStats:h,contextWorkspaceMap:l,contextErrors:p.contextErrors||{}};return console.log("[DEBUG] Final result:",m),console.log("[DEBUG] All contexts found:",i),console.log("[DEBUG] Context workspace map:",l),m}catch(e){throw console.error("[DEBUG] Failed to fetch workspace infrastructure:",e),console.error("[DEBUG] Error stack:",e.stack),e}}async function h(){try{let{getWorkspaces:e}=await Promise.resolve().then(n.bind(n,17324)),t=await s.ZP.get(e);if(!t||0===Object.keys(t).length)return{workspaces:{},allContextNames:[],contextWorkspaceMap:{}};let{getEnabledClouds:r}=await Promise.resolve().then(n.bind(n,17324)),o={},i=[],l={};return await Promise.allSettled(Object.entries(t).map(async e=>{let[t,n]=e;try{let e=await s.ZP.get(r,[t,!0]);o[t]={config:n,clouds:e,contexts:[]},e&&Array.isArray(e)&&e.forEach(e=>{if(e.toLowerCase().startsWith("kubernetes/")){let n=e.replace(/^kubernetes\//i,"");i.push(n),l[n]||(l[n]=[]),l[n].includes(t)||l[n].push(t),o[t].contexts.push(n)}else if(e.toLowerCase().startsWith("ssh/")){let n=e.replace(/^ssh\//i,""),r="ssh-".concat(n);i.push(r),l[r]||(l[r]=[]),l[r].includes(t)||l[r].push(t),o[t].contexts.push(r)}})}catch(e){console.error("Failed to fetch infrastructure for workspace ".concat(t,":"),e)}})),{workspaces:o,allContextNames:[...new Set(i)].sort(),contextWorkspaceMap:l}}catch(e){throw console.error("Failed to fetch workspace contexts:",e),e}}async function d(e){try{let l=await p(e),a={},c=[];if(l&&Object.keys(l).length>0)for(let u in l){var t,n,r,o,i,s;let h=l[u];if(!h)continue;let d=h.accelerator_type||"-",f=(null===(t=h.total)||void 0===t?void 0:t.accelerator_count)||0,p=(null===(n=h.free)||void 0===n?void 0:n.accelerators_available)||0,m=!1!==h.is_ready,g=!0===h.is_cordoned,v=h.taints||[],b=v.length>0,y=!m||g||b;c.push({node_name:h.name||u,gpu_name:d,gpu_total:f,gpu_free:p,is_ready:m,is_cordoned:g,taints:v,context:e,ip_address:h.ip_address||null,cpu_count:null!==(r=h.cpu_count)&&void 0!==r?r:null,memory_gb:null!==(o=h.memory_gb)&&void 0!==o?o:null,cpu_free:null!==(i=h.cpu_free)&&void 0!==i?i:null,memory_free_gb:null!==(s=h.memory_free_gb)&&void 0!==s?s:null}),f>0&&(a[d]||(a[d]={gpu_name:d,gpu_requestable_qty_per_node:0,gpu_total:0,gpu_free:0,gpu_not_ready:0,context:e}),a[d].gpu_total+=f,a[d].gpu_free+=p,y&&(a[d].gpu_not_ready+=f),a[d].gpu_requestable_qty_per_node=f)}return{context:e,perContextGPUs:Object.values(a),perNodeGPUs:c,error:null}}catch(n){let t=(null==n?void 0:n.message)||"string"==typeof n&&n||"Context may be unavailable or timed out";return console.warn("Failed to get GPU data for context ".concat(e,":"),t),{context:e,perContextGPUs:[],perNodeGPUs:[],error:t}}}async function f(e){try{var t,n,r,o,i,s,l,a,c,u,h;if(!e||0===e.length)return{allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextErrors:{}};let d={},f={},m={},g={},v=await Promise.allSettled(e.map(e=>p(e))),b={};for(let n=0;n<e.length;n++){let r=v[n];if("fulfilled"===r.status)b[e[n]]=r.value,console.log("[CONTEXT_DEBUG] Context node info result:",e[n],r.value);else{let o=(null===(t=r.reason)||void 0===t?void 0:t.message)||"string"==typeof r.reason&&r.reason||"Context may be unavailable or timed out";console.warn("Failed to get node info for context ".concat(e[n],":"),o),b[e[n]]={},g[e[n]]=o}}for(let t of e){let e=b[t]||{};if(e&&Object.keys(e).length>0){let o={};for(let i in e){let s=e[i];if(!s){console.warn("No node data for node ".concat(i," in context ").concat(t));continue}let l=s.accelerator_type||"-",a=(null===(n=s.total)||void 0===n?void 0:n.accelerator_count)||0,c=(null===(r=s.free)||void 0===r?void 0:r.accelerators_available)||0,u=!1!==s.is_ready,h=!0===s.is_cordoned,d=(s.taints||[]).length>0,f=!u||h||d;a>0&&(o[l]||(o[l]={gpu_name:l,gpu_requestable_qty_per_node:0,gpu_total:0,gpu_free:0,gpu_not_ready:0,context:t}),o[l].gpu_total+=a,o[l].gpu_free+=c,f&&(o[l].gpu_not_ready+=a),o[l].gpu_requestable_qty_per_node=a)}for(let e in f[t]=Object.values(o),o)e in d?(d[e].gpu_total+=o[e].gpu_total,d[e].gpu_free+=o[e].gpu_free,d[e].gpu_not_ready+=o[e].gpu_not_ready):d[e]={gpu_total:o[e].gpu_total,gpu_free:o[e].gpu_free,gpu_not_ready:o[e].gpu_not_ready,gpu_name:e}}else f[t]=[]}for(let t of e){let e=b[t];if(e&&Object.keys(e).length>0)for(let n in e){let r=e[n];if(!r){console.warn("No node data for node ".concat(n," in context ").concat(t));continue}let p=r.accelerator_type||"-",g=null!==(s=null===(o=r.total)||void 0===o?void 0:o.accelerator_count)&&void 0!==s?s:0,v=null!==(l=null===(i=r.free)||void 0===i?void 0:i.accelerators_available)&&void 0!==l?l:0,b=!1!==r.is_ready,y=!0===r.is_cordoned,w=r.taints||[],x=null!==(a=r.cpu_count)&&void 0!==a?a:null,k=null!==(c=r.memory_gb)&&void 0!==c?c:null,S=null!==(u=r.cpu_free)&&void 0!==u?u:null,C=null!==(h=r.memory_free_gb)&&void 0!==h?h:null;m["".concat(t,"/").concat(n)]={node_name:r.name||n,gpu_name:p,gpu_total:g,gpu_free:v,ip_address:r.ip_address||null,context:t,cpu_count:x,memory_gb:k,cpu_free:S,memory_free_gb:C,is_ready:b,is_cordoned:y,taints:w},"-"===p||!f[t]||f[t].some(e=>e.gpu_name===p)||(p in d||(d[p]={gpu_total:0,gpu_free:0,gpu_not_ready:0,gpu_name:p}),f[t].find(e=>e.gpu_name===p)||f[t].push({gpu_name:p,gpu_not_ready:0,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:t}))}}return console.log("[CONTEXT_DEBUG] All GPUs summary:",d),console.log("[CONTEXT_DEBUG] Per context GPUs data:",f),console.log("[CONTEXT_DEBUG] Per node GPUs data:",m),console.log("[CONTEXT_DEBUG] Context errors:",g),{allGPUs:Object.values(d).sort((e,t)=>(e.gpu_name||"").localeCompare(t.gpu_name||"")),perContextGPUs:Object.values(f).flat().sort((e,t)=>(e.context||"").localeCompare(t.context||"")||(e.gpu_name||"").localeCompare(t.gpu_name||"")),perNodeGPUs:Object.values(m).sort((e,t)=>(e.context||"").localeCompare(t.context||"")||(e.node_name||"").localeCompare(t.node_name||"")||(e.gpu_name||"").localeCompare(t.gpu_name||"")),contextErrors:g}}catch(e){throw console.error("[infra.jsx] Error in getKubernetesGPUsFromContexts:",e),e}}async function p(e){try{let t=await o.x.post("/kubernetes_node_info",{context:e});if(!t.ok){let n="Failed to get kubernetes node info for context ".concat(e," with status ").concat(t.status,", error: ").concat(t.statusText);throw Error(n)}let n=t.headers.get("X-Skypilot-Request-ID");if(!n)throw Error("No request ID received from server for kubernetes node info");let r=await o.x.get("/api/get?request_id=".concat(n));if(!r.ok){let t=await (0,i.oN)(r),n="Failed to get kubernetes node info result for context ".concat(e," with status ").concat(r.status,", error: ").concat(t);throw Error(n)}let s=await r.json();return(s.return_value?JSON.parse(s.return_value):{}).node_info_dict||{}}catch(t){throw console.warn("[infra.jsx] Context ".concat(e," unavailable or timed out:"),t.message),t}}async function m(e){try{let t={};return e.forEach(e=>{let n=(0,l.y)(e.cloud,e.region);n&&(t[n]||(t[n]={clusters:0,jobs:0}),t[n].jobs+=1)}),t}catch(e){throw console.error("=== Error in getContextJobs ===",e),e}}async function g(e){try{let t={};return e.forEach(e=>{let n=(0,l.y)(e.cloud,e.region);n&&(t[n]||(t[n]={clusters:0,jobs:0}),t[n].clusters+=1)}),t}catch(e){throw console.error("=== Error in getContextClusters ===",e),e}}async function v(){try{let e=await o.x.post("/slurm_gpu_availability",{});if(!e.ok){let t="Failed to get slurm cluster GPUs with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("No request ID received from server for slurm cluster GPUs");let n=await o.x.get("/api/get?request_id=".concat(t));if(500===n.status){try{let e=await n.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Slurm cluster GPUs:",t.message)}catch(e){console.error("Error parsing JSON for Slurm error:",e)}}catch(e){console.error("Error parsing JSON for Slurm 500 response:",e)}return[]}if(!n.ok){let e="Failed to get slurm cluster GPUs result with status ".concat(n.status);throw Error(e)}let r=await n.json();return r.return_value?JSON.parse(r.return_value):[]}catch(e){return console.error("Error fetching Slurm cluster GPUs:",e),[]}}async function b(){try{let e=await o.x.post("/slurm_node_info",{});if(!e.ok){let t="Failed to get slurm node info with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("No request ID received from server for slurm node info");let n=await o.x.get("/api/get?request_id=".concat(t));if(500===n.status){try{let e=await n.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Slurm per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON for Slurm node error:",e)}}catch(e){console.error("Error parsing JSON for Slurm node 500 response:",e)}return[]}if(!n.ok){let e="Failed to get slurm node info result with status ".concat(n.status);throw Error(e)}let r=await n.json();return r.return_value?JSON.parse(r.return_value):[]}catch(e){return console.error("Error fetching Slurm per node GPUs:",e),[]}}async function y(){return await w()}async function w(){try{let[e,t]=await Promise.all([v(),b()]),n={},r={},o={};for(let t of e){let e=t[0];for(let o of t[1]){let t=o[0],i=o[1].join(", "),s=o[2],l=o[3];t in n?(n[t].gpu_total+=s,n[t].gpu_free+=l):n[t]={gpu_total:s,gpu_free:l,gpu_name:t},r["".concat(e,"#").concat(t)]={gpu_name:t,gpu_requestable_qty_per_node:i,gpu_total:s,gpu_free:l,cluster:e}}}for(let e of t){let t=e.slurm_cluster_name||"default";o["".concat(t,"/").concat(e.node_name,"/").concat(e.gpu_type||"-")]={node_name:e.node_name,gpu_name:e.gpu_type||"-",gpu_total:e.total_gpus||0,gpu_free:e.free_gpus||0,cluster:t,partition:e.partition||"default"}}return{allSlurmGPUs:Object.values(n).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perClusterSlurmGPUs:Object.values(r).sort((e,t)=>e.cluster.localeCompare(t.cluster)||e.gpu_name.localeCompare(t.gpu_name)),perNodeSlurmGPUs:Object.values(o).sort((e,t)=>(e.cluster||"").localeCompare(t.cluster||"")||(e.node_name||"").localeCompare(t.node_name||"")||(e.gpu_name||"").localeCompare(t.gpu_name||""))}}catch(e){return console.error("Error fetching Slurm GPUs:",e),{allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[]}}}},68969:function(e,t,n){"use strict";n.d(t,{Ce:function(){return g},NJ:function(){return m},UA:function(){return p},_5:function(){return u},aT:function(){return d},getManagedJobs:function(){return h},jh:function(){return v},vs:function(){return f}});var r=n(67294),o=n(15821),i=n(93225),s=n(6378);n(97335);var l=n(47145),a=n(10410);let c=["job_id","_job_id","job_name","user_name","user_hash","workspace","submitted_at","job_duration","status","resources","cloud","region","accelerators","cluster_resources","cluster_resources_full","recovery_count","pool","pool_hash","details","failure_reason","user_yaml","entrypoint","is_job_group","execution","is_primary_in_job_group","links","node_names"];function u(e){if(!e||0===e.length)return null;let t=e.filter(e=>null===e.is_primary_in_job_group||void 0===e.is_primary_in_job_group||!0===e.is_primary_in_job_group);for(let n of t.length>0?t:e)if("SUCCEEDED"!==n.status)return n.status;return"SUCCEEDED"}async function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var t;let{allUsers:n=!0,skipFinished:r=!1,allFields:o=!1,nameMatch:u,userMatch:h,workspaceMatch:d,poolMatch:f,page:p,limit:m,statuses:g,fields:v,jobIDs:b}=e,y={all_users:n,verbose:!0,skip_finished:r};void 0!==u&&(y.name_match=u),void 0!==h&&(y.user_match=h),void 0!==d&&(y.workspace_match=d),void 0!==f&&(y.pool_match=f),void 0!==p&&(y.page=p),void 0!==m&&(y.limit=m),void 0!==g&&g.length>0&&(y.statuses=g),void 0!==b&&b.length>0&&(y.job_ids=b),o||(v&&v.length>0?y.fields=v:y.fields=c);let w=await l.x.post("/jobs/queue/v2",y);if(!w.ok){let e="Failed to get managed jobs with status ".concat(w.status);throw Error(e)}let x=w.headers.get("X-Skypilot-Request-ID");if(!x)throw Error("No request ID received from server for managed jobs");let k=await l.x.get("/api/get?request_id=".concat(x)),S=k.statusText;if(500===k.status)try{let e=await k.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===i.iW)return{jobs:[],total:0,controllerStopped:!0};S=t.message||String(e.detail.error)}catch(t){console.error("Error parsing JSON from data.detail.error:",t),S=String(e.detail.error)}}catch(e){console.error("Error parsing response JSON:",e),S=String(e)}if(!k.ok){let e="API request to get managed jobs result failed with status ".concat(k.status,", error: ").concat(S);throw Error(e)}let C=await k.json(),O=C.return_value?JSON.parse(C.return_value):[],E=Array.isArray(O)?O:(null==O?void 0:O.jobs)||[],P=Array.isArray(O)?E.length:null!==(t=null==O?void 0:O.total)&&void 0!==t?t:E.length,T=(null==O?void 0:O.total_no_filter)||P,M=(null==O?void 0:O.status_counts)||{},A=E.map(e=>{var t;let n=0;e.end_at&&e.submitted_at?n=e.end_at-e.submitted_at:e.submitted_at&&(n=Date.now()/1e3-e.submitted_at);let r=[];e.submitted_at&&r.push({type:"PENDING",timestamp:e.submitted_at}),e.start_at&&r.push({type:"RUNNING",timestamp:e.start_at}),e.end_at&&r.push({type:e.status,timestamp:e.end_at});let o="",i="",s="",l="",a="";try{if(o=e.cloud||"",s=e.cluster_resources,i=e.region||"","-"===i&&(i=""),o&&(l=o,i&&(l+=" (".concat(i,")"))),a=l,e.accelerators){let t=Object.entries(e.accelerators).map(e=>{let[t,n]=e;return"".concat(n,"x").concat(t)}).join(", ");t&&(a+=" (".concat(t,")"))}}catch(t){s=e.cluster_resources}return{id:e.job_id,task_job_id:e._job_id,task:e.task_name,name:e.job_name,job_duration:e.job_duration,total_duration:n,workspace:e.workspace,status:e.status,requested_resources:e.resources,resources_str:s,resources_str_full:e.cluster_resources_full||s,cloud:o,region:e.region,infra:l,full_infra:a,recoveries:e.recovery_count,details:e.details||e.failure_reason,user:e.user_name,user_hash:e.user_hash,submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,events:r,dag_yaml:e.user_yaml,entrypoint:e.entrypoint,git_commit:(null===(t=e.metadata)||void 0===t?void 0:t.git_commit)||"-",links:e.links||{},pool:e.pool,pool_hash:e.pool_hash,current_cluster_name:e.current_cluster_name,cluster_name_on_cloud:e.cluster_name_on_cloud,job_id_on_pool_cluster:e.job_id_on_pool_cluster,accelerators:e.accelerators,labels:e.labels||{},node_names:e.node_names,is_job_group:e.is_job_group,execution:e.execution,is_primary_in_job_group:e.is_primary_in_job_group}});return{jobs:await (0,a.M)(A,"jobs",{dashboardCache:s.ZP,rawData:E}),total:P,totalNoFilter:T,controllerStopped:!1,statusCounts:M}}catch(e){throw console.error("Error fetching managed job data:",e),e}}async function d(e){let{allUsers:t=!0,nameMatch:n,userMatch:r,workspaceMatch:o,poolMatch:i,page:s=1,limit:l=10,jobIDs:a,fields:c,allFields:u=!1,useClientPagination:d=!0}=e||{};try{if(!d)return await h(e);let f=await h({allUsers:t,nameMatch:n,userMatch:r,workspaceMatch:o,poolMatch:i,jobIDs:a,fields:c,allFields:u});if(f.controllerStopped||!f.jobs)return f;let p=f.jobs,m=p.length,g=(s-1)*l;return{jobs:p.slice(g,g+l),total:m,controllerStopped:!1}}catch(e){throw console.error("Error fetching managed job data with client pagination:",e),e}}async function f(){try{let e=await l.x.post("/jobs/pool_status",{pool_names:null});if(!e.ok){let t="Initial API request to get pool status failed with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("No request ID received from server for getting pool status");let n=await l.x.get("/api/get?request_id=".concat(t)),r=n.statusText;if(500===n.status)try{let e=await n.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===i.iW)return{pools:[],controllerStopped:!0};r=t.message||String(e.detail.error)}catch(t){console.error("Error parsing JSON from data.detail.error:",t),r=String(e.detail.error)}}catch(e){console.error("Error parsing response JSON:",e),r=String(e)}if(!n.ok){let e="API request to get pool status result failed with status ".concat(n.status,", error: ").concat(r);throw Error(e)}let o=await n.json(),a=o.return_value?JSON.parse(o.return_value):[],c={jobs:[]};try{let e=await s.ZP.get(h,[{allUsers:!0,skipFinished:!0,fields:["pool","status"]}]);e.controllerStopped||(c=e)}catch(e){console.warn("Failed to fetch jobs for pool job counts:",e)}let u={},d=["SUCCEEDED","FAILED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER","CANCELLED"];return c.jobs&&Array.isArray(c.jobs)&&c.jobs.forEach(e=>{let t=e.pool,n=e.status;t&&!d.includes(n)&&(u[t]||(u[t]={}),u[t][n]=(u[t][n]||0)+1)}),{pools:a.map(e=>({...e,jobCounts:u[e.name]||{}})),controllerStopped:!1}}catch(e){throw console.error("Error fetching pools:",e),e}}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[n,o]=(0,r.useState)(null),[i,l]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{(async function(){if(e)try{var t;l(!0);let n=await s.ZP.get(h,[{allUsers:!0,allFields:!0,jobIDs:[e]}]),r=(null==n?void 0:null===(t=n.jobs)||void 0===t?void 0:t.filter(t=>String(t.id)===String(e)))||[];r.length>0?o({jobs:r,controllerStopped:n.controllerStopped||!1}):o({jobs:[],controllerStopped:n.controllerStopped||!1})}catch(e){console.error("Error fetching single managed job data:",e),o({jobs:[],controllerStopped:!1})}finally{l(!1)}})()},[e,t]),{jobData:n,loading:i}}async function m(e){let t,{jobId:n,task:r=null,controller:i=!1,signal:s,onNewLog:a}=e,c=Date.now(),u=new Promise(e=>{let n=()=>{let r=Date.now()-c;r>=3e4?e({timeout:!0}):t=setTimeout(n,3e4-r)};t=setTimeout(n,3e4)}),h=(async()=>{try{let e=(await l.x.fetchImmediate("/jobs/logs",{controller:i,follow:!1,job_id:n,tail:5e3,task:r},"POST",{signal:s})).body.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)break;c=Date.now();let r=new TextDecoder().decode(n);a(r)}}finally{if(!s||!s.aborted)try{e.cancel()}catch(e){"AbortError"!==e.name&&console.warn("Error canceling reader:",e)}t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),d=await Promise.race([h,u]);if(t&&clearTimeout(t),d.timeout){(0,o.C)("Log request for job ".concat(n," timed out after ").concat(30,"s of inactivity"),"warning");return}}async function g(e,t,n){let r="",s="",a="",c={};if("restartcontroller"===e)r="Restarting",s="restarted",a="jobs/queue/v2",c={all_users:!0,refresh:!0,skip_finished:!0,fields:["status"]},t="controller";else throw Error("Invalid action: ".concat(e));(0,o.C)("".concat(r," job ").concat(t,"..."),"info");try{try{let e=await l.x.fetchImmediate("/".concat(a),c);if(!e.ok){console.error("Initial API request ".concat(a," failed with status ").concat(e.status)),(0,o.C)("".concat(r," job ").concat(t," failed with status ").concat(e.status,"."),"error");return}let u=e.headers.get("X-Skypilot-Request-ID");if(!u){console.error("No request ID received from server for ".concat(a)),(0,o.C)("".concat(r," job ").concat(t," failed with no request ID."),"error");return}let h=await l.x.fetchImmediate("/api/get?request_id=".concat(u),void 0,"GET");if(200===h.status)(0,o.C)("Job ".concat(t," ").concat(s," successfully."),"success");else if(500===h.status)try{let e=await h.json();if(e.detail&&e.detail.error)try{let s=JSON.parse(e.detail.error);s.type&&s.type===i.Bo?(0,o.C)("".concat(r," job ").concat(t," is not supported!"),"error",1e4):s.type&&s.type===i.mF?(0,o.C)("Cluster ".concat(n," does not exist."),"error"):s.type&&s.type===i.iW?(0,o.C)("Cluster ".concat(n," is not up."),"error"):(0,o.C)("".concat(r," job ").concat(t," failed: ").concat(s.type),"error")}catch(n){(0,o.C)("".concat(r," job ").concat(t," failed: ").concat(e.detail.error),"error")}else(0,o.C)("".concat(r," job ").concat(t," failed with no details."),"error")}catch(e){(0,o.C)("".concat(r," job ").concat(t," failed with parse error."),"error")}else(0,o.C)("".concat(r," job ").concat(t," failed with status ").concat(h.status,"."),"error")}catch(e){console.error("Fetch error:",e),(0,o.C)("Network error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}catch(e){console.error("Error in handleStop:",e),(0,o.C)("Critical error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}async function v(e){let{jobId:t=null,name:n=null,controller:r=!1}=e;try{let e=await l.x.fetch("/jobs/download_logs",{job_id:t,name:n,controller:r,refresh:!1}),i=Object.values(e||{});if(!i.length){(0,o.C)("No logs found to download.","warning");return}let s=await l.x.fetchImmediate("/download?relative=items",{folder_paths:i});if(!s.ok){let e=await s.text();throw Error("Download failed: ".concat(s.status," ").concat(e))}let a=await s.blob(),c=window.URL.createObjectURL(a),u=document.createElement("a"),h=new Date().toISOString().replace(/[:.]/g,"-"),d=t?"job-".concat(t):n?"job-".concat(n):"job";u.href=c,u.download="managed-".concat(d,"-").concat(r?"controller-logs":"logs","-").concat(h,".zip"),document.body.appendChild(u),u.click(),u.remove(),window.URL.revokeObjectURL(c)}catch(e){console.error("Error downloading managed job logs:",e),(0,o.C)("Error downloading managed job logs: ".concat(e.message),"error")}}},29326:function(e,t,n){"use strict";n.d(t,{IS:function(){return h},It:function(){return i},MV:function(){return l},Ri:function(){return s},_x:function(){return c},ez:function(){return u},hY:function(){return a},mF:function(){return f},wJ:function(){return d}});var r=n(93225),o=n(15821);async function i(){try{let e=await fetch("".concat(r.f4,"/ssh_node_pools"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return console.error("Error fetching SSH Node Pools:",e),{}}}async function s(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error updating SSH Node Pools:",e),e}}async function l(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deleting SSH Node Pool:",e),e}}async function a(e,t){try{let n=new FormData;n.append("key_name",e),n.append("key_file",t);let o=await fetch("".concat(r.f4,"/ssh_node_pools/keys"),{method:"POST",body:n});if(!o.ok)throw Error("HTTP error! status: ".concat(o.status));return await o.json()}catch(e){throw console.error("Error uploading SSH key:",e),e}}async function c(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/deploy"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deploying SSH Node Pool:",e),e}}async function u(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/down"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error tearing down SSH Node Pool:",e),e}}async function h(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/status"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error fetching SSH Node Pool status:",e),e}}async function d(e){let t,{requestId:n,signal:i,onNewLog:s}=e,l=Date.now(),a=new Promise(e=>{let n=()=>{let r=Date.now()-l;r>=3e5?e({timeout:!0}):t=setTimeout(n,3e5-r)};t=setTimeout(n,3e5)}),c=(async()=>{try{let e=await fetch("".concat(r.f4,"/api/stream?request_id=").concat(n,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...i?{signal:i}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let o=e.body.getReader();try{for(;;){let{done:e,value:t}=await o.read();if(e)break;l=Date.now();let n=new TextDecoder().decode(t);s(n)}}finally{o.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),u=await Promise.race([c,a]);if(t&&clearTimeout(t),u.timeout){(0,o.C)("SSH deployment log stream timed out after ".concat(300,"s of inactivity"),"warning");return}}async function f(e){let t,{requestId:n,signal:i,onNewLog:s,operationType:l="operation"}=e,a=Date.now(),c=new Promise(e=>{let n=()=>{let r=Date.now()-a;r>=3e5?e({timeout:!0}):t=setTimeout(n,3e5-r)};t=setTimeout(n,3e5)}),u=(async()=>{try{let e=await fetch("".concat(r.f4,"/api/stream?request_id=").concat(n,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...i?{signal:i}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let o=e.body.getReader();try{for(;;){let{done:e,value:t}=await o.read();if(e)break;a=Date.now();let n=new TextDecoder().decode(t);s(n)}}finally{o.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),h=await Promise.race([u,c]);if(t&&clearTimeout(t),h.timeout){(0,o.C)("SSH ".concat(l," log stream timed out after ").concat(300,"s of inactivity"),"warning");return}}},15821:function(e,t,n){"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=document.getElementById("toast-container");r||((r=document.createElement("div")).id="toast-container",r.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(r));let o=document.createElement("div");switch(o.className="rounded-md border-l-4 p-4 shadow-md flex items-center justify-between max-w-md w-full mb-2 pointer-events-auto",t){case"success":o.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":o.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":o.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:o.className+=" bg-blue-100 border-blue-500 text-blue-800"}return o.innerHTML='\n      <div class="flex-1 mr-2">\n        <p class="text-sm font-medium">'.concat(e,'</p>\n      </div>\n      <button class="text-gray-500 hover:text-gray-700 focus:outline-none" aria-label="Close toast">\n        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n          <line x1="18" y1="6" x2="6" y2="18"></line>\n          <line x1="6" y1="6" x2="18" y2="18"></line>\n        </svg>\n      </button>\n    '),r.appendChild(o),o.querySelector("button").addEventListener("click",()=>{r.removeChild(o)}),setTimeout(()=>{r.contains(o)&&r.removeChild(o)},n),o}n.d(t,{C:function(){return r}})},53081:function(e,t,n){"use strict";n.d(t,{R:function(){return i},i:function(){return o}});var r=n(47145);async function o(){try{let e=await r.x.get("/users/service-account-tokens");if(!e.ok)throw Error("Failed to fetch service account tokens with status ".concat(e.status));return await e.json()||[]}catch(e){throw console.error("Failed to fetch service account tokens:",e),e}}async function i(){try{let e=await r.x.get("/users");if(!e.ok)throw Error("Failed to fetch users with status ".concat(e.status));return(await e.json()||[]).filter(e=>!(["dashboard","local"].includes(e.name)&&"legacy"===e.user_type)).map(e=>({userId:e.id,username:e.name,role:e.role,created_at:e.created_at,userType:e.user_type}))}catch(e){throw console.error("Failed to fetch users:",e),e}}},19238:function(e,t,n){"use strict";n.d(t,{C:function(){return i},w:function(){return s}});var r=n(47145),o=n(94545);async function i(){try{return(await r.x.fetch("/volumes",{},"GET")).map(e=>{var t,n,r;let o=e.cloud||"";return e.region&&(o+="/".concat(e.region)),e.zone&&(o+="/".concat(e.zone)),{name:e.name,launched_at:e.launched_at,user_hash:e.user_hash,user_name:e.user_name||"-",workspace:e.workspace||"-",last_attached_at:e.last_attached_at,status:e.status,type:e.type,cloud:e.cloud,region:e.region,zone:e.zone,infra:o,size:"".concat(e.size,"Gi"),config:e.config,storage_class:(null===(t=e.config)||void 0===t?void 0:t.storage_class_name)||"-",access_mode:(null===(n=e.config)||void 0===n?void 0:n.access_mode)||"-",namespace:(null===(r=e.config)||void 0===r?void 0:r.namespace)||"-",name_on_cloud:e.name_on_cloud,usedby_pods:e.usedby_pods,usedby_clusters:e.usedby_clusters,error_message:e.error_message||null}})||[]}catch(e){throw console.error("Failed to fetch volumes:",e),e}}async function s(e){let t="";try{let n=await r.x.post("/volumes/delete",{names:[e]});if(!n.ok)return console.error("Initial API request to delete volume failed with status ".concat(n.status)),{success:!1,msg:"Failed to delete volume with status ".concat(n.status)};let i=n.headers.get("X-SkyPilot-Request-ID");if(!i)return console.error("No request ID received from server for deleting volume"),{success:!1,msg:"No request ID received from server for deleting volume"};let s=await r.x.get("/api/get?request_id=".concat(i));if(!s.ok){let e=await (0,o.oN)(s);return t="Failed to delete volume with status ".concat(s.status,", error: ").concat(e),console.error(t),{success:!1,msg:t}}return{success:!0}}catch(e){return console.error(t="Failed to delete volume: ".concat(e)),{success:!1,msg:t}}}},17324:function(e,t,n){"use strict";n.d(t,{LD:function(){return d},MB:function(){return a},eA:function(){return l},getEnabledClouds:function(){return i},getWorkspaces:function(){return o},iE:function(){return u},rF:function(){return h},zl:function(){return c}});var r=n(47145);async function o(){try{let e=await r.x.get("/workspaces");if(!e.ok)throw Error("Error scheduling getWorkspaces: ".concat(e.statusText," (status ").concat(e.status,")"));let t=e.headers.get("X-Skypilot-Request-ID");if(!t){console.warn("X-Skypilot-Request-ID header not found in /workspaces response. Attempting to find request_id in response body as a fallback.");try{let n=await e.json();if(n&&n.request_id)t=n.request_id,console.log("Found request_id in /workspaces response body (fallback):",t);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /workspaces.")}catch(t){let e=t.message||"Error processing fallback for request_id from /workspaces response body.";throw console.error("Error in /workspaces request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!t)throw Error("Failed to obtain X-Skypilot-Request-ID from /workspaces response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching workspace data with request_id: ".concat(t));let n=await r.x.get("/api/get?request_id=".concat(t));if(!n.ok){let e="Error fetching workspace data for request ID ".concat(t,": ").concat(n.statusText," (status ").concat(n.status,")");try{let r=await n.json();if(r&&r.detail){let n=r.detail;try{let e=JSON.parse(n);e&&e.error?n=e.error:e&&e.result&&e.result.error&&(n=e.result.error)}catch(e){}e="Error fetching workspace data for request ID ".concat(t,": ").concat(n)}}catch(e){}throw Error(e)}let o=await n.json();if(console.log("[Connector Debug] Full resultData from /api/get:",o),"FAILED"===o.status){let e="Unknown error during task execution";if(o.error)"string"==typeof o.error?e=o.error:"object"==typeof o.error&&(e=o.error.message||o.error.detail||JSON.stringify(o.error));else if(o.result&&o.result.error)"string"==typeof o.result.error?e=o.result.error:"object"==typeof o.result.error&&(e=o.result.error.message||o.result.error.detail||JSON.stringify(o.result.error));else if(o.return_value)try{let t=JSON.parse(o.return_value);t.error&&(e="string"==typeof t.error?t.error:t.error.message||t.error.detail||JSON.stringify(t.error))}catch(t){(o.return_value.includes("Error")||o.return_value.includes("Cannot"))&&(e=o.return_value)}throw Error(e)}let i={};if("SUCCEEDED"===o.status&&o.return_value)try{i=JSON.parse(o.return_value),console.log("Successfully parsed workspace data from return_value:",i)}catch(e){throw console.error("Failed to parse workspace data from return_value:",e,"Raw return_value:",o.return_value),Error("Failed to parse workspace data for request ID ".concat(t,": ").concat(e.message))}else o.result&&(console.warn("Using resultData.result as fallback for status ".concat(o.status)),i=o.result);return console.log("Effectively fetched workspace data (to be returned):",i),i||{}}catch(e){throw console.error("Failed to fetch workspaces (in getWorkspaces function):",e.message,e.stack),e}}async function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let n="/enabled_clouds",o=new URLSearchParams;e&&o.append("workspace",e),t&&o.append("expand","true"),o.toString()&&(n+="?".concat(o.toString()));let i=await r.x.get(n);if(!i.ok)throw Error("Error scheduling getEnabledClouds: ".concat(i.statusText," (status ").concat(i.status,")"));let s=i.headers.get("X-Skypilot-Request-ID");if(!s){console.warn("X-Skypilot-Request-ID header not found in /enabled_clouds response. Attempting to find request_id in response body as a fallback.");try{let e=await i.json();if(e&&e.request_id)s=e.request_id,console.log("Found request_id in /enabled_clouds response body (fallback):",s);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /enabled_clouds.")}catch(t){let e=t.message||"Error processing fallback for request_id from /enabled_clouds response body.";throw console.error("Error in /enabled_clouds request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!s)throw Error("Failed to obtain X-Skypilot-Request-ID from /enabled_clouds response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching enabled_clouds data with request_id: ".concat(s));let l=await r.x.get("/api/get?request_id=".concat(s));if(!l.ok){let e="Error fetching enabled_clouds data for request ID ".concat(s,": ").concat(l.statusText," (status ").concat(l.status,")");try{let t=await l.json();if(t&&t.detail){let n=t.detail;try{let e=JSON.parse(n);e&&e.error?n=e.error:e&&e.result&&e.result.error&&(n=e.result.error)}catch(e){}e="Error fetching enabled_clouds data for request ID ".concat(s,": ").concat(n)}}catch(e){}throw Error(e)}let a=await l.json();if(console.log("[Connector Debug] Full resultData from /api/get for enabled_clouds:",a),"FAILED"===a.status){let e=a.error||a.result&&a.result.error||"Unknown error during task execution for enabled_clouds";throw Error("Fetching enabled_clouds data failed for request ID ".concat(s,": ").concat(e))}let c=[];if("SUCCEEDED"===a.status&&a.return_value)try{c=JSON.parse(a.return_value),console.log("Successfully parsed enabled_clouds data for workspace ".concat(e,":"),c)}catch(e){throw console.error("Failed to parse enabled_clouds data from return_value:",e,"Raw return_value:",a.return_value),Error("Failed to parse enabled_clouds data for request ID ".concat(s,": ").concat(e.message))}else a.result&&(console.warn("Using resultData.result as fallback for enabled_clouds status ".concat(a.status)),c=a.result);return Array.isArray(c)?c:[]}catch(e){throw console.error("Failed to fetch enabled_clouds (in getEnabledClouds function):",e.message,e.stack),e}}async function s(e,t){console.log("Polling for ".concat(t," task completion with request_id: ").concat(e));let n=await r.x.get("/api/get?request_id=".concat(e));if(!n.ok){let r="Error fetching ".concat(t," data for request ID ").concat(e,": ").concat(n.statusText," (status ").concat(n.status,")");try{let e=await n.json();if(console.error("[Error Debug] ".concat(t," HTTP error response:"),JSON.stringify(e,null,2)),e&&e.detail){if("object"==typeof e.detail&&e.detail.error)try{let n=JSON.parse(e.detail.error);if(n&&n.message)r="".concat(t," failed: ").concat(n.message);else if(n&&"object"==typeof n){let e=n.type||JSON.stringify(n);r="".concat(t," failed: ").concat(e)}}catch(n){r="".concat(t," failed: ").concat(e.detail.error)}else if("string"==typeof e.detail)r="".concat(t," failed: ").concat(e.detail);else{let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[r,o]of Object.entries(e)){let e=n(o,t?"".concat(t,".").concat(r):r);if(e)return e}return null},o=n(e.detail);o&&(r="".concat(t," failed: ").concat(o))}}}catch(e){console.error("[Error Debug] Failed to parse error response:",e)}throw Error(r)}let o=await n.json();if(console.log("[Connector Debug] ".concat(t," resultData:"),o),"FAILED"===o.status){console.error("[Error Debug] ".concat(t," failed. Full resultData:"),JSON.stringify(o,null,2)),console.error("[Error Debug] resultData.error:",o.error),console.error("[Error Debug] resultData.result:",o.result),console.error("[Error Debug] resultData.return_value:",o.return_value);let e="Unknown error during ".concat(t," task execution");if(o.error)"string"==typeof o.error?e=o.error:"object"==typeof o.error&&(e=o.error.message||o.error.detail||JSON.stringify(o.error));else if(o.result&&o.result.error)"string"==typeof o.result.error?e=o.result.error:"object"==typeof o.result.error&&(e=o.result.error.message||o.result.error.detail||JSON.stringify(o.result.error));else if(o.return_value)try{let t=JSON.parse(o.return_value);t.error&&(e="string"==typeof t.error?t.error:t.error.message||t.error.detail||JSON.stringify(t.error))}catch(t){o.return_value&&(o.return_value.includes("Error")||o.return_value.includes("Cannot"))&&(e=o.return_value)}if(e==="Unknown error during ".concat(t," task execution")){let t=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[r,o]of Object.entries(e)){let e=t(o,n?"".concat(n,".").concat(r):r);if(e)return e}return null},n=t(o);n&&(e=n)}throw Error(e)}let i={};if("SUCCEEDED"===o.status&&o.return_value)try{i=JSON.parse(o.return_value),console.log("Successfully parsed ".concat(t," data:"),i)}catch(n){throw console.error("Failed to parse ".concat(t," data from return_value:"),n,"Raw return_value:",o.return_value),Error("Failed to parse ".concat(t," data for request ID ").concat(e,": ").concat(n.message))}else o.result&&(console.warn("Using resultData.result as fallback for ".concat(t," status ").concat(o.status)),i=o.result);return i}async function l(e,t){try{console.log("Updating workspace ".concat(e," with config:"),t);let n=await r.x.post("/workspaces/update",{workspace_name:e,config:t});if(!n.ok)throw Error("Error scheduling updateWorkspace: ".concat(n.statusText," (status ").concat(n.status,")"));let o=n.headers.get("X-Skypilot-Request-ID");if(!o)throw Error("Failed to obtain request ID for updateWorkspace");return await s(o,"updateWorkspace")}catch(e){throw console.error("Failed to update workspace:",e),e}}let a=async(e,t)=>{try{let n=await r.x.post("/workspaces/create",{workspace_name:e,config:t});if(!n.ok)throw await n.text(),Error("Error scheduling createWorkspace: ".concat(n.statusText," (status ").concat(n.status,")"));let o=n.headers.get("X-Skypilot-Request-ID");if(!o)throw Error("Failed to obtain request ID for createWorkspace");return await s(o,"createWorkspace")}catch(e){throw console.error("Failed to create workspace:",e),e}};async function c(e){try{console.log("Deleting workspace ".concat(e));let t=await r.x.post("/workspaces/delete",{workspace_name:e});if(!t.ok)throw Error("Error scheduling deleteWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let n=t.headers.get("X-Skypilot-Request-ID");if(!n)throw Error("Failed to obtain request ID for deleteWorkspace");console.log("[Delete Debug] Got request ID for deleteWorkspace: ".concat(n));try{let e=await s(n,"deleteWorkspace");return console.log("[Delete Debug] deleteWorkspace completed successfully:",e),e}catch(e){throw console.error("[Delete Debug] deleteWorkspace failed with error:",e),console.error("[Delete Debug] Error message:",e.message),e}}catch(e){throw console.error("Failed to delete workspace:",e),e}}async function u(){try{console.log("Getting entire SkyPilot configuration");let e=await r.x.get("/workspaces/config");if(!e.ok)throw Error("Error scheduling getConfig: ".concat(e.statusText," (status ").concat(e.status,")"));let t=e.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for getConfig");return await s(t,"getConfig")}catch(e){throw console.error("Failed to get config:",e),e}}async function h(e){try{console.log("Updating entire SkyPilot configuration with config:",e);let t=await r.x.post("/workspaces/config",{config:e});if(!t.ok)throw Error("Error scheduling updateConfig: ".concat(t.statusText," (status ").concat(t.status,")"));let n=t.headers.get("X-Skypilot-Request-ID");if(!n)throw Error("Failed to obtain request ID for updateConfig");return await s(n,"updateConfig")}catch(e){throw console.error("Failed to update config:",e),e}}async function d(){try{console.log("Running sky check to refresh cloud credentials");let e=await r.x.fetch("/check",{},"POST");if(!e.ok)throw Error("Sky check failed: ".concat(e.statusText," (status ").concat(e.status,")"));return{success:!0}}catch(e){throw console.error("Failed to run sky check:",e),e}}},94545:function(e,t,n){"use strict";function r(e){return e.startsWith("sky-jobs-controller-")}function o(e,t,n){return null===t?e:[...e].sort((e,r)=>e[t]<r[t]?"ascending"===n?-1:1:e[t]>r[t]?"ascending"===n?1:-1:0)}async function i(e){let t=e.statusText;if(500===e.status)try{let n=await e.json();if(n.detail&&n.detail.error)try{t=JSON.parse(n.detail.error).message||String(n.detail.error)}catch(e){console.error("Error parsing JSON from data.detail.error:",e),t=String(n.detail.error)}}catch(e){console.error("Error parsing response JSON:",e),t=String(e)}return t}n.d(t,{R0:function(){return o},Ym:function(){return r},oN:function(){return i}})},6556:function(e,t,n){"use strict";n.d(t,{n:function(){return s}});var r=n(67294);let o="skypilot-dashboard-first-visit",i="skypilot-dashboard-tour-completed";function s(){let[e,t]=(0,r.useState)(!1),[n,s]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{a(!0);let e=localStorage.getItem(o),n=localStorage.getItem(i);e||(t(!0),localStorage.setItem(o,"true")),n&&s(!0)},[]),{isFirstVisit:!!l&&e,tourCompleted:!!l&&n,shouldShowTourPrompt:l&&e&&!n,shouldPulseHelpButton:l&&e&&!n,markTourCompleted:()=>{localStorage.setItem(i,"true"),s(!0)},resetFirstVisit:()=>{localStorage.removeItem(o),localStorage.removeItem(i),t(!0),s(!1)},isClient:l}}},94849:function(e,t,n){"use strict";let r,o;n.d(t,{C:function(){return t6},r:function(){return t3}});var i,s,l=n(85893),a=n(67294),c=n(11163);function u(e){return e instanceof HTMLElement}function h(e){return"function"==typeof e}function d(e){return"string"==typeof e}function f(e){return void 0===e}class p{on(e,t,n,r=!1){var o;return f(this.bindings)&&(this.bindings={}),f(this.bindings[e])&&(this.bindings[e]=[]),null==(o=this.bindings[e])||o.push({handler:t,ctx:n,once:r}),this}once(e,t,n){return this.on(e,t,n,!0)}off(e,t){if(f(this.bindings)||f(this.bindings[e]))return this;if(f(t))delete this.bindings[e];else{var n;null==(n=this.bindings[e])||n.forEach((n,r)=>{if(n.handler===t){var o;null==(o=this.bindings[e])||o.splice(r,1)}})}return this}trigger(e,...t){if(!f(this.bindings)&&this.bindings[e]){var n;null==(n=this.bindings[e])||n.forEach((n,r)=>{let{ctx:o,handler:i,once:s}=n;if(i.apply(o||this,t),s){var l;null==(l=this.bindings[e])||l.splice(r,1)}})}return this}}function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function g(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}let v={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};function b(e,t){return t}function y(e,t){return e.filter(e=>void 0!==e)}function w(e){return"object"!=typeof e||null===e?0:Array.isArray(e)?2:!function(e){if(!k.has(Object.prototype.toString.call(e)))return!1;let{constructor:t}=e;if(void 0===t)return!0;let n=t.prototype;return!!(null!==n&&"object"==typeof n&&k.has(Object.prototype.toString.call(n))&&n.hasOwnProperty("isPrototypeOf"))}(e)?e instanceof Set?3:e instanceof Map?4:5:1}function x(e){return{*[Symbol.iterator](){for(let t of e)for(let e of t)yield e}}}v.defaultMerge,(i=s||(s={}))[i.NOT=0]="NOT",i[i.RECORD=1]="RECORD",i[i.ARRAY=2]="ARRAY",i[i.SET=3]="SET",i[i.MAP=4]="MAP",i[i.OTHER=5]="OTHER";let k=new Set(["[object Object]","[object Module]"]),S={mergeRecords:function(e,t,n){let r={};for(let o of function(e){let t=new Set;for(let n of e)for(let e of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(e);return t}(e)){let i=[];for(let t of e)"object"==typeof t&&Object.prototype.propertyIsEnumerable.call(t,o)&&i.push(t[o]);if(0===i.length)continue;let s=t.metaDataUpdater(n,{key:o,parents:e}),l=O(i,t,s);l!==v.skip&&("__proto__"===o?Object.defineProperty(r,o,{value:l,configurable:!0,enumerable:!0,writable:!0}):r[o]=l)}return r},mergeArrays:function(e){return e.flat()},mergeSets:function(e){return new Set(x(e))},mergeMaps:function(e){return new Map(x(e))},mergeOthers:function(e){return e.at(-1)}};function C(...e){return(function(e,t){var n,r,o;let i={defaultMergeFunctions:S,mergeFunctions:m({},S,Object.fromEntries(Object.entries(e).filter(([e,t])=>Object.hasOwn(S,e)).map(([e,t])=>!1===t?[e,S.mergeOthers]:[e,t]))),metaDataUpdater:null!=(n=e.metaDataUpdater)?n:b,deepmerge:s,useImplicitDefaultMerging:null!=(r=e.enableImplicitDefaultMerging)&&r,filterValues:!1===e.filterValues?void 0:null!=(o=e.filterValues)?o:y,actions:v};function s(...e){return O(e,i,void 0)}return s})({})(...e)}function O(e,t,n){var r;let o=null!=(r=null==t.filterValues?void 0:t.filterValues(e,n))?r:e;if(0===o.length)return;if(1===o.length)return E(o,t,n);let i=w(o[0]);if(0!==i&&5!==i){for(let e=1;e<o.length;e++)if(w(o[e])!==i)return E(o,t,n)}switch(i){case 1:return function(e,t,n){let r=t.mergeFunctions.mergeRecords(e,t,n);return r===v.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):r}(o,t,n);case 2:return function(e,t,n){let r=t.mergeFunctions.mergeArrays(e,t,n);return r===v.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):r}(o,t,n);case 3:return function(e,t,n){let r=t.mergeFunctions.mergeSets(e,t,n);return r===v.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):r}(o,t,n);case 4:return function(e,t,n){let r=t.mergeFunctions.mergeMaps(e,t,n);return r===v.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):r}(o,t,n);default:return E(o,t,n)}}function E(e,t,n){let r=t.mergeFunctions.mergeOthers(e,t,n);return r===v.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):r}function P(e){let t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){let r=t[n],o=e[r];"constructor"!==r&&"function"==typeof o&&(e[r]=o.bind(e))}return e}class T{constructor(e){}}class M{constructor(e,t){}}function A(e){return d(e)&&""!==e?"-"!==e.charAt(e.length-1)?`${e}-`:e:""}function R(e){return null==e||!e.element||!e.on}function _(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)})}let D=["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),N=Math.min,L=Math.max,I=Math.round,j=Math.floor,B=e=>({x:e,y:e}),W={left:"right",right:"left",bottom:"top",top:"bottom"},F={start:"end",end:"start"};function $(e,t){return"function"==typeof e?e(t):e}function z(e){return e.split("-")[0]}function H(e){return e.split("-")[1]}function q(e){return"x"===e?"y":"x"}function V(e){return"y"===e?"height":"width"}function U(e){return["top","bottom"].includes(z(e))?"y":"x"}function G(e,t,n){void 0===n&&(n=!1);let r=H(e),o=q(U(e)),i=V(o),s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Q(s)),[s,Q(s)]}function X(e){return e.replace(/start|end/g,e=>F[e])}function Q(e){return e.replace(/left|right|bottom|top/g,e=>W[e])}function K(e){return"number"!=typeof e?m({top:0,right:0,bottom:0,left:0},e):{top:e,right:e,bottom:e,left:e}}function Y(e){let{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}let J=["crossAxis","alignment","allowedPlacements","autoAlignment"],Z=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],ee=["mainAxis","crossAxis","limiter"];function et(e,t,n){let r,{reference:o,floating:i}=e,s=U(t),l=q(U(t)),a=V(l),c=z(t),u="y"===s,h=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2;switch(c){case"top":r={x:h,y:o.y-i.height};break;case"bottom":r={x:h,y:o.y+o.height};break;case"right":r={x:o.x+o.width,y:d};break;case"left":r={x:o.x-i.width,y:d};break;default:r={x:o.x,y:o.y}}switch(H(t)){case"start":r[l]-=f*(n&&u?-1:1);break;case"end":r[l]+=f*(n&&u?-1:1)}return r}let en=async(e,t,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await (null==s.isRTL?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:h}=et(c,r,a),d=r,f={},p=0;for(let n=0;n<l.length;n++){let{name:i,fn:g}=l[n],{x:v,y:b,data:y,reset:w}=await g({x:u,y:h,initialPlacement:r,placement:d,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=null!=v?v:u,h=null!=b?b:h,f=m({},f,{[i]:m({},f[i],y)}),w&&p<=50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(c=!0===w.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:u,y:h}=et(c,d,a)),n=-1)}return{x:u,y:h,placement:d,strategy:o,middlewareData:f}};async function er(e,t){var n;void 0===t&&(t={});let{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}=$(t,e),p=K(f),m=l[d?"floating"===h?"reference":"floating":h],g=Y(await i.getClippingRect({element:null==(n=await (null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),v="floating"===h?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await (null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),y=await (null==i.isElement?void 0:i.isElement(b))&&await (null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=Y(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:b,strategy:a}):v);return{top:(g.top-w.top+p.top)/y.y,bottom:(w.bottom-g.bottom+p.bottom)/y.y,left:(g.left-w.left+p.left)/y.x,right:(w.right-g.right+p.right)/y.x}}function eo(){return"undefined"!=typeof window}function ei(e){return ea(e)?(e.nodeName||"").toLowerCase():"#document"}function es(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function el(e){var t;return null==(t=(ea(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ea(e){return!!eo()&&(e instanceof Node||e instanceof es(e).Node)}function ec(e){return!!eo()&&(e instanceof Element||e instanceof es(e).Element)}function eu(e){return!!eo()&&(e instanceof HTMLElement||e instanceof es(e).HTMLElement)}function eh(e){return!!eo()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof es(e).ShadowRoot)}function ed(e){let{overflow:t,overflowX:n,overflowY:r,display:o}=ev(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function ef(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function ep(e){let t=em(),n=ec(e)?ev(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some(e=>(n.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(n.contain||"").includes(e))}function em(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}function eg(e){return["html","body","#document"].includes(ei(e))}function ev(e){return es(e).getComputedStyle(e)}function eb(e){return ec(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ey(e){if("html"===ei(e))return e;let t=e.assignedSlot||e.parentNode||eh(e)&&e.host||el(e);return eh(t)?t.host:t}function ew(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let o=function e(t){let n=ey(t);return eg(n)?t.ownerDocument?t.ownerDocument.body:t.body:eu(n)&&ed(n)?n:e(n)}(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),s=es(o);if(i){let e=ex(s);return t.concat(s,s.visualViewport||[],ed(o)?o:[],e&&n?ew(e):[])}return t.concat(o,ew(o,[],n))}function ex(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ek(e){let t=ev(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=eu(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=I(n)!==i||I(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function eS(e){return ec(e)?e:e.contextElement}function eC(e){let t=eS(e);if(!eu(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ek(t),s=(i?I(n.width):n.width)/r,l=(i?I(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),l&&Number.isFinite(l)||(l=1),{x:s,y:l}}let eO=B(0);function eE(e){let t=es(e);return em()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:eO}function eP(e,t,n,r){var o;void 0===t&&(t=!1),void 0===n&&(n=!1);let i=e.getBoundingClientRect(),s=eS(e),l=B(1);t&&(r?ec(r)&&(l=eC(r)):l=eC(e));let a=(void 0===(o=n)&&(o=!1),r&&(!o||r===es(s))&&o)?eE(s):B(0),c=(i.left+a.x)/l.x,u=(i.top+a.y)/l.y,h=i.width/l.x,d=i.height/l.y;if(s){let e=es(s),t=r&&ec(r)?es(r):r,n=e,o=ex(n);for(;o&&r&&t!==n;){let e=eC(o),t=o.getBoundingClientRect(),r=ev(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,u*=e.y,h*=e.x,d*=e.y,c+=i,u+=s,o=ex(n=es(o))}}return Y({width:h,height:d,x:c,y:u})}function eT(e,t){let n=eb(e).scrollLeft;return t?t.left+n:eP(el(e)).left+n}function eM(e,t,n){void 0===n&&(n=!1);let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:eT(e,r)),y:r.top+t.scrollTop}}function eA(e,t,n){let r;if("viewport"===t)r=function(e,t){let n=es(e),r=el(e),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;let e=em();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,a=o.offsetTop)}return{width:i,height:s,x:l,y:a}}(e,n);else if("document"===t)r=function(e){let t=el(e),n=eb(e),r=e.ownerDocument.body,o=L(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=L(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+eT(e),l=-n.scrollTop;return"rtl"===ev(r).direction&&(s+=L(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}(el(e));else if(ec(t))r=function(e,t){let n=eP(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=eu(e)?eC(e):B(1),s=e.clientWidth*i.x;return{width:s,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{let n=eE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Y(r)}function eR(e){return"static"===ev(e).position}function e_(e,t){if(!eu(e)||"fixed"===ev(e).position)return null;if(t)return t(e);let n=e.offsetParent;return el(e)===n&&(n=n.ownerDocument.body),n}function eD(e,t){let n=es(e);if(ef(e))return n;if(!eu(e)){let t=ey(e);for(;t&&!eg(t);){if(ec(t)&&!eR(t))return t;t=ey(t)}return n}let r=e_(e,t);for(;r&&["table","td","th"].includes(ei(r))&&eR(r);)r=e_(r,t);return r&&eg(r)&&eR(r)&&!ep(r)?n:r||function(e){let t=ey(e);for(;eu(t)&&!eg(t);){if(ep(t))return t;if(ef(t))break;t=ey(t)}return null}(e)||n}let eN=async function(e){let t=this.getOffsetParent||eD,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=eu(t),o=el(t),i="fixed"===n,s=eP(e,!0,i,t),l={scrollLeft:0,scrollTop:0},a=B(0);if(r||!r&&!i){if(("body"!==ei(t)||ed(o))&&(l=eb(t)),r){let e=eP(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=eT(o))}let c=!o||r||i?B(0):eM(o,l);return{x:s.left+l.scrollLeft-a.x-c.x,y:s.top+l.scrollTop-a.y-c.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},eL={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e,i="fixed"===o,s=el(r),l=!!t&&ef(t.floating);if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=B(1),u=B(0),h=eu(r);if((h||!h&&!i)&&(("body"!==ei(r)||ed(s))&&(a=eb(r)),eu(r))){let e=eP(r);c=eC(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let d=!s||h||i?B(0):eM(s,a,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+d.x,y:n.y*c.y-a.scrollTop*c.y+u.y+d.y}},getDocumentElement:el,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e,i=[..."clippingAncestors"===n?ef(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=ew(e,[],!1).filter(e=>ec(e)&&"body"!==ei(e)),o=null,i="fixed"===ev(e).position,s=i?ey(e):e;for(;ec(s)&&!eg(s);){let t=ev(s),n=ep(s);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&!!o&&["absolute","fixed"].includes(o.position)||ed(s)&&!n&&function e(t,n){let r=ey(t);return!(r===n||!ec(r)||eg(r))&&("fixed"===ev(r).position||e(r,n))}(e,s))?r=r.filter(e=>e!==s):o=t,s=ey(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=i[0],l=i.reduce((e,n)=>{let r=eA(t,n,o);return e.top=L(r.top,e.top),e.right=N(r.right,e.right),e.bottom=N(r.bottom,e.bottom),e.left=L(r.left,e.left),e},eA(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:eD,getElementRects:eN,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=ek(e);return{width:t,height:n}},getScale:eC,isElement:ec,isRTL:function(e){return"rtl"===ev(e).direction}},eI=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=t,{element:c,padding:u=0}=$(e,t)||{};if(null==c)return{};let h=K(u),d={x:n,y:r},f=q(U(o)),p=V(f),g=await s.getDimensions(c),v="y"===f,b=v?"clientHeight":"clientWidth",y=i.reference[p]+i.reference[f]-d[f]-i.floating[p],w=d[f]-i.reference[f],x=await (null==s.getOffsetParent?void 0:s.getOffsetParent(c)),k=x?x[b]:0;k&&await (null==s.isElement?void 0:s.isElement(x))||(k=l.floating[b]||i.floating[p]);let S=k/2-g[p]/2-1,C=N(h[v?"top":"left"],S),O=N(h[v?"bottom":"right"],S),E=k-g[p]-O,P=k/2-g[p]/2+(y/2-w/2),T=L(C,N(P,E)),M=!a.arrow&&null!=H(o)&&P!==T&&i.reference[p]/2-(P<C?C:O)-g[p]/2<0,A=M?P<C?P-C:P-E:0;return{[f]:d[f]+A,data:m({[f]:T,centerOffset:P-T-A},M&&{alignmentOffset:A}),reset:M}}}),ej=(e,t,n)=>{let r=new Map,o=m({platform:eL},n),i=m({},o.platform,{_c:r});return en(e,t,m({},o,{platform:i}))};function eB(){}function eW(e){return e()}function eF(){return Object.create(null)}function e$(e){e.forEach(eW)}function ez(e){return"function"==typeof e}function eH(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function eq(e,t){e.appendChild(t)}function eV(e,t,n){e.insertBefore(t,n||null)}function eU(e){e.parentNode&&e.parentNode.removeChild(e)}function eG(e){return document.createElement(e)}function eX(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function eQ(e){return document.createTextNode(e)}function eK(){return eQ(" ")}function eY(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function eJ(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}let eZ=["width","height"];function e0(e,t){let n=Object.getOwnPropertyDescriptors(e.__proto__);for(let r in t)null==t[r]?e.removeAttribute(r):"style"===r?e.style.cssText=t[r]:"__value"===r?e.value=e[r]=t[r]:n[r]&&n[r].set&&-1===eZ.indexOf(r)?e[r]=t[r]:eJ(e,r,t[r])}function e1(e,t,n){e.classList.toggle(t,!!n)}function e2(){if(!r)throw Error("Function called outside component initialization");return r}function e4(e){e2().$$.after_update.push(e)}let e5=[],e3=[],e6=[],e9=[],e8=Promise.resolve(),e7=!1;function te(e){e6.push(e)}let tt=new Set,tn=0;function tr(){if(0!==tn)return;let e=r;do{try{for(;tn<e5.length;){let e=e5[tn];tn++,r=e,function(e){if(null!==e.fragment){e.update(),e$(e.before_update);let t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(te)}}(e.$$)}}catch(e){throw e5.length=0,tn=0,e}for(r=null,e5.length=0,tn=0;e3.length;)e3.pop()();for(let e=0;e<e6.length;e+=1){let t=e6[e];tt.has(t)||(tt.add(t),t())}e6.length=0}while(e5.length);for(;e9.length;)e9.pop()();e7=!1,tt.clear(),r=e}let to=new Set;function ti(){o={r:0,c:[],p:o}}function ts(){o.r||e$(o.c),o=o.p}function tl(e,t){e&&e.i&&(to.delete(e),e.i(t))}function ta(e,t,n,r){e&&e.o?to.has(e)||(to.add(e),o.c.push(()=>{to.delete(e),r&&(n&&e.d(1),r())}),e.o(t)):r&&r()}function tc(e){return(null==e?void 0:e.length)!==void 0?e:Array.from(e)}function tu(e){e&&e.c()}function th(e,t,n){let{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),te(()=>{let t=e.$$.on_mount.map(eW).filter(ez);e.$$.on_destroy?e.$$.on_destroy.push(...t):e$(t),e.$$.on_mount=[]}),o.forEach(te)}function td(e,t){let n=e.$$;null!==n.fragment&&(!function(e){let t=[],n=[];e6.forEach(r=>-1===e.indexOf(r)?t.push(r):n.push(r)),n.forEach(e=>e()),e6=t}(n.after_update),e$(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function tf(e,t,n,o,i,s,l=null,a=[-1]){let c=r;r=e;let u=e.$$={fragment:null,ctx:[],props:s,update:eB,not_equal:i,bound:eF(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:eF(),dirty:a,skip_bound:!1,root:t.target||c.$$.root};l&&l(u.root);let h=!1;if(u.ctx=n?n(e,t.props||{},(t,n,...r)=>{let o=r.length?r[0]:n;return u.ctx&&i(u.ctx[t],u.ctx[t]=o)&&(!u.skip_bound&&u.bound[t]&&u.bound[t](o),h)&&(-1===e.$$.dirty[0]&&(e5.push(e),e7||(e7=!0,e8.then(tr)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31),n}):[],u.update(),h=!0,e$(u.before_update),u.fragment=!!o&&o(u.ctx),t.target){if(t.hydrate){let e=Array.from(t.target.childNodes);u.fragment&&u.fragment.l(e),e.forEach(eU)}else u.fragment&&u.fragment.c();t.intro&&tl(e.$$.fragment),th(e,t.target,t.anchor),tr()}r=c}class tp{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){td(this,1),this.$destroy=eB}$on(e,t){if(!ez(t))return eB;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){this.$$set&&0!==Object.keys(e).length&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function tm(e){let t,n,r,o,i;return{c(){eJ(t=eG("button"),"aria-label",n=e[3]?e[3]:null),eJ(t,"class",r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],eJ(t,"tabindex","0"),eJ(t,"type","button")},m(n,r){eV(n,t,r),t.innerHTML=e[5],o||(i=eY(t,"click",function(){ez(e[0])&&e[0].apply(this,arguments)}),o=!0)},p(o,[i]){e=o,32&i&&(t.innerHTML=e[5]),8&i&&n!==(n=e[3]?e[3]:null)&&eJ(t,"aria-label",n),18&i&&r!==(r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&eJ(t,"class",r),4&i&&(t.disabled=e[2])},i:eB,o:eB,d(e){e&&eU(t),o=!1,i()}}}function tg(e,t,n){let r,o,i,s,l,a,{config:c,step:u}=t;function d(e){return h(e)?e=e.call(u):e}return e.$$set=e=>{"config"in e&&n(6,c=e.config),"step"in e&&n(7,u=e.step)},e.$$.update=()=>{192&e.$$.dirty&&(n(0,r=c.action?c.action.bind(u.tour):null),n(1,o=c.classes),n(2,i=!!c.disabled&&d(c.disabled)),n(3,s=c.label?d(c.label):null),n(4,l=c.secondary),n(5,a=c.text?d(c.text):null))},[r,o,i,s,l,a,c,u]}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class tv extends tp{constructor(e){super(),tf(this,e,tg,tm,eH,{config:6,step:7})}}function tb(e,t,n){let r=e.slice();return r[2]=t[n],r}function ty(e){let t,n;let r=tc(e[1]),o=[];for(let t=0;t<r.length;t+=1)o[t]=tw(tb(e,r,t));let i=e=>ta(o[e],1,1,()=>{o[e]=null});return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=eQ("")},m(e,r){for(let t=0;t<o.length;t+=1)o[t]&&o[t].m(e,r);eV(e,t,r),n=!0},p(e,n){if(3&n){let s;for(s=0,r=tc(e[1]);s<r.length;s+=1){let i=tb(e,r,s);o[s]?(o[s].p(i,n),tl(o[s],1)):(o[s]=tw(i),o[s].c(),tl(o[s],1),o[s].m(t.parentNode,t))}for(ti(),s=r.length;s<o.length;s+=1)i(s);ts()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)tl(o[e]);n=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)ta(o[e]);n=!1},d(e){e&&eU(t),function(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}(o,e)}}}function tw(e){let t,n;return t=new tv({props:{config:e[2],step:e[0]}}),{c(){tu(t.$$.fragment)},m(e,r){th(t,e,r),n=!0},p(e,n){let r={};2&n&&(r.config=e[2]),1&n&&(r.step=e[0]),t.$set(r)},i(e){n||(tl(t.$$.fragment,e),n=!0)},o(e){ta(t.$$.fragment,e),n=!1},d(e){td(t,e)}}}function tx(e){let t,n;let r=e[1]&&ty(e);return{c(){t=eG("footer"),r&&r.c(),eJ(t,"class","shepherd-footer")},m(e,o){eV(e,t,o),r&&r.m(t,null),n=!0},p(e,[n]){e[1]?r?(r.p(e,n),2&n&&tl(r,1)):((r=ty(e)).c(),tl(r,1),r.m(t,null)):r&&(ti(),ta(r,1,1,()=>{r=null}),ts())},i(e){n||(tl(r),n=!0)},o(e){ta(r),n=!1},d(e){e&&eU(t),r&&r.d()}}}function tk(e,t,n){let r;let{step:o}=t;return e.$$set=e=>{"step"in e&&n(0,o=e.step)},e.$$.update=()=>{1&e.$$.dirty&&n(1,r=o.options.buttons)},[o,r]}class tS extends tp{constructor(e){super(),tf(this,e,tk,tx,eH,{step:0})}}function tC(e){let t,n,r,o,i;return{c(){t=eG("button"),(n=eG("span")).textContent="\xd7",eJ(n,"aria-hidden","true"),eJ(t,"aria-label",r=e[0].label?e[0].label:"Close Tour"),eJ(t,"class","shepherd-cancel-icon"),eJ(t,"type","button")},m(r,s){eV(r,t,s),eq(t,n),o||(i=eY(t,"click",e[1]),o=!0)},p(e,[n]){1&n&&r!==(r=e[0].label?e[0].label:"Close Tour")&&eJ(t,"aria-label",r)},i:eB,o:eB,d(e){e&&eU(t),o=!1,i()}}}function tO(e,t,n){let{cancelIcon:r,step:o}=t;return e.$$set=e=>{"cancelIcon"in e&&n(0,r=e.cancelIcon),"step"in e&&n(2,o=e.step)},[r,e=>{e.preventDefault(),o.cancel()},o]}class tE extends tp{constructor(e){super(),tf(this,e,tO,tC,eH,{cancelIcon:0,step:2})}}function tP(e){let t;return{c(){eJ(t=eG("h3"),"id",e[1]),eJ(t,"class","shepherd-title")},m(n,r){eV(n,t,r),e[3](t)},p(e,[n]){2&n&&eJ(t,"id",e[1])},i:eB,o:eB,d(n){n&&eU(t),e[3](null)}}}function tT(e,t,n){let{labelId:r,element:o,title:i}=t;return e4(()=>{h(i)&&n(2,i=i()),n(0,o.innerHTML=i,o)}),e.$$set=e=>{"labelId"in e&&n(1,r=e.labelId),"element"in e&&n(0,o=e.element),"title"in e&&n(2,i=e.title)},[o,r,i,function(e){e3[e?"unshift":"push"](()=>{n(0,o=e)})}]}class tM extends tp{constructor(e){super(),tf(this,e,tT,tP,eH,{labelId:1,element:0,title:2})}}function tA(e){let t,n;return t=new tM({props:{labelId:e[0],title:e[2]}}),{c(){tu(t.$$.fragment)},m(e,r){th(t,e,r),n=!0},p(e,n){let r={};1&n&&(r.labelId=e[0]),4&n&&(r.title=e[2]),t.$set(r)},i(e){n||(tl(t.$$.fragment,e),n=!0)},o(e){ta(t.$$.fragment,e),n=!1},d(e){td(t,e)}}}function tR(e){let t,n;return t=new tE({props:{cancelIcon:e[3],step:e[1]}}),{c(){tu(t.$$.fragment)},m(e,r){th(t,e,r),n=!0},p(e,n){let r={};8&n&&(r.cancelIcon=e[3]),2&n&&(r.step=e[1]),t.$set(r)},i(e){n||(tl(t.$$.fragment,e),n=!0)},o(e){ta(t.$$.fragment,e),n=!1},d(e){td(t,e)}}}function t_(e){let t,n,r;let o=e[2]&&tA(e),i=e[3]&&e[3].enabled&&tR(e);return{c(){t=eG("header"),o&&o.c(),n=eK(),i&&i.c(),eJ(t,"class","shepherd-header")},m(e,s){eV(e,t,s),o&&o.m(t,null),eq(t,n),i&&i.m(t,null),r=!0},p(e,[r]){e[2]?o?(o.p(e,r),4&r&&tl(o,1)):((o=tA(e)).c(),tl(o,1),o.m(t,n)):o&&(ti(),ta(o,1,1,()=>{o=null}),ts()),e[3]&&e[3].enabled?i?(i.p(e,r),8&r&&tl(i,1)):((i=tR(e)).c(),tl(i,1),i.m(t,null)):i&&(ti(),ta(i,1,1,()=>{i=null}),ts())},i(e){r||(tl(o),tl(i),r=!0)},o(e){ta(o),ta(i),r=!1},d(e){e&&eU(t),o&&o.d(),i&&i.d()}}}function tD(e,t,n){let r,o,{labelId:i,step:s}=t;return e.$$set=e=>{"labelId"in e&&n(0,i=e.labelId),"step"in e&&n(1,s=e.step)},e.$$.update=()=>{2&e.$$.dirty&&(n(2,r=s.options.title),n(3,o=s.options.cancelIcon))},[i,s,r,o]}class tN extends tp{constructor(e){super(),tf(this,e,tD,t_,eH,{labelId:0,step:1})}}function tL(e){let t;return{c(){eJ(t=eG("div"),"class","shepherd-text"),eJ(t,"id",e[1])},m(n,r){eV(n,t,r),e[3](t)},p(e,[n]){2&n&&eJ(t,"id",e[1])},i:eB,o:eB,d(n){n&&eU(t),e[3](null)}}}function tI(e,t,n){let{descriptionId:r,element:o,step:i}=t;return e4(()=>{let{text:e}=i.options;h(e)&&(e=e.call(i)),u(e)?o.appendChild(e):n(0,o.innerHTML=e,o)}),e.$$set=e=>{"descriptionId"in e&&n(1,r=e.descriptionId),"element"in e&&n(0,o=e.element),"step"in e&&n(2,i=e.step)},[o,r,i,function(e){e3[e?"unshift":"push"](()=>{n(0,o=e)})}]}class tj extends tp{constructor(e){super(),tf(this,e,tI,tL,eH,{descriptionId:1,element:0,step:2})}}function tB(e){let t,n;return t=new tN({props:{labelId:e[1],step:e[2]}}),{c(){tu(t.$$.fragment)},m(e,r){th(t,e,r),n=!0},p(e,n){let r={};2&n&&(r.labelId=e[1]),4&n&&(r.step=e[2]),t.$set(r)},i(e){n||(tl(t.$$.fragment,e),n=!0)},o(e){ta(t.$$.fragment,e),n=!1},d(e){td(t,e)}}}function tW(e){let t,n;return t=new tj({props:{descriptionId:e[0],step:e[2]}}),{c(){tu(t.$$.fragment)},m(e,r){th(t,e,r),n=!0},p(e,n){let r={};1&n&&(r.descriptionId=e[0]),4&n&&(r.step=e[2]),t.$set(r)},i(e){n||(tl(t.$$.fragment,e),n=!0)},o(e){ta(t.$$.fragment,e),n=!1},d(e){td(t,e)}}}function tF(e){let t,n;return t=new tS({props:{step:e[2]}}),{c(){tu(t.$$.fragment)},m(e,r){th(t,e,r),n=!0},p(e,n){let r={};4&n&&(r.step=e[2]),t.$set(r)},i(e){n||(tl(t.$$.fragment,e),n=!0)},o(e){ta(t.$$.fragment,e),n=!1},d(e){td(t,e)}}}function t$(e){let t,n,r,o;let i=!f(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s=!f(e[2].options.text),l=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,a=i&&tB(e),c=s&&tW(e),u=l&&tF(e);return{c(){t=eG("div"),a&&a.c(),n=eK(),c&&c.c(),r=eK(),u&&u.c(),eJ(t,"class","shepherd-content")},m(e,i){eV(e,t,i),a&&a.m(t,null),eq(t,n),c&&c.m(t,null),eq(t,r),u&&u.m(t,null),o=!0},p(e,[o]){4&o&&(i=!f(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled),i?a?(a.p(e,o),4&o&&tl(a,1)):((a=tB(e)).c(),tl(a,1),a.m(t,n)):a&&(ti(),ta(a,1,1,()=>{a=null}),ts()),4&o&&(s=!f(e[2].options.text)),s?c?(c.p(e,o),4&o&&tl(c,1)):((c=tW(e)).c(),tl(c,1),c.m(t,r)):c&&(ti(),ta(c,1,1,()=>{c=null}),ts()),4&o&&(l=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length),l?u?(u.p(e,o),4&o&&tl(u,1)):((u=tF(e)).c(),tl(u,1),u.m(t,null)):u&&(ti(),ta(u,1,1,()=>{u=null}),ts())},i(e){o||(tl(a),tl(c),tl(u),o=!0)},o(e){ta(a),ta(c),ta(u),o=!1},d(e){e&&eU(t),a&&a.d(),c&&c.d(),u&&u.d()}}}function tz(e,t,n){let{descriptionId:r,labelId:o,step:i}=t;return e.$$set=e=>{"descriptionId"in e&&n(0,r=e.descriptionId),"labelId"in e&&n(1,o=e.labelId),"step"in e&&n(2,i=e.step)},[r,o,i]}class tH extends tp{constructor(e){super(),tf(this,e,tz,t$,eH,{descriptionId:0,labelId:1,step:2})}}function tq(e){let t;return{c(){eJ(t=eG("div"),"class","shepherd-arrow"),eJ(t,"data-popper-arrow","")},m(e,n){eV(e,t,n)},d(e){e&&eU(t)}}}function tV(e){let t,n,r,o,i,s,l,a;let c=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&tq();r=new tH({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let u=[{"aria-describedby":o=f(e[4].options.text)?null:e[2]},{"aria-labelledby":i=e[4].options.title?e[3]:null},e[1],{open:"true"}],h={};for(let e=0;e<u.length;e+=1)h=function(e,t){for(let n in t)e[n]=t[n];return e}(h,u[e]);return{c(){t=eG("dialog"),c&&c.c(),n=eK(),tu(r.$$.fragment),e0(t,h),e1(t,"shepherd-has-cancel-icon",e[5]),e1(t,"shepherd-has-title",e[6]),e1(t,"shepherd-element",!0)},m(o,i){eV(o,t,i),c&&c.m(t,null),eq(t,n),th(r,t,null),e[13](t),s=!0,l||(a=eY(t,"keydown",e[7]),l=!0)},p(e,[l]){e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on?c||((c=tq()).c(),c.m(t,n)):c&&(c.d(1),c=null);let a={};4&l&&(a.descriptionId=e[2]),8&l&&(a.labelId=e[3]),16&l&&(a.step=e[4]),r.$set(a),e0(t,h=function(e,t){let n={},r={},o={$$scope:1},i=e.length;for(;i--;){let s=e[i],l=t[i];if(l){for(let e in s)e in l||(r[e]=1);for(let e in l)o[e]||(n[e]=l[e],o[e]=1);e[i]=l}else for(let e in s)o[e]=1}for(let e in r)e in n||(n[e]=void 0);return n}(u,[(!s||20&l&&o!==(o=f(e[4].options.text)?null:e[2]))&&{"aria-describedby":o},(!s||24&l&&i!==(i=e[4].options.title?e[3]:null))&&{"aria-labelledby":i},2&l&&e[1],{open:"true"}])),e1(t,"shepherd-has-cancel-icon",e[5]),e1(t,"shepherd-has-title",e[6]),e1(t,"shepherd-element",!0)},i(e){s||(tl(r.$$.fragment,e),s=!0)},o(e){ta(r.$$.fragment,e),s=!1},d(n){n&&eU(t),c&&c.d(),td(r),e[13](null),l=!1,a()}}}function tU(e){return e.split(" ").filter(e=>!!e.length)}function tG(e,t,n){var r;let o,i,s,{classPrefix:l,element:a,descriptionId:c,firstFocusableElement:u,focusableElements:h,labelId:f,lastFocusableElement:p,step:m,dataStepId:g}=t;return r=()=>{n(1,g={[`data-${l}shepherd-step-id`]:m.id}),n(9,h=a.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,u=h[0]),n(10,p=h[h.length-1])},e2().$$.on_mount.push(r),e4(()=>{s!==m.options.classes&&(function(e){if(d(e)){let t=tU(e);t.length&&a.classList.remove(...t)}}(s),function(e){if(d(e)){let t=tU(e);t.length&&a.classList.add(...t)}}(s=m.options.classes))}),e.$$set=e=>{"classPrefix"in e&&n(11,l=e.classPrefix),"element"in e&&n(0,a=e.element),"descriptionId"in e&&n(2,c=e.descriptionId),"firstFocusableElement"in e&&n(8,u=e.firstFocusableElement),"focusableElements"in e&&n(9,h=e.focusableElements),"labelId"in e&&n(3,f=e.labelId),"lastFocusableElement"in e&&n(10,p=e.lastFocusableElement),"step"in e&&n(4,m=e.step),"dataStepId"in e&&n(1,g=e.dataStepId)},e.$$.update=()=>{16&e.$$.dirty&&(n(5,o=m.options&&m.options.cancelIcon&&m.options.cancelIcon.enabled),n(6,i=m.options&&m.options.title))},[a,g,c,f,m,o,i,e=>{let{tour:t}=m;switch(e.keyCode){case 9:if(0===h.length){e.preventDefault();break}e.shiftKey?(document.activeElement===u||document.activeElement.classList.contains("shepherd-element"))&&(e.preventDefault(),p.focus()):document.activeElement===p&&(e.preventDefault(),u.focus());break;case 27:t.options.exitOnEsc&&(e.preventDefault(),e.stopPropagation(),m.cancel());break;case 37:t.options.keyboardNavigation&&(e.preventDefault(),e.stopPropagation(),t.back());break;case 39:t.options.keyboardNavigation&&(e.preventDefault(),e.stopPropagation(),t.next())}},u,h,p,l,()=>a,function(e){e3[e?"unshift":"push"](()=>{n(0,a=e)})}]}class tX extends tp{constructor(e){super(),tf(this,e,tG,tV,eH,{classPrefix:11,element:0,descriptionId:2,firstFocusableElement:8,focusableElements:9,labelId:3,lastFocusableElement:10,step:4,dataStepId:1,getElement:12})}get getElement(){return this.$$.ctx[12]}}class tQ extends p{constructor(e,t={}){return super(),this._resolvedAttachTo=void 0,this._resolvedExtraHighlightElements=void 0,this.classPrefix=void 0,this.el=void 0,this.target=void 0,this.tour=void 0,this.tour=e,this.classPrefix=this.tour.options?A(this.tour.options.classPrefix):"",this.styles=e.styles,this._resolvedAttachTo=null,P(this),this._setOptions(t),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){this.cleanup&&this.cleanup(),this.cleanup=null,u(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){var e;null==(e=this.tour.modal)||e.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}_resolveExtraHiglightElements(){return this._resolvedExtraHighlightElements=this.options.extraHighlights?this.options.extraHighlights.flatMap(e=>Array.from(document.querySelectorAll(e))):[],this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=function(e){let t=e.options.attachTo||{},n=Object.assign({},t);if(h(n.element)&&(n.element=n.element.call(e)),d(n.element)){try{n.element=document.querySelector(n.element)}catch(e){}n.element||console.error(`The element for this Shepherd step was not found ${t.element}`)}return n}(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return null===this._resolvedAttachTo?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return h(this.options.beforeShowPromise)?Promise.resolve(this.options.beforeShowPromise()).then(()=>this._show()):Promise.resolve(this._show())}updateStepOptions(e){Object.assign(this.options,e),this.shepherdElementComponent&&this.shepherdElementComponent.$set({step:this})}getElement(){return this.el}getTarget(){return this.target}_createTooltipContent(){let e=`${this.id}-description`,t=`${this.id}-label`;return this.shepherdElementComponent=new tX({target:this.tour.options.stepsContainer||document.body,props:{classPrefix:this.classPrefix,descriptionId:e,labelId:t,step:this,styles:this.styles}}),this.shepherdElementComponent.getElement()}_scrollTo(e){let{element:t}=this._getResolvedAttachToOptions();h(this.options.scrollToHandler)?this.options.scrollToHandler(t):t instanceof Element&&"function"==typeof t.scrollIntoView&&t.scrollIntoView(e)}_getClassOptions(e){let t=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,n=e.classes?e.classes:"",r=t&&t.classes?t.classes:"";return Array.from(new Set([...n.split(" "),...r.split(" ")])).join(" ").trim()}_setOptions(e={}){let t=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;t=C({},t||{}),this.options=Object.assign({arrow:!0},t,e,{floatingUIOptions:C(t.floatingUIOptions||{},e.floatingUIOptions||{})});let{when:n}=this.options;this.options.classes=this._getClassOptions(e),this.destroy(),this.id=this.options.id||`step-${_()}`,n&&Object.keys(n).forEach(e=>{this.on(e,n[e],this)})}_setupElements(){f(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&function(e){let{event:t,selector:n}=e.options.advanceOn||{};if(!t)return console.error("advanceOn was defined, but no event name was passed.");{let r=t=>{if(e.isOpen()){let r=e.el&&t.currentTarget===e.el;(!f(n)&&t.currentTarget.matches(n)||r)&&e.tour.next()}},o=null;if(!f(n)&&!(o=document.querySelector(n)))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);o?(o.addEventListener(t,r),e.on("destroy",()=>o.removeEventListener(t,r))):(document.body.addEventListener(t,r,!0),e.on("destroy",()=>document.body.removeEventListener(t,r,!0)))}}(this),function(e){e.cleanup&&e.cleanup();let t=e._getResolvedAttachToOptions(),n=t.element,r=function(e,t){var n,r,o,i,s,l,a,c;let u={strategy:"absolute"};u.middleware=[];let h=!!t.options.arrow&&!!t.el&&t.el.querySelector(".shepherd-arrow"),d=R(e),f=null==(n=e.on)?void 0:n.includes("auto"),p=(null==e||null==(r=e.on)?void 0:r.includes("-start"))||(null==e||null==(o=e.on)?void 0:o.includes("-end"));if(!d){if(f?u.middleware.push({name:"autoPlacement",options:s={crossAxis:!0,alignment:p?null==e||null==(i=e.on)?void 0:i.split("-").pop():null},async fn(e){var t,n,r,o;let{rects:i,middlewareData:l,placement:a,platform:c,elements:u}=e,h=$(s,e),{crossAxis:d=!1,alignment:f,allowedPlacements:p=D,autoAlignment:m=!0}=h,v=g(h,J),b=void 0!==f||p===D?((o=f||null)?[...p.filter(e=>H(e)===o),...p.filter(e=>H(e)!==o)]:p.filter(e=>z(e)===e)).filter(e=>!o||H(e)===o||!!m&&X(e)!==e):p,y=await er(e,v),w=(null==(t=l.autoPlacement)?void 0:t.index)||0,x=b[w];if(null==x)return{};let k=G(x,i,await (null==c.isRTL?void 0:c.isRTL(u.floating)));if(a!==x)return{reset:{placement:b[0]}};let S=[y[z(x)],y[k[0]],y[k[1]]],C=[...(null==(n=l.autoPlacement)?void 0:n.overflows)||[],{placement:x,overflows:S}],O=b[w+1];if(O)return{data:{index:w+1,overflows:C},reset:{placement:O}};let E=C.map(e=>{let t=H(e.placement);return[e.placement,t&&d?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),P=(null==(r=E.filter(e=>e[2].slice(0,H(e[0])?2:3).every(e=>e<=0))[0])?void 0:r[0])||E[0][0];return P!==a?{data:{index:w+1,overflows:C},reset:{placement:P}}:{}}}):u.middleware.push((void 0===l&&(l={}),{name:"flip",options:l,async fn(e){var t,n,r,o,i;let{placement:s,middlewareData:a,rects:c,initialPlacement:u,platform:h,elements:d}=e,f=$(l,e),{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:v,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0}=f,x=g(f,Z);if(null!=(t=a.arrow)&&t.alignmentOffset)return{};let k=z(s),S=U(u),C=z(u)===u,O=await (null==h.isRTL?void 0:h.isRTL(d.floating)),E=v||(C||!w?[Q(u)]:function(e){let t=Q(e);return[X(e),t,X(t)]}(u)),P="none"!==y;!v&&P&&E.push(...function(e,t,n,r){let o=H(e),i=function(e,t,n){let r=["left","right"],o=["right","left"];switch(e){case"top":case"bottom":if(n)return t?o:r;return t?r:o;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(z(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(X)))),i}(u,w,y,O));let T=[u,...E],M=await er(e,x),A=[],R=(null==(n=a.flip)?void 0:n.overflows)||[];if(p&&A.push(M[k]),m){let e=G(s,c,O);A.push(M[e[0]],M[e[1]])}if(R=[...R,{placement:s,overflows:A}],!A.every(e=>e<=0)){let e=((null==(r=a.flip)?void 0:r.index)||0)+1,t=T[e];if(t)return{data:{index:e,overflows:R},reset:{placement:t}};let n=null==(o=R.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:o.placement;if(!n)switch(b){case"bestFit":{let e=null==(i=R.filter(e=>{if(P){let t=U(e.placement);return t===S||"y"===t}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])?void 0:i[0];e&&(n=e);break}case"initialPlacement":n=u}if(s!==n)return{reset:{placement:n}}}return{}}})),u.middleware.push({name:"shift",options:c={limiter:(void 0===a&&(a={}),{options:a,fn(e){let{x:t,y:n,placement:r,rects:o,middlewareData:i}=e,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=$(a,e),u={x:t,y:n},h=U(r),d=q(h),f=u[d],p=u[h],g=$(s,e),v="number"==typeof g?{mainAxis:g,crossAxis:0}:m({mainAxis:0,crossAxis:0},g);if(l){let e="y"===d?"height":"width",t=o.reference[d]-o.floating[e]+v.mainAxis,n=o.reference[d]+o.reference[e]-v.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var b,y;let e="y"===d?"width":"height",t=["top","left"].includes(z(r)),n=o.reference[h]-o.floating[e]+(t&&(null==(b=i.offset)?void 0:b[h])||0)+(t?0:v.crossAxis),s=o.reference[h]+o.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[h])||0)-(t?v.crossAxis:0);p<n?p=n:p>s&&(p=s)}return{[d]:f,[h]:p}}}),crossAxis:!0},async fn(e){let{x:t,y:n,placement:r}=e,o=$(c,e),{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}}}=o,a=g(o,ee),u={x:t,y:n},h=await er(e,a),d=U(z(r)),f=q(d),p=u[f],v=u[d];if(i){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",n=p+h[e],r=p-h[t];p=L(n,N(p,r))}if(s){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",n=v+h[e],r=v-h[t];v=L(n,N(v,r))}let b=l.fn(m({},e,{[f]:p,[d]:v}));return m({},b,{data:{x:b.x-t,y:b.y-n}})}}),h){let e="object"==typeof t.options.arrow?t.options.arrow:{padding:4};u.middleware.push(eI({element:h,padding:p?e.padding:0}))}f||(u.placement=e.on)}return C(u,t.options.floatingUIOptions||{})}(t,e),o=R(t);o&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=function(e,t,n,r){let o;void 0===r&&(r={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,u=eS(e),h=i||s?[...u?ew(u):[],...ew(t)]:[];h.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)});let d=u&&a?function(e,t){let n,r=null,o=el(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(l,a){void 0===l&&(l=!1),void 0===a&&(a=1),i();let{left:c,top:u,width:h,height:d}=e.getBoundingClientRect();if(l||t(),!h||!d)return;let f=j(u),p=j(o.clientWidth-(c+h)),g={rootMargin:-f+"px "+-p+"px "+-j(o.clientHeight-(u+d))+"px "+-j(c)+"px",threshold:L(0,N(1,a))||1},v=!0;function b(e){let t=e[0].intersectionRatio;if(t!==a){if(!v)return s();t?s(!1,t):n=setTimeout(()=>{s(!1,1e-7)},1e3)}v=!1}try{r=new IntersectionObserver(b,m({},g,{root:o.ownerDocument}))}catch(e){r=new IntersectionObserver(b,g)}r.observe(e)}(!0),i}(u,n):null,f=-1,p=null;l&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g=c?eP(e):null;return c&&function t(){let r=eP(e);g&&(r.x!==g.x||r.y!==g.y||r.width!==g.width||r.height!==g.height)&&n(),g=r,o=requestAnimationFrame(t)}(),n(),()=>{var e;h.forEach(e=>{i&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(o)}}(n,e.el,()=>{if(!e.el){null==e.cleanup||e.cleanup();return}(function(e,t,n,r){ej(e,t.el,n).then(({x:e,y:n,placement:o,middlewareData:i})=>(t.el&&(r?Object.assign(t.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(t.el.style,{position:"absolute",left:`${e}px`,top:`${n}px`}),t.el.dataset.popperPlacement=o,function(e,t){let n=e.querySelector(".shepherd-arrow");if(u(n)&&t.arrow){let{x:e,y:r}=t.arrow;Object.assign(n.style,{left:null!=e?`${e}px`:"",top:null!=r?`${r}px`:""})}}(t.el,i)),t)).then(e=>new Promise(t=>{setTimeout(()=>t(e),300)})).then(e=>{null!=e&&e.el&&e.el.focus({preventScroll:!0})})})(n,e,r,o)}),e.target=t.element}(this)}_show(){var e;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),null==(e=this.tour.modal)||e.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=!1),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el&&(this.el.hidden=!1);let t=this.shepherdElementComponent.getElement(),n=this.target||document.body,r=this._resolvedExtraHighlightElements;n.classList.add(`${this.classPrefix}shepherd-enabled`),n.classList.add(`${this.classPrefix}shepherd-target`),t.classList.add("shepherd-enabled"),null==r||r.forEach(e=>{e.classList.add(`${this.classPrefix}shepherd-enabled`),e.classList.add(`${this.classPrefix}shepherd-target`)}),this.trigger("show")}_styleTargetElementForStep(e){let t=e.target,n=e._resolvedExtraHighlightElements;if(!t)return;let r=e.options.highlightClass;r&&(t.classList.add(r),null==n||n.forEach(e=>e.classList.add(r))),t.classList.remove("shepherd-target-click-disabled"),null==n||n.forEach(e=>e.classList.remove("shepherd-target-click-disabled")),!1===e.options.canClickTarget&&(t.classList.add("shepherd-target-click-disabled"),null==n||n.forEach(e=>e.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){let e=this.target||document.body,t=this._resolvedExtraHighlightElements,n=this.options.highlightClass;n&&(e.classList.remove(n),null==t||t.forEach(e=>e.classList.remove(n))),e.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),null==t||t.forEach(e=>{e.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function tK(e){let t,n,r,o,i;return{c(){t=eX("svg"),eJ(n=eX("path"),"d",e[2]),eJ(t,"class",r=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(r,s){eV(r,t,s),eq(t,n),e[11](t),o||(i=eY(t,"touchmove",e[3]),o=!0)},p(e,[o]){4&o&&eJ(n,"d",e[2]),2&o&&r!==(r=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&eJ(t,"class",r)},i:eB,o:eB,d(n){n&&eU(t),e[11](null),o=!1,i()}}}function tY(e,t,n){let r,o,{element:i,openingProperties:s}=t,l=!1;function a(){n(4,s=[{width:0,height:0,x:0,y:0,r:0}])}function c(){n(1,l=!1),f()}function u(e=0,t=0,r=0,o=0,i,l,c){if(l){let a=[l,...c||[]];for(let l of(n(4,s=[]),a)){if(!l||a.indexOf(l)!==a.lastIndexOf(l))continue;let{y:n,height:c}=function(e,t){let n=e.getBoundingClientRect(),r=n.y||n.top,o=n.bottom||r+n.height;if(t){let e=t.getBoundingClientRect(),n=e.y||e.top,i=e.bottom||n+e.height;r=Math.max(r,n),o=Math.min(o,i)}let i=Math.max(o-r,0);return{y:r,height:i}}(l,i),{x:u,width:h,left:d}=l.getBoundingClientRect();a.some(e=>{if(e===l)return!1;let t=e.getBoundingClientRect();return u>=t.left&&u+h<=t.right&&n>=t.top&&n+c<=t.bottom})||s.push({width:h+2*e,height:c+2*e,x:(u||d)+r-e,y:n+o-e,r:t})}}else a()}function h(){n(1,l=!0)}a();let d=e=>{e.preventDefault()};function f(){r&&(cancelAnimationFrame(r),r=void 0),window.removeEventListener("touchmove",d,{passive:!1})}return e.$$set=e=>{"element"in e&&n(0,i=e.element),"openingProperties"in e&&n(4,s=e.openingProperties)},e.$$.update=()=>{16&e.$$.dirty&&n(2,o=function(e){let t="",{innerWidth:n,innerHeight:r}=window;return e.forEach(e=>{let{width:n,height:r,x:o=0,y:i=0,r:s=0}=e,{topLeft:l=0,topRight:a=0,bottomRight:c=0,bottomLeft:u=0}="number"==typeof s?{topLeft:s,topRight:s,bottomRight:s,bottomLeft:s}:s;t+=`M${o+l},${i}\
      a${l},${l},0,0,0-${l},${l}\
      V${r+i-u}\
      a${u},${u},0,0,0,${u},${u}\
      H${n+o-c}\
      a${c},${c},0,0,0,${c}-${c}\
      V${i+a}\
      a${a},${a},0,0,0-${a}-${a}\
      Z`}),`M${n},${r}\
          H0\
          V0\
          H${n}\
          V${r}\
          Z\
          ${t}`.replace(/\s/g,"")}(s))},[i,l,o,e=>{e.stopPropagation()},s,()=>i,a,c,u,function(e){f(),e.tour.options.useModalOverlay?(function(e){let{modalOverlayOpeningPadding:t,modalOverlayOpeningRadius:n,modalOverlayOpeningXOffset:o=0,modalOverlayOpeningYOffset:i=0}=e.options,s=function(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var r,o,i;let e=null==(r=n)?void 0:r.frameElement;if(e){let n=e.getBoundingClientRect();t.top+=n.top+(null!=(o=n.scrollTop)?o:0),t.left+=n.left+(null!=(i=n.scrollLeft)?i:0)}n=n.parent}return t}(e.target),l=function e(t){if(!t)return null;let n=t instanceof HTMLElement&&window.getComputedStyle(t).overflowY;return"hidden"!==n&&"visible"!==n&&t.scrollHeight>=t.clientHeight?t:e(t.parentElement)}(e.target),a=()=>{r=void 0,u(t,n,o+s.left,i+s.top,l,e.target,e._resolvedExtraHighlightElements),r=requestAnimationFrame(a)};a(),window.addEventListener("touchmove",d,{passive:!1})}(e),h()):c()},h,function(e){e3[e?"unshift":"push"](()=>{n(0,i=e)})}]}class tJ extends tp{constructor(e){super(),tf(this,e,tY,tK,eH,{element:0,openingProperties:4,getElement:5,closeModalOpening:6,hide:7,positionModal:8,setupForStep:9,show:10})}get getElement(){return this.$$.ctx[5]}get closeModalOpening(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[7]}get positionModal(){return this.$$.ctx[8]}get setupForStep(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}}class tZ extends p{constructor(){super(),this.activeTour=void 0,P(this)}}class t0 extends p{constructor(e={}){return super(),this.trackedEvents=["active","cancel","complete","show"],this.classPrefix=void 0,this.currentStep=void 0,this.focusedElBeforeOpen=void 0,this.id=void 0,this.modal=void 0,this.options=void 0,this.steps=void 0,P(this),this.options=Object.assign({},{exitOnEsc:!0,keyboardNavigation:!0},e),this.classPrefix=A(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(e=>{(e=>{this.on(e,t=>{(t=t||{}).tour=this,t1.trigger(e,t)})})(e)}),this._setTourID(e.id),this}addStep(e,t){let n=e;return n instanceof tQ?n.tour=this:n=new tQ(this,n),f(t)?this.steps.push(n):this.steps.splice(t,0,n),n}addSteps(e){return Array.isArray(e)&&e.forEach(e=>{this.addStep(e)}),this}back(){let e=this.steps.indexOf(this.currentStep);this.show(e-1,!1)}async cancel(){if(this.options.confirmCancel){let e=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";(h(this.options.confirmCancel)?await this.options.confirmCancel():window.confirm(e))&&this._done("cancel")}else this._done("cancel")}complete(){this._done("complete")}getById(e){return this.steps.find(t=>t.id===e)}getCurrentStep(){return this.currentStep}hide(){let e=this.getCurrentStep();if(e)return e.hide()}isActive(){return t1.activeTour===this}next(){let e=this.steps.indexOf(this.currentStep);e===this.steps.length-1?this.complete():this.show(e+1,!0)}removeStep(e){let t=this.getCurrentStep();this.steps.some((t,n)=>{if(t.id===e)return t.isOpen()&&t.hide(),t.destroy(),this.steps.splice(n,1),!0}),t&&t.id===e&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(e=0,t=!0){let n=d(e)?this.getById(e):this.steps[e];n&&(this._updateStateBeforeShow(),h(n.options.showOn)&&!n.options.showOn()?this._skipStep(n,t):(this.currentStep=n,this.trigger("show",{step:n,previous:this.currentStep}),n.show()))}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next()}_done(e){let t=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(e=>e.destroy()),!function(e){if(e){let{steps:t}=e;t.forEach(e=>{e.options&&!1===e.options.canClickTarget&&e.options.attachTo&&(u(e.target)&&e.target.classList.remove("shepherd-target-click-disabled"),e._resolvedExtraHighlightElements&&e._resolvedExtraHighlightElements.forEach(e=>{u(e)&&e.classList.remove("shepherd-target-click-disabled")}))})}}(this),this.trigger(e,{index:t}),t1.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),("cancel"===e||"complete"===e)&&this.modal){let e=document.querySelector(".shepherd-modal-overlay-container");e&&(e.remove(),this.modal=null)}u(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),t1.activeTour=this}setupModal(){this.modal=new tJ({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(e,t){let n=this.steps.indexOf(e);n===this.steps.length-1?this.complete():this.show(t?n+1:n-1,t)}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(e){let t=this.options.tourName||"tour",n=e||_();this.id=`${t}--${n}`}}let t1=new tZ,t2="undefined"==typeof window;t1.Step=t2?T:tQ,t1.Tour=t2?M:t0;var t4=n(6556);let t5=(0,a.createContext)(null);function t3(){let e=(0,a.useContext)(t5);if(!e)throw Error("useTour must be used within a TourProvider");return e}function t6(e){let{children:t}=e,n=(0,a.useRef)(null),r=(0,c.useRouter)(),{isFirstVisit:o,markTourCompleted:i}=(0,t4.n)(),[s,u]=(0,a.useState)(!1),[h,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),m=(0,a.useRef)(!1),g=(0,a.useCallback)(()=>{n.current&&(d(!0),p(!0),n.current.start(),setTimeout(()=>{p(!1)},1e3))},[]);(0,a.useEffect)(()=>{if(!n.current){n.current=new t1.Tour({useModalOverlay:!1,defaultStepOptions:{cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"},arrow:!1,highlightClass:"shepherd-highlight",when:{show(){var e,t,n;let r=null===(e=t1.activeTour)||void 0===e?void 0:e.getCurrentStep(),o=null==r?void 0:r.getElement(),i=null==o?void 0:o.querySelector(".shepherd-footer"),s=document.createElement("span");if(s.className="shepherd-progress",s.innerText="".concat((null===(t=t1.activeTour)||void 0===t?void 0:t.steps.indexOf(r))+1," of ").concat(null===(n=t1.activeTour)||void 0===n?void 0:n.steps.length),null==i||i.insertBefore(s,i.firstChild),o){let e=o.offsetHeight;if(document.documentElement.style.setProperty("--shepherd-dialog-height","".concat(e+20,"px")),window.innerWidth<768){let e=null;for(let t of[".fixed.top-14.left-0.w-64","div.fixed.w-64.bg-white.border-r",".fixed.w-64.transform",'[class*="fixed"][class*="w-64"][class*="bg-white"]','div[class*="fixed"][class*="top-14"][class*="left-0"][class*="w-64"]'])if(e=document.querySelector(t))break;if(!e)for(let t of document.querySelectorAll("div.fixed")){let n=t.getBoundingClientRect();if(256===n.width&&0===n.left&&n.top>=50){e=t;break}}if(e&&e instanceof HTMLElement){let t=o.getBoundingClientRect().top-56;e.style.setProperty("height","".concat(t,"px"),"important"),e.style.setProperty("max-height","".concat(t,"px"),"important")}}}let l=null==r?void 0:r.getTarget();l&&l instanceof HTMLElement&&(l.style.outline="3px solid #3b82f6",l.style.outlineOffset="2px",l.style.borderRadius="8px",l.style.position="relative",l.style.zIndex="9999",l.setAttribute("data-shepherd-highlighted","true"))},hide(){let e=document.querySelector('[data-shepherd-highlighted="true"]');e&&e instanceof HTMLElement&&(e.style.outline="",e.style.outlineOffset="",e.style.borderRadius="",e.style.boxShadow="",e.style.position="",e.style.zIndex="",e.removeAttribute("data-shepherd-highlighted")),document.documentElement.style.removeProperty("--shepherd-dialog-height");let t=document.querySelector(".fixed.top-14.left-0.w-64")||document.querySelector("div.fixed.w-64.bg-white.border-r")||document.querySelector(".fixed.w-64.transform")||document.querySelector('[class*="fixed"][class*="w-64"][class*="bg-white"]');t&&t instanceof HTMLElement&&(t.style.removeProperty("height"),t.style.removeProperty("max-height"))}}}});let e=document.createElement("style");e.id="shepherd-global-custom-style",e.textContent='\n          .shepherd-element {\n            /* Uniform 1px border using inner box-shadow so corners stay consistent */\n            border: none !important;\n            border-radius: 10px !important;\n            z-index: 30000 !important;\n            box-shadow: 0 0 0 1px #d1d5db inset, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;\n            overflow: visible !important;\n            background-clip: padding-box !important;\n          }\n\n          .shepherd-title {\n              font-weight: bold;\n              color: #111827;\n              margin: 0;\n          }\n\n          .shepherd-element .shepherd-header {\n              padding: 1rem 1rem 0.5rem 1rem;\n          }\n\n          .shepherd-element .shepherd-text {\n              padding: 0.5rem 1rem 1rem 1rem;\n          }\n\n          /* Fix mobile menu gap when tour dialog is present */\n          @media (max-width: 767px) {\n            /* Very specific selector to override Tailwind\'s h-[calc(100vh-56px)] class */\n            div.fixed.top-14.left-0.w-64.bg-white.border-r.shadow-lg.z-50.transform,\n            .fixed.top-14.left-0.w-64.bg-white.shadow-lg.z-50,\n            div[class*="fixed"][class*="top-14"][class*="left-0"][class*="w-64"][class*="bg-white"][class*="shadow-lg"][class*="z-50"] {\n              height: calc(100vh - 56px - var(--shepherd-dialog-height, 200px)) !important;\n              max-height: calc(100vh - 56px - var(--shepherd-dialog-height, 200px)) !important;\n            }\n\n            /* Target the mobile menu by its exact class combination from the HTML */\n            .fixed.w-64.bg-white.border-r.border-gray-200.shadow-lg.z-50.transform,\n            .fixed[class*="w-64"][class*="bg-white"][class*="border-r"][class*="shadow-lg"][class*="z-50"][class*="transform"] {\n              height: calc(100vh - 56px - var(--shepherd-dialog-height, 200px)) !important;\n            }\n\n            /* Even more specific - target by multiple class combinations */\n            .fixed.top-14.left-0[class*="w-64"],\n            div.fixed[class*="top-14"][class*="left-0"][class*="w-64"] {\n              height: calc(100vh - 56px - var(--shepherd-dialog-height, 200px)) !important;\n            }\n\n            /* Super aggressive approach - use high specificity to override Tailwind */\n            body div.fixed.w-64:not(.shepherd-element),\n            html body div.fixed.w-64:not(.shepherd-element) {\n              height: calc(100vh - 56px - var(--shepherd-dialog-height, 200px)) !important;\n            }\n\n            /* Fallback selectors for other mobile menu patterns */\n            nav[data-state="open"],\n            .mobile-menu.open,\n            [data-mobile-menu="true"] {\n              height: calc(100vh - var(--shepherd-dialog-height, 200px)) !important;\n              max-height: calc(100vh - var(--shepherd-dialog-height, 200px)) !important;\n            }\n\n            /* Ensure mobile menu content flows properly */\n            .fixed.w-64 nav,\n            .fixed[class*="w-64"] nav {\n              height: 100% !important;\n              overflow-y: auto !important;\n            }\n          }\n\n        ',document.getElementById("shepherd-global-custom-style")||document.head.appendChild(e),n.current.on("complete",()=>{let e=document.querySelector('[data-shepherd-highlighted="true"]');e&&e instanceof HTMLElement&&(e.style.outline="",e.style.outlineOffset="",e.style.borderRadius="",e.style.boxShadow="",e.style.position="",e.style.zIndex="",e.removeAttribute("data-shepherd-highlighted"));let t=document.getElementById("shepherd-column-overlay");t&&t.remove();let n=document.getElementById("shepherd-column-anchor");n&&n.remove();let r=document.getElementById("shepherd-user-column-overlay");r&&r.remove();let o=document.getElementById("shepherd-user-column-anchor");o&&o.remove();let s=document.getElementById("shepherd-global-custom-style");s&&s.remove(),document.documentElement.style.removeProperty("--shepherd-dialog-height");let l=document.querySelector(".fixed.top-14.left-0.w-64")||document.querySelector("div.fixed.w-64.bg-white.border-r")||document.querySelector(".fixed.w-64.transform")||document.querySelector('[class*="fixed"][class*="w-64"][class*="bg-white"]');l&&l instanceof HTMLElement&&(l.style.removeProperty("height"),l.style.removeProperty("max-height")),d(!1),p(!1),i()}),n.current.on("cancel",()=>{let e=document.querySelector('[data-shepherd-highlighted="true"]');e&&e instanceof HTMLElement&&(e.style.outline="",e.style.outlineOffset="",e.style.borderRadius="",e.style.boxShadow="",e.style.position="",e.style.zIndex="",e.removeAttribute("data-shepherd-highlighted"));let t=document.getElementById("shepherd-column-overlay");t&&t.remove();let n=document.getElementById("shepherd-column-anchor");n&&n.remove();let r=document.getElementById("shepherd-user-column-overlay");r&&r.remove();let o=document.getElementById("shepherd-user-column-anchor");o&&o.remove();let s=document.getElementById("shepherd-global-custom-style");s&&s.remove(),document.documentElement.style.removeProperty("--shepherd-dialog-height");let l=document.querySelector(".fixed.top-14.left-0.w-64")||document.querySelector("div.fixed.w-64.bg-white.border-r")||document.querySelector(".fixed.w-64.transform")||document.querySelector('[class*="fixed"][class*="w-64"][class*="bg-white"]');l&&l instanceof HTMLElement&&(l.style.removeProperty("height"),l.style.removeProperty("max-height")),d(!1),p(!1),i()}),[{title:"\uD83D\uDC4B Welcome to SkyPilot!",text:"\n              <p>SkyPilot is a system for managing AI workloads on any cluster and cloud infrastructure.</p>\n            ",buttons:[{text:"Skip Tour",action(){this.cancel()},classes:"shepherd-button-secondary"},{text:"Start Tour",action(){this.next()}}]},{title:"Clusters",text:"\n              <p>Spin up <strong>Sky Clusters</strong> on any infrastructure you have access to.</p>\n              <p>Easily SSH into any node, connect an IDE, or queue development jobs.</p>\n            ",attachTo:{element:'a[href="/dashboard/clusters"]',on:"bottom",offset:{skidding:0,distance:10}},beforeShowPromise:function(){return new Promise(e=>{let t=()=>{let t=window.innerWidth<768,n=document.querySelector('[data-testid="mobile-menu-button"], button[aria-label*="menu"], button[aria-label*="Menu"], .mobile-menu-button, [role="button"][aria-expanded]');if(t&&n&&!("true"===n.getAttribute("aria-expanded")||n.classList.contains("open")||document.querySelector('nav[data-state="open"], .mobile-menu.open, [data-mobile-menu="true"]'))){n instanceof HTMLElement&&n.click(),setTimeout(()=>{e()},300);return}e()};"/dashboard/clusters"!==r.pathname?(m.current=!0,r.push("/clusters").then(()=>{m.current=!1,setTimeout(t,200)})):t()})},when:{show(){var e,t,n;let r=null===(e=t1.activeTour)||void 0===e?void 0:e.getCurrentStep(),o=null==r?void 0:r.getElement(),i=null==o?void 0:o.querySelector(".shepherd-footer"),s=document.createElement("span");if(s.className="shepherd-progress",s.innerText="".concat((null===(t=t1.activeTour)||void 0===t?void 0:t.steps.indexOf(r))+1," of ").concat(null===(n=t1.activeTour)||void 0===n?void 0:n.steps.length),null==i||i.insertBefore(s,i.firstChild),o){let e=o.offsetHeight;if(document.documentElement.style.setProperty("--shepherd-dialog-height","".concat(e+20,"px")),window.innerWidth<768){let e=null;for(let t of[".fixed.top-14.left-0.w-64","div.fixed.w-64.bg-white.border-r",".fixed.w-64.transform",'[class*="fixed"][class*="w-64"][class*="bg-white"]','div[class*="fixed"][class*="top-14"][class*="left-0"][class*="w-64"]'])if(e=document.querySelector(t))break;if(!e)for(let t of document.querySelectorAll("div.fixed")){let n=t.getBoundingClientRect();if(256===n.width&&0===n.left&&n.top>=50){e=t;break}}if(e&&e instanceof HTMLElement){let t=o.getBoundingClientRect().top-56;e.style.setProperty("height","".concat(t,"px"),"important"),e.style.setProperty("max-height","".concat(t,"px"),"important")}}}let l=document.querySelector('a[href="/dashboard/clusters"]');l&&l instanceof HTMLElement&&(l.style.outline="3px solid #3b82f6",l.style.outlineOffset="2px",l.style.borderRadius="8px",l.style.position="relative",l.style.zIndex="9999",l.setAttribute("data-shepherd-highlighted","true"))},hide(){let e=document.querySelector('[data-shepherd-highlighted="true"]');e&&e instanceof HTMLElement&&(e.style.outline="",e.style.outlineOffset="",e.style.borderRadius="",e.style.boxShadow="",e.style.position="",e.style.zIndex="",e.removeAttribute("data-shepherd-highlighted")),document.documentElement.style.removeProperty("--shepherd-dialog-height");let t=document.querySelector(".fixed.top-14.left-0.w-64")||document.querySelector("div.fixed.w-64.bg-white.border-r")||document.querySelector(".fixed.w-64.transform")||document.querySelector('[class*="fixed"][class*="w-64"][class*="bg-white"]');t&&t instanceof HTMLElement&&(t.style.removeProperty("height"),t.style.removeProperty("max-height"))}},buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"SkyPilot is infra-agnostic",text:"\n              <p>Run compute on any hyperscaler, neocloud, or Kubernetes cluster — all within a unified system.</p>\n            ",attachTo:{element:function(){let e=document.getElementById("shepherd-column-anchor");if(e)return e;let t=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"Infra"===e.textContent.trim());if(t){let e=t.closest("table"),n=Array.from(t.parentElement.children).indexOf(t);if(e){let t=e.querySelectorAll("tbody tr"),r=null;for(let e=t.length-1;e>=0;e--){let o=t[e].children[n];if(o){r=o;break}}if(r)return r}return t}return document.querySelector("table")||"body"},on:"bottom",offset:{skidding:0,distance:15}},beforeShowPromise:function(){return new Promise(e=>{let t=()=>{let t=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"Infra"===e.textContent.trim());if(t&&t instanceof HTMLElement){let r=t.closest("table");if(r){let o=t.getBoundingClientRect(),i=window.innerWidth,s=r.closest('.overflow-x-auto, .overflow-auto, [style*="overflow"]')||r.parentElement;if((o.right>i||o.left<0)&&s&&s instanceof HTMLElement){let r=s.getBoundingClientRect(),i=t.offsetLeft-r.width/2+o.width/2;s.scrollTo({left:Math.max(0,i),behavior:"smooth"}),setTimeout(()=>{n(),e()},300);return}n()}}e()},n=()=>{let e=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"Infra"===e.textContent.trim());if(e&&e instanceof HTMLElement){let t=e.closest("table");if(t){let n=Array.from(e.parentElement.children).indexOf(e),r=e.getBoundingClientRect(),o=t.querySelectorAll("tbody tr"),i=r;o.forEach(e=>{let t=e.children[n];t&&(i=t.getBoundingClientRect())});let s=i.bottom+4,l=document.createElement("div");l.id="shepherd-column-anchor",l.style.position="fixed",l.style.left="".concat(r.left+r.width/2,"px"),l.style.top="".concat(s,"px"),l.style.width="1px",l.style.height="1px",l.style.zIndex="9999",l.style.pointerEvents="none",l.style.backgroundColor="transparent",l.style.transform="translate(-50%, -50%)",document.body.appendChild(l)}}};"/dashboard/clusters"!==window.location.pathname?(m.current=!0,r.push("/clusters").then(()=>{m.current=!1,setTimeout(t,200)})):t()})},when:{show(){var e,t,n;let r=null===(e=t1.activeTour)||void 0===e?void 0:e.getCurrentStep(),o=null==r?void 0:r.getElement(),i=null==o?void 0:o.querySelector(".shepherd-footer"),s=document.createElement("span");if(s.className="shepherd-progress",s.innerText="".concat((null===(t=t1.activeTour)||void 0===t?void 0:t.steps.indexOf(r))+1," of ").concat(null===(n=t1.activeTour)||void 0===n?void 0:n.steps.length),null==i||i.insertBefore(s,i.firstChild),o){let e=o.offsetHeight;if(document.documentElement.style.setProperty("--shepherd-dialog-height","".concat(e+20,"px")),window.innerWidth<768){let e=null;for(let t of[".fixed.top-14.left-0.w-64","div.fixed.w-64.bg-white.border-r",".fixed.w-64.transform",'[class*="fixed"][class*="w-64"][class*="bg-white"]','div[class*="fixed"][class*="top-14"][class*="left-0"][class*="w-64"]'])if(e=document.querySelector(t))break;if(!e)for(let t of document.querySelectorAll("div.fixed")){let n=t.getBoundingClientRect();if(256===n.width&&0===n.left&&n.top>=50){e=t;break}}if(e&&e instanceof HTMLElement){let t=o.getBoundingClientRect().top-56;e.style.setProperty("height","".concat(t,"px"),"important"),e.style.setProperty("max-height","".concat(t,"px"),"important")}}}setTimeout(()=>{let e=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"Infra"===e.textContent.trim());if(e&&e instanceof HTMLElement){let t=e.closest("table");if(t){let n=Array.from(e.parentElement.children).indexOf(e),r=e.getBoundingClientRect(),o=t.querySelectorAll("tbody tr"),i=r;o.forEach(e=>{let t=e.children[n];t&&(i=t.getBoundingClientRect())});let s=document.createElement("div");s.id="shepherd-column-overlay",s.style.position="fixed",s.style.left="".concat(r.left-4,"px"),s.style.top="".concat(r.top-4,"px"),s.style.width="".concat(r.width+8,"px"),s.style.height="".concat(i.bottom-r.top+8,"px"),s.style.outline="3px solid #3b82f6",s.style.outlineOffset="2px",s.style.borderRadius="8px",s.style.zIndex="9998",s.style.pointerEvents="none",s.style.backgroundColor="transparent",document.body.appendChild(s)}}},100)},hide(){let e=document.getElementById("shepherd-column-overlay");e&&e.remove();let t=document.getElementById("shepherd-column-anchor");t&&t.remove(),document.documentElement.style.removeProperty("--shepherd-dialog-height");let n=document.querySelector(".fixed.top-14.left-0.w-64")||document.querySelector("div.fixed.w-64.bg-white.border-r")||document.querySelector(".fixed.w-64.transform")||document.querySelector('[class*="fixed"][class*="w-64"][class*="bg-white"]');n&&n instanceof HTMLElement&&(n.style.removeProperty("height"),n.style.removeProperty("max-height"));let r=document.getElementById("shepherd-global-custom-style");r&&r.remove()}},buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"Multi-user support",text:"\n              <p>SkyPilot supports multiple users in an organization.</p>\n              <p>Each user can have their own clusters and jobs, with proper access controls.</p>\n            ",attachTo:{element:function(){let e=document.getElementById("shepherd-user-column-anchor");if(e)return e;let t=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"User"===e.textContent.trim());if(t){let e=t.closest("table"),n=Array.from(t.parentElement.children).indexOf(t);if(e){let t=e.querySelectorAll("tbody tr"),r=null;for(let e=t.length-1;e>=0;e--){let o=t[e].children[n];if(o){r=o;break}}if(r)return r}return t}return document.querySelector("table")||"body"},on:"bottom",offset:{skidding:0,distance:15}},beforeShowPromise:function(){return new Promise(e=>{let t=()=>{let t=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"User"===e.textContent.trim());if(t&&t instanceof HTMLElement){let r=t.closest("table");if(r){let o=t.getBoundingClientRect(),i=window.innerWidth,s=r.closest('.overflow-x-auto, .overflow-auto, [style*="overflow"]')||r.parentElement;if((o.right>i||o.left<0)&&s&&s instanceof HTMLElement){let r=s.getBoundingClientRect(),i=t.offsetLeft-r.width/2+o.width/2;s.scrollTo({left:Math.max(0,i),behavior:"smooth"}),setTimeout(()=>{n(),e()},300);return}n()}}e()},n=()=>{let e=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"User"===e.textContent.trim());if(e&&e instanceof HTMLElement){let t=e.closest("table");if(t){let n=Array.from(e.parentElement.children).indexOf(e),r=e.getBoundingClientRect(),o=t.querySelectorAll("tbody tr"),i=r;o.forEach(e=>{let t=e.children[n];t&&(i=t.getBoundingClientRect())});let s=i.bottom+4,l=document.createElement("div");l.id="shepherd-user-column-anchor",l.style.position="fixed",l.style.left="".concat(r.left+r.width/2,"px"),l.style.top="".concat(s,"px"),l.style.width="1px",l.style.height="1px",l.style.zIndex="9999",l.style.pointerEvents="none",l.style.backgroundColor="transparent",l.style.transform="translate(-50%, -50%)",document.body.appendChild(l)}}};"/dashboard/clusters"!==window.location.pathname?(m.current=!0,r.push("/clusters").then(()=>{m.current=!1,setTimeout(t,200)})):t()})},when:{show(){var e,t,n;let r=null===(e=t1.activeTour)||void 0===e?void 0:e.getCurrentStep(),o=null==r?void 0:r.getElement(),i=null==o?void 0:o.querySelector(".shepherd-footer"),s=document.createElement("span");if(s.className="shepherd-progress",s.innerText="".concat((null===(t=t1.activeTour)||void 0===t?void 0:t.steps.indexOf(r))+1," of ").concat(null===(n=t1.activeTour)||void 0===n?void 0:n.steps.length),null==i||i.insertBefore(s,i.firstChild),o){let e=o.offsetHeight;if(document.documentElement.style.setProperty("--shepherd-dialog-height","".concat(e+20,"px")),window.innerWidth<768){let e=null;for(let t of[".fixed.top-14.left-0.w-64","div.fixed.w-64.bg-white.border-r",".fixed.w-64.transform",'[class*="fixed"][class*="w-64"][class*="bg-white"]','div[class*="fixed"][class*="top-14"][class*="left-0"][class*="w-64"]'])if(e=document.querySelector(t))break;if(!e)for(let t of document.querySelectorAll("div.fixed")){let n=t.getBoundingClientRect();if(256===n.width&&0===n.left&&n.top>=50){e=t;break}}if(e&&e instanceof HTMLElement){let t=o.getBoundingClientRect().top-56;e.style.setProperty("height","".concat(t,"px"),"important"),e.style.setProperty("max-height","".concat(t,"px"),"important")}}}setTimeout(()=>{let e=Array.from(document.querySelectorAll("thead th")).find(e=>e.textContent&&"User"===e.textContent.trim());if(e&&e instanceof HTMLElement){let t=e.closest("table");if(t){let n=Array.from(e.parentElement.children).indexOf(e),r=e.getBoundingClientRect(),o=t.querySelectorAll("tbody tr"),i=r;o.forEach(e=>{let t=e.children[n];t&&(i=t.getBoundingClientRect())});let s=document.createElement("div");s.id="shepherd-user-column-overlay",s.style.position="fixed",s.style.left="".concat(r.left-4,"px"),s.style.top="".concat(r.top-4,"px"),s.style.width="".concat(r.width+8,"px"),s.style.height="".concat(i.bottom-r.top+8,"px"),s.style.outline="3px solid #3b82f6",s.style.outlineOffset="2px",s.style.borderRadius="8px",s.style.zIndex="9998",s.style.pointerEvents="none",s.style.backgroundColor="transparent",document.body.appendChild(s)}}},100)},hide(){let e=document.getElementById("shepherd-user-column-overlay");e&&e.remove();let t=document.getElementById("shepherd-user-column-anchor");t&&t.remove(),document.documentElement.style.removeProperty("--shepherd-dialog-height");let n=document.querySelector(".fixed.top-14.left-0.w-64")||document.querySelector("div.fixed.w-64.bg-white.border-r")||document.querySelector(".fixed.w-64.transform")||document.querySelector('[class*="fixed"][class*="w-64"][class*="bg-white"]');n&&n instanceof HTMLElement&&(n.style.removeProperty("height"),n.style.removeProperty("max-height"));let r=document.getElementById("shepherd-global-custom-style");r&&r.remove()}},buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"Spin up compute in seconds",text:'\n            <p>Spin up clusters using the Python SDK or the CLI.</p>\n            <div class="space-y-2">\n              <div class="rounded-lg border text-card-foreground shadow-sm p-3 bg-gray-50">\n                <div class="flex items-center justify-between">\n                  <pre class="text-sm w-full whitespace-pre-wrap">\n                    <code class="block">sky launch</code>\n                  </pre>\n                  <button class="inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-8 w-8 rounded-full" onclick="copyDashboardCodeBlock(this)" title="Copy to clipboard">\n                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy h-4 w-4">\n                      <rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect>\n                      <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>\n                    </svg>\n                  </button>\n                </div>\n              </div>\n              <div class="rounded-lg border text-card-foreground shadow-sm p-3 bg-gray-50">\n                <div class="flex items-center justify-between">\n                  <pre class="text-sm w-full whitespace-pre-wrap">\n                    <code class="block">sky launch --gpus L4:8</code>\n                  </pre>\n                  <button class="inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-8 w-8 rounded-full" onclick="copyDashboardCodeBlock(this)" title="Copy to clipboard">\n                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy h-4 w-4">\n                      <rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect>\n                      <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>\n                    </svg>\n                  </button>\n                </div>\n              </div>\n              <div class="rounded-lg border text-card-foreground shadow-sm p-3 bg-gray-50">\n                <div class="flex items-center justify-between">\n                  <pre class="text-sm w-full whitespace-pre-wrap">\n                    <code class="block">sky launch --num-nodes 10 --cpus 32+</code>\n                  </pre>\n                  <button class="inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-8 w-8 rounded-full" onclick="copyDashboardCodeBlock(this)" title="Copy to clipboard">\n                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy h-4 w-4">\n                      <rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect>\n                      <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>\n                    </svg>\n                  </button>\n                </div>\n              </div>\n            </div>\n            ',buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"Jobs",text:"\n            <p>Use <strong>Managed Jobs</strong> for long-running workloads.</p>\n            <p>They provide automatic recovery against failures, such as recovering from preemptions or transient errors.</p>\n          ",attachTo:{element:function(){return document.querySelector('a[href="/dashboard/jobs"]')||document.querySelector('a[href="/dashboard/jobs"]')||'a[href="/dashboard/jobs"]'},on:"bottom",offset:{skidding:0,distance:10}},beforeShowPromise:function(){return new Promise(e=>{(()=>{let t=window.innerWidth<768,n=document.querySelector('[data-testid="mobile-menu-button"], button[aria-label*="menu"], button[aria-label*="Menu"], .mobile-menu-button, [role="button"][aria-expanded]');if(t&&n&&!("true"===n.getAttribute("aria-expanded")||n.classList.contains("open")||document.querySelector('nav[data-state="open"], .mobile-menu.open, [data-mobile-menu="true"]'))){n instanceof HTMLElement&&n.click(),setTimeout(()=>{e()},300);return}e()})()})},buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"Bring one or many infrastructure",text:"\n            <p>SkyPilot combines your Kubernetes clusters, cloud VMs, or on-premise nodes into a unified compute pool.</p>\n            <p>You can monitor them in this page.</p>\n          ",attachTo:{element:function(){return document.querySelector('a[href="/dashboard/infra"]')||document.querySelector('a[href="/dashboard/infra"]')||'a[href="/dashboard/infra"]'},on:"bottom",offset:{skidding:0,distance:10}},beforeShowPromise:function(){return new Promise(e=>{(()=>{let t=window.innerWidth<768,n=document.querySelector('[data-testid="mobile-menu-button"], button[aria-label*="menu"], button[aria-label*="Menu"], .mobile-menu-button, [role="button"][aria-expanded]');if(t&&n&&!("true"===n.getAttribute("aria-expanded")||n.classList.contains("open")||document.querySelector('nav[data-state="open"], .mobile-menu.open, [data-mobile-menu="true"]'))){n instanceof HTMLElement&&n.click(),setTimeout(()=>{e()},300);return}e()})()})},buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"Workspaces",text:"\n            <p>For team deployments, admins can use Workspaces to manage teams or projects.</p>\n          ",attachTo:{element:'a[href="/dashboard/workspaces"]',on:"bottom",offset:{skidding:0,distance:10}},beforeShowPromise:function(){return new Promise(e=>{(()=>{let t=window.innerWidth<768,n=document.querySelector('[data-testid="mobile-menu-button"], button[aria-label*="menu"], button[aria-label*="Menu"], .mobile-menu-button, [role="button"][aria-expanded]');if(t&&n&&!("true"===n.getAttribute("aria-expanded")||n.classList.contains("open")||document.querySelector('nav[data-state="open"], .mobile-menu.open, [data-mobile-menu="true"]'))){n instanceof HTMLElement&&n.click(),setTimeout(()=>{e()},300);return}e()})()})},buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"Users",text:"\n            <p>SkyPilot provides user management with RBAC and SSO support. Admins can manage users in this page.</p>\n          ",attachTo:{element:'a[href="/dashboard/users"]',on:"bottom",offset:{skidding:0,distance:10}},beforeShowPromise:function(){return new Promise(e=>{(()=>{let t=window.innerWidth<768,n=document.querySelector('[data-testid="mobile-menu-button"], button[aria-label*="menu"], button[aria-label*="Menu"], .mobile-menu-button, [role="button"][aria-expanded]');if(t&&n&&!("true"===n.getAttribute("aria-expanded")||n.classList.contains("open")||document.querySelector('nav[data-state="open"], .mobile-menu.open, [data-mobile-menu="true"]'))){n instanceof HTMLElement&&n.click(),setTimeout(()=>{e()},300);return}e()})()})},buttons:[{text:"Back",action(){this.back()},classes:"shepherd-button-secondary"},{text:"Next",action(){this.next()}}]},{title:"\uD83C\uDF89 Tour complete!",text:'\n              <p>We invite you to to explore the rest of the dashboard.</p>\n              <p>To get started with SkyPilot, refer to <a href="https://docs.skypilot.co/en/latest/getting-started/quickstart.html">Quickstart</a>. You can restart this tour by clicking the <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="inline-block h-4 w-4 align-middle"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><path d="M12 17h.01"></path></svg> icon in the bottom right corner.</p>\n              <p>Have questions? Join Slack to directly chat with the SkyPilot team.</p>\n            ',buttons:[{text:"Finish",action(){this.complete()},classes:"shepherd-button-secondary"},{text:"Join Slack",action(){window.open("https://slack.skypilot.co/","_blank"),this.complete()}}]}].forEach(e=>{n.current.addStep(e)})}return o&&!s&&(g(),u(!0)),()=>{n.current&&n.current.complete()}},[o,g]),(0,a.useEffect)(()=>{if(!h||f)return;let e=e=>{if(!m.current){if(window.confirm("The tour is currently in progress. Do you want to abort the tour and navigate away?\n\nYou can resume the tour by clicking the question mark on the bottom right."))n.current&&n.current.cancel();else throw r.events.emit("routeChangeError"),"Route change aborted by user during tour."}},t=e=>(e.preventDefault(),e.returnValue="The tour is currently in progress. Are you sure you want to leave?",e.returnValue);return r.events.on("routeChangeStart",e),window.addEventListener("beforeunload",t),()=>{r.events.off("routeChangeStart",e),window.removeEventListener("beforeunload",t)}},[h,f,r]);let v={startTour:g,completeTour:()=>{n.current&&n.current.complete(),p(!1)},tour:n.current};return(0,l.jsx)(t5.Provider,{value:v,children:t})}window.copyDashboardCodeBlock=function(e){let t=e.closest(".bg-gray-50").querySelector("pre").querySelector("code.block").textContent;navigator.clipboard.writeText(t).then(()=>{let t=e.innerHTML;e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check h-5 w-5 text-green-600"><path d="m9 12 2 2 4-4"/></svg>',setTimeout(()=>{e.innerHTML=t},2e3)})}},36856:function(e,t,n){"use strict";var r=n(6378),o=n(23266),i=n(68969),s=n(17324),l=n(53081),a=n(19238),c=n(32045),u=n(29326);let h={base:{getClusters:{fn:o.getClusters,args:[]},getManagedJobs:{fn:i.aT,args:[{allUsers:!0}]},getManagedJobsForOtherPages:{fn:i.getManagedJobs,args:[{allUsers:!0,skipFinished:!0}]},getWorkspaces:{fn:s.getWorkspaces,args:[]},getUsers:{fn:l.R,args:[]},getEnabledCloudsList:{fn:c.oD,args:[]},getWorkspaceContexts:{fn:c.CI,args:[]},getSlurmInfrastructure:{fn:c.Ve,args:[]},getSSHNodePools:{fn:u.It,args:[]},getVolumes:{fn:a.C,args:[]}},dynamic:{getEnabledClouds:{fn:s.getEnabledClouds,requiresWorkspaces:!0},getContextGPUDataForAllContexts:{fn:c.UU,requiresContexts:!0}},pages:{clusters:["getClusters","getWorkspaces"],jobs:["getManagedJobs","getClusters","getWorkspaces","getUsers"],infra:[],workspaces:["getWorkspaces","getClusters","getManagedJobsForOtherPages","getEnabledClouds"],users:["getUsers","getClusters","getManagedJobsForOtherPages"],volumes:["getVolumes"]}};class d{registerPluginPage(e,t){this.pluginPages.set(e,t),console.log("[CachePreloader] Registered plugin page: ".concat(e," with ").concat(t.length," functions"))}async preloadForPage(e,t){let{backgroundPreload:n=!0,force:r=!1}=t||{};if(!h.pages[e]&&!this.pluginPages.has(e)){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,r),n&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=h.pages[e]||[],o=[],i=this.pluginPages.get(e);if(i)for(let{fn:e,args:n}of i)t&&r.ZP.invalidate(e,n),o.push(r.ZP.get(e,n).then(t=>(this._markAsPreloaded(e,n),t)));for(let e of n)if(h.base[e]){let{fn:n,args:i}=h.base[e];t&&r.ZP.invalidate(n,i),o.push(r.ZP.get(n,i).then(e=>(this._markAsPreloaded(n,i),e)))}else"getEnabledClouds"===e?o.push(this._loadEnabledCloudsForAllWorkspaces(t)):"getContextGPUDataForAllContexts"===e&&o.push(this._loadContextGPUDataForAllContexts(t));await Promise.allSettled(o),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&r.ZP.invalidate(s.getWorkspaces);let t=await r.ZP.get(s.getWorkspaces),n=Object.keys(t||{}).map(t=>(e&&r.ZP.invalidate(s.getEnabledClouds,[t]),r.ZP.get(s.getEnabledClouds,[t])));await Promise.allSettled(n)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}async _loadContextGPUDataForAllContexts(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&r.ZP.invalidate(c.CI);let t=await r.ZP.get(c.CI);if(!t||!t.allContextNames)return;let n=t.allContextNames.filter(e=>e&&!e.startsWith("ssh-")).map(t=>(e&&r.ZP.invalidate(c.UU,[t]),r.ZP.get(c.UU,[t])));await Promise.allSettled(n)}catch(e){console.error("[CachePreloader] Error loading context GPU data:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=new Set(h.pages[e]),n=new Set;Object.keys(h.pages).filter(t=>t!==e).forEach(e=>{h.pages[e].forEach(e=>{t.has(e)||n.add(e)})}),"infra"!==e&&(n.add("getClusters"),n.add("getManagedJobsForOtherPages"),n.add("getEnabledCloudsList"),n.add("getWorkspaceContexts"),n.add("getSlurmInfrastructure"),n.add("getSSHNodePools"),n.add("getContextGPUDataForAllContexts")),console.log("[CachePreloader] Background preloading ".concat(n.size," unique functions: ").concat(Array.from(n).join(", ")));let o=Array.from(n).map(async e=>{try{if(h.base[e]){let{fn:t,args:n}=h.base[e];await r.ZP.get(t,n),this._markAsPreloaded(t,n)}else"getEnabledClouds"===e?await this._loadEnabledCloudsForAllWorkspaces(!1):"getContextGPUDataForAllContexts"===e&&await this._loadContextGPUDataForAllContexts(!1);console.log("[CachePreloader] Background loaded function: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for function ".concat(e,":"),t)}});for(let[t,n]of this.pluginPages)if(t!==e)for(let{fn:e,args:i}of n)o.push(r.ZP.get(e,i).then(()=>{this._markAsPreloaded(e,i),console.log("[CachePreloader] Background loaded plugin function for: ".concat(t))}).catch(e=>{console.error("[CachePreloader] Background load failed for plugin page ".concat(t,":"),e)}));Promise.allSettled(o).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(h.base).map(t=>{let[n,{fn:o,args:i}]=t;return e&&r.ZP.invalidate(o,i),r.ZP.get(o,i).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(n,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...r.ZP.getStats(),isPreloading:this.isPreloading}}wasRecentlyPreloaded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._generateKey(e,t),r=this.recentlyPreloaded.get(n);if(!r)return!1;let o=Date.now()-r<this.PRELOAD_GRACE_PERIOD;return o||this.recentlyPreloaded.delete(n),o}_markAsPreloaded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._generateKey(e,t);this.recentlyPreloaded.set(n,Date.now())}_generateKey(e,t){let n=e.toString(),r=this._simpleHash(n),o=t.length>0?JSON.stringify(t):"";return"".concat(r,"_").concat(o)}_simpleHash(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t>>>0}clearCache(){r.ZP.clear(),this.isPreloading=!1,this.preloadPromises.clear(),this.recentlyPreloaded.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map,this.recentlyPreloaded=new Map,this.PRELOAD_GRACE_PERIOD=5e3,this.pluginPages=new Map}}let f=new d;r.ZP.setPreloader(f),t.ZP=f},6378:function(e,t,n){"use strict";n.d(t,{kq:function(){return s}});let r=n(51214).ej.DEFAULT_TTL;function o(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t>>>0}class i{setPreloader(e){this.preloader=e}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.ttl||r,i=!1!==n.refreshOnAccess,s=this._generateKey(e,t),l=e.name||"anonymous",a=this.cache.get(s),c=Date.now();if(a&&c-a.lastUpdated<o){let n=Math.round((c-a.lastUpdated)/1e3);if(this._debug("Cache HIT for ".concat(l," (age: ").concat(n,"s, TTL: ").concat(Math.round(o/1e3),"s)")),i&&(this.cache.set(s,{data:a.data,lastUpdated:c}),this._debug("Cache TTL refreshed for ".concat(l))),!this.backgroundJobs.has(s)){var u;(null===(u=this.preloader)||void 0===u?void 0:u.wasRecentlyPreloaded(e,t))?this._debug("Skipping background refresh for ".concat(l," - recently preloaded")):this._refreshInBackground(e,t,s)}return a.data}if(this.pendingRequests.has(s))return this._debug("Request deduplication: Waiting for pending request for ".concat(l)),this.pendingRequests.get(s);let h=(async()=>{try{let n=await e(...t);if(n&&n.__skipCache){if(this._debug("Skip caching for ".concat(l," due to __skipCache flag on result")),a)return a.data;return n}return this.cache.set(s,{data:n,lastUpdated:Date.now()}),n}catch(e){if(a)return console.warn("Failed to fetch fresh data for ".concat(s,"/").concat(l,", returning stale data:"),e),a.data;throw e}finally{this.pendingRequests.delete(s)}})();return this.pendingRequests.set(s,h),h}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._generateKey(e,t);this.cache.delete(n),this.backgroundJobs.delete(n),this.pendingRequests.delete(n)}invalidateFunction(e){let t=o(e.toString()),n=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&n.push(e);n.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e),this.pendingRequests.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear(),this.pendingRequests.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[n,r]of this.cache.entries()){let o=e-r.lastUpdated;t.push({key:n,age:Math.round(o/1e3),lastUpdated:new Date(r.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(n),hasPendingRequest:this.pendingRequests.has(n)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.debugMode&&console.log("[DashboardCache] ".concat(e),...n)}_refreshInBackground(e,t,n){this.backgroundJobs.set(n,!0),e(...t).then(e=>{e&&e.__skipCache||this.cache.set(n,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(n,":"),e)}).finally(()=>{this.backgroundJobs.delete(n)})}_generateKey(e,t){let n=o(e.toString()),r=t.length>0?JSON.stringify(t):"";return"".concat(n,"_").concat(r)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.pendingRequests=new Map,this.debugMode=!1,this.preloader=null}}let s=new i;t.ZP=s},51214:function(e,t,n){"use strict";n.d(t,{MO:function(){return i},ej:function(){return r},nb:function(){return o}});let r={DEFAULT_TTL:12e4},o={REFRESH_INTERVAL:3e4,GPU_REFRESH_INTERVAL:3e4},i={NAME_TRUNCATE_LENGTH:20}},97335:function(e,t,n){"use strict";var r=n(6378),o=n(68969);function i(){return"function"==typeof window.__skyJobsPaginationFetch}class s{_generateCacheKey(e){let{page:t=1,limit:n=10,sortBy:r="submitted_at",sortOrder:o="desc",allUsers:i=!0,nameMatch:s,userMatch:l,workspaceMatch:a,poolMatch:c,statuses:u}=e;return JSON.stringify({page:t,limit:n,sortBy:r,sortOrder:o,allUsers:i,nameMatch:s||null,userMatch:l||null,workspaceMatch:a||null,poolMatch:c||null,statuses:u&&u.length>0?[...u].sort():null})}_generateFilterKey(e){let{allUsers:t=!0,nameMatch:n,userMatch:r,workspaceMatch:o,poolMatch:i,statuses:s}=e;return JSON.stringify({allUsers:t,nameMatch:n||null,userMatch:r||null,workspaceMatch:o||null,poolMatch:i||null,statuses:s&&s.length>0?[...s].sort():null})}_isCacheValid(e){return!!e&&Date.now()-e.timestamp<this.cacheTTL}_groupTasksByJob(e){let t=new Map,n=[];for(let r of e){let e=r.id;t.has(e)||(t.set(e,[]),n.push(e)),t.get(e).push(r)}return{jobMap:t,jobOrder:n}}async _populateCacheDefaultPathSinglePage(e){let{page:t=1,limit:n=10,sortBy:i,sortOrder:s,...l}=e,a=this._generateCacheKey(e);console.log("[JobsCacheManager] Default path: fetching single page",t);let c=await r.ZP.get(o.getManagedJobs,[{...l,page:t,limit:n}]);if(c.__skipCache)return c;if(c.controllerStopped)return{jobs:[],total:0,totalNoFilter:0,totalPages:0,hasNext:!1,hasPrev:!1,controllerStopped:!0,statusCounts:{}};let u=c.jobs||[],h="number"==typeof c.total?c.total:u.length,d=c.totalNoFilter||h,f=Math.ceil(h/n)||1,p=t<f,m=t>1,g=c.statusCounts||{};return this.pageCache.set(a,{jobs:u,total:h,totalNoFilter:d,totalPages:f,hasNext:p,hasPrev:m,controllerStopped:!1,statusCounts:g,timestamp:Date.now()}),{jobs:u,total:h,totalNoFilter:d,totalPages:f,hasNext:p,hasPrev:m,controllerStopped:!1,statusCounts:g,fromCache:!1,cacheStatus:"default_path_single_page"}}async _loadFullDatasetAndCacheAllPages(e){let{page:t=1,limit:n=10,sortBy:i,sortOrder:s,...l}=e,a=this._generateFilterKey(l);console.log("[JobsCacheManager] Background: fetching full dataset");let c=await r.ZP.get(o.getManagedJobs,[l]);if(c.__skipCache||c.controllerStopped)return;let u=c.jobs||[],{jobMap:h,jobOrder:d}=this._groupTasksByJob(u),f=d.length;this.fullDataCache.set(a,{jobs:u,jobMap:h,jobOrder:d,totalJobs:f,totalNoFilter:c.totalNoFilter||f,statusCounts:c.statusCounts||{},timestamp:Date.now()});let p=Math.ceil(f/n)||1;for(let e=1;e<=p;e++){let t=(e-1)*n,r=t+n,o=d.slice(t,r),a=[];for(let e of o)a.push(...h.get(e));let u=this._generateCacheKey({...l,page:e,limit:n,sortBy:i,sortOrder:s});this.pageCache.set(u,{jobs:a,total:f,totalNoFilter:c.totalNoFilter||f,totalPages:p,hasNext:e<p,hasPrev:e>1,controllerStopped:!1,statusCounts:c.statusCounts||{},timestamp:Date.now()})}console.log("[JobsCacheManager] Background: cached",p,"pages")}async _populateCachePluginPath(e){let{page:t=1,limit:n=10,sortBy:r="submitted_at",sortOrder:o="desc",statuses:i,...s}=e,l=this._generateCacheKey(e);console.log("[JobsCacheManager] Plugin path: fetching page",t);let a=window.__skyJobsPaginationFetch;if(!a)throw Error("Plugin fetch function not available");let c=await a({page:t,limit:n,sortBy:r,sortOrder:o,statuses:i,filters:this._convertFiltersToPluginFormat(s)});if(c.controllerStopped)return{jobs:[],total:0,totalNoFilter:0,totalPages:0,hasNext:!1,hasPrev:!1,controllerStopped:!0,statusCounts:{},fromCache:!1,cacheStatus:"plugin_path_controller_stopped"};let u=c.items||c.data||[],h=c.total||0,d=c.totalNoFilter||h,f=c.totalPages||c.total_pages||Math.ceil(h/n)||1,p=c.hasNext||c.has_next||t<f,m=c.hasPrev||c.has_prev||t>1,g=c.statusCounts||{};return this.pageCache.set(l,{jobs:u,total:h,totalNoFilter:d,totalPages:f,hasNext:p,hasPrev:m,controllerStopped:!1,statusCounts:g,timestamp:Date.now()}),{jobs:u,total:h,totalNoFilter:d,totalPages:f,hasNext:p,hasPrev:m,controllerStopped:!1,statusCounts:g,fromCache:!1,cacheStatus:"plugin_path_fetched"}}_convertFiltersToPluginFormat(e){let t=[];return e.nameMatch&&t.push({property:"name",value:e.nameMatch}),e.userMatch&&t.push({property:"user",value:e.userMatch}),e.workspaceMatch&&t.push({property:"workspace",value:e.workspaceMatch}),e.poolMatch&&t.push({property:"pool",value:e.poolMatch}),t}async getPaginatedJobs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{page:t=1,limit:n=10}=e,r=this._generateCacheKey(e),o=this._generateFilterKey(e);console.log("[JobsCacheManager] getPaginatedJobs called:",{page:t,limit:n,cacheKey:r.substring(0,50)+"..."});try{let n;let s=this.pageCache.get(r);if(s&&this._isCacheValid(s))return console.log("[JobsCacheManager] Cache hit for page",t),{jobs:s.jobs,total:s.total,totalNoFilter:s.totalNoFilter,totalPages:s.totalPages,hasNext:s.hasNext,hasPrev:s.hasPrev,controllerStopped:s.controllerStopped,statusCounts:s.statusCounts,fromCache:!0,cacheStatus:"cache_hit"};if(this.pendingRequests.has(r))return console.log("[JobsCacheManager] Waiting for pending request"),await this.pendingRequests.get(r);n=i()?this._populateCachePluginPath(e):this._populateCacheDefaultPathSinglePage(e),this.pendingRequests.set(r,n);try{let t=await n;return i()||this.backgroundPrefetching.has(o)||this._kickOffBackgroundPrefetch(e,o),t}finally{this.pendingRequests.delete(r)}}catch(e){throw console.error("[JobsCacheManager] Error in getPaginatedJobs:",e),e}}_kickOffBackgroundPrefetch(e,t){console.log("[JobsCacheManager] Kicking off background prefetch");let n=this._loadFullDatasetAndCacheAllPages(e).catch(e=>{console.warn("[JobsCacheManager] Background prefetch failed:",e)}).finally(()=>{this.backgroundPrefetching.delete(t)});this.backgroundPrefetching.set(t,n)}async prefetchNextPage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{page:t=1,limit:n=10}=e,r=t+1,o={...e,page:r},s=this._generateCacheKey(o);if(!(this.pageCache.has(s)||this.pendingRequests.has(s))){console.log("[JobsCacheManager] Prefetching page",r);try{i()&&await this._populateCachePluginPath(o)}catch(e){console.warn("[JobsCacheManager] Prefetch failed:",e)}}}isDataLoading(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateCacheKey(e);return this.pendingRequests.has(t)}isDataCached(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateCacheKey(e),n=this.pageCache.get(t);return n&&this._isCacheValid(n)}getCacheStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateCacheKey(e),n=this.pageCache.get(t);if(!n)return{isCached:!1,isFresh:!1,age:0};let r=Date.now()-n.timestamp;return{isCached:!0,isFresh:r<this.cacheTTL,age:r,maxAge:this.cacheTTL}}invalidateCache(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(e){let t=this._generateCacheKey(e);this.pageCache.delete(t);let n=this._generateFilterKey(e);this.fullDataCache.delete(n),this.backgroundPrefetching.delete(n)}else this.pageCache.clear(),this.fullDataCache.clear(),this.pendingRequests.clear(),this.backgroundPrefetching.clear();r.ZP.invalidateFunction(o.getManagedJobs)}invalidateFilteredPages(e){let t=this._generateFilterKey(e);for(let[e]of this.pageCache.entries())try{let n=JSON.parse(e),r={allUsers:n.allUsers,nameMatch:n.nameMatch,userMatch:n.userMatch,workspaceMatch:n.workspaceMatch,poolMatch:n.poolMatch,statuses:n.statuses};JSON.stringify(r)===t&&this.pageCache.delete(e)}catch(e){}this.fullDataCache.delete(t)}getCacheStats(){return{pageCacheSize:this.pageCache.size,fullDataCacheSize:this.fullDataCache.size,pendingRequestsCount:this.pendingRequests.size,backgroundPrefetchingCount:this.backgroundPrefetching.size,isPluginAvailable:i(),cachedKeys:Array.from(this.pageCache.keys()).map(e=>{try{let t=JSON.parse(e);return"page:".concat(t.page,",limit:").concat(t.limit)}catch(t){return e.substring(0,30)}})}}constructor(){this.pageCache=new Map,this.fullDataCache=new Map,this.pendingRequests=new Map,this.backgroundPrefetching=new Map,this.cacheTTL=12e4}}let l=new s;t.Z=l},46990:function(e,t,n){"use strict";n.d(t,{cn:function(){return Y}});var r=n(90512);let o=e=>{let t=a(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),i(n,t)||l(e)},getConflictingClassGroupIds:(e,t)=>{let o=n[e]||[];return t&&r[e]?[...o,...r[e]]:o}}},i=(e,t)=>{if(0===e.length)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),o=r?i(e.slice(1),r):void 0;if(o)return o;if(0===t.validators.length)return;let s=e.join("-");return t.validators.find(({validator:e})=>e(s))?.classGroupId},s=/^\[(.+)\]$/,l=e=>{if(s.test(e)){let t=s.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},a=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return d(Object.entries(e.classGroups),n).forEach(([e,n])=>{c(n,r,e,t)}),r},c=(e,t,n,r)=>{e.forEach(e=>{if("string"==typeof e){(""===e?t:u(t,e)).classGroupId=n;return}if("function"==typeof e){if(h(e)){c(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,o])=>{c(o,u(t,e),n,r)})})},u=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},h=e=>e.isThemeGetter,d=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,f=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,o=(o,i)=>{n.set(o,i),++t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(o(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):o(e,t)}}},p=e=>{let{separator:t,experimentalParseClassName:n}=e,r=1===t.length,o=t[0],i=t.length,s=e=>{let n;let s=[],l=0,a=0;for(let c=0;c<e.length;c++){let u=e[c];if(0===l){if(u===o&&(r||e.slice(c,c+i)===t)){s.push(e.slice(a,c)),a=c+i;continue}if("/"===u){n=c;continue}}"["===u?l++:"]"===u&&l--}let c=0===s.length?e:e.substring(a),u=c.startsWith("!"),h=u?c.substring(1):c;return{modifiers:s,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:n&&n>a?n-a:void 0}};return n?e=>n({className:e,parseClassName:s}):s},m=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{"["===e[0]?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},g=e=>({cache:f(e.cacheSize),parseClassName:p(e),...o(e)}),v=/\s+/,b=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(v),l="";for(let e=s.length-1;e>=0;e-=1){let t=s[e],{modifiers:a,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:h}=n(t),d=!!h,f=r(d?u.substring(0,h):u);if(!f){if(!d||!(f=r(u))){l=t+(l.length>0?" "+l:l);continue}d=!1}let p=m(a).join(":"),g=c?p+"!":p,v=g+f;if(i.includes(v))continue;i.push(v);let b=o(f,d);for(let e=0;e<b.length;++e){let t=b[e];i.push(g+t)}l=t+(l.length>0?" "+l:l)}return l};function y(){let e,t,n=0,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=w(e))&&(r&&(r+=" "),r+=t);return r}let w=e=>{let t;if("string"==typeof e)return e;let n="";for(let r=0;r<e.length;r++)e[r]&&(t=w(e[r]))&&(n&&(n+=" "),n+=t);return n},x=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},k=/^\[(?:([a-z-]+):)?(.+)\]$/i,S=/^\d+\/\d+$/,C=new Set(["px","full","screen"]),O=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,P=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,T=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,M=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,A=e=>_(e)||C.has(e)||S.test(e),R=e=>V(e,"length",U),_=e=>!!e&&!Number.isNaN(Number(e)),D=e=>V(e,"number",_),N=e=>!!e&&Number.isInteger(Number(e)),L=e=>e.endsWith("%")&&_(e.slice(0,-1)),I=e=>k.test(e),j=e=>O.test(e),B=new Set(["length","size","percentage"]),W=e=>V(e,B,G),F=e=>V(e,"position",G),$=new Set(["image","url"]),z=e=>V(e,$,Q),H=e=>V(e,"",X),q=()=>!0,V=(e,t,n)=>{let r=k.exec(e);return!!r&&(r[1]?"string"==typeof t?r[1]===t:t.has(r[1]):n(r[2]))},U=e=>E.test(e)&&!P.test(e),G=()=>!1,X=e=>T.test(e),Q=e=>M.test(e),K=function(e,...t){let n,r,o;let i=function(l){return r=(n=g(t.reduce((e,t)=>t(e),e()))).cache.get,o=n.cache.set,i=s,s(l)};function s(e){let t=r(e);if(t)return t;let i=b(e,n);return o(e,i),i}return function(){return i(y.apply(null,arguments))}}(()=>{let e=x("colors"),t=x("spacing"),n=x("blur"),r=x("brightness"),o=x("borderColor"),i=x("borderRadius"),s=x("borderSpacing"),l=x("borderWidth"),a=x("contrast"),c=x("grayscale"),u=x("hueRotate"),h=x("invert"),d=x("gap"),f=x("gradientColorStops"),p=x("gradientColorStopPositions"),m=x("inset"),g=x("margin"),v=x("opacity"),b=x("padding"),y=x("saturate"),w=x("scale"),k=x("sepia"),S=x("skew"),C=x("space"),O=x("translate"),E=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",I,t],M=()=>[I,t],B=()=>["",A,R],$=()=>["auto",_,I],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",I],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>[_,I];return{cacheSize:500,separator:":",theme:{colors:[q],spacing:[A,R],blur:["none","",j,I],brightness:Y(),borderColor:[e],borderRadius:["none","","full",j,I],borderSpacing:M(),borderWidth:B(),contrast:Y(),grayscale:Q(),hueRotate:Y(),invert:Q(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[L,R],inset:T(),margin:T(),opacity:Y(),padding:M(),saturate:Y(),scale:Y(),sepia:Q(),skew:Y(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",I]}],container:["container"],columns:[{columns:[j]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...V(),I]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",N,I]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",I]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",N,I]}],"grid-cols":[{"grid-cols":[q]}],"col-start-end":[{col:["auto",{span:["full",N,I]},I]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[q]}],"row-start-end":[{row:["auto",{span:[N,I]},I]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",I]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",I]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",I,t]}],"min-w":[{"min-w":[I,t,"min","max","fit"]}],"max-w":[{"max-w":[I,t,"none","full","min","max","fit","prose",{screen:[j]},j]}],h:[{h:[I,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[I,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[I,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[I,t,"auto","min","max","fit"]}],"font-size":[{text:["base",j,R]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",D]}],"font-family":[{font:[q]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",I]}],"line-clamp":[{"line-clamp":["none",_,D]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",A,I]}],"list-image":[{"list-image":["none",I]}],"list-style-type":[{list:["none","disc","decimal",I]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",A,R]}],"underline-offset":[{"underline-offset":["auto",A,I]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",I]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",I]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...V(),F]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",W]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},z]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:U()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[A,I]}],"outline-w":[{outline:[A,R]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[A,R]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",j,H]}],"shadow-color":[{shadow:[q]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",j,I]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[y]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",I]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",I]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",I]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[N,I]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",I]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",I]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",I]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[A,R,D]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function Y(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return K((0,r.W)(t))}},32586:function(e,t,n){"use strict";n.r(t);var r,o=n(85893),i=n(67294),s=n(20745),l=n(73935),a=n(5152),c=n.n(a),u=n(45697),h=n.n(u);n(36501);var d=n(93225),f=n(94849),p=n(23800),m=n(91623);let g=c()(()=>Promise.all([n.e(850),n.e(329)]).then(n.bind(n,33872)).then(e=>e.Layout),{loadableGenerated:{webpack:()=>[33872]},ssr:!1});function v(e){let{Component:t,pageProps:n}=e;return(0,i.useEffect)(()=>{let e=document.createElement("link");e.rel="icon",e.href="".concat(d.GW,"/favicon.ico"),document.head.appendChild(e)},[]),(0,o.jsx)(p.ol,{children:(0,o.jsx)(m.pU,{children:(0,o.jsx)(f.C,{children:(0,o.jsx)(g,{highlighted:n.highlighted,children:(0,o.jsx)(t,{...n})})})})})}window.React=i,window.ReactDOM={...r||(r=n.t(l,2)),...s},v.propTypes={Component:h().elementType.isRequired,pageProps:h().object.isRequired},t.default=v},23800:function(e,t,n){"use strict";n.d(t,{A_:function(){return E},V$:function(){return T},_q:function(){return P},d7:function(){return k},dL:function(){return O},ol:function(){return w},t6:function(){return C},x1:function(){return S}});var r=n(85893),o=n(67294),i=n(11163),s=n(93225),l=n(47145),a=n(6378),c=n(36856),u=n(17853),h=n(33907);let d=(0,o.createContext)({topNavLinks:[],routes:[],components:{},dataEnhancements:{},tableColumns:{},dataProviders:{}}),f={topNavLinks:[],routes:[],components:{},dataEnhancements:{},tableColumns:{},dataProviders:{}},p={REGISTER_TOP_NAV_LINK:"REGISTER_TOP_NAV_LINK",REGISTER_ROUTE:"REGISTER_ROUTE",REGISTER_COMPONENT:"REGISTER_COMPONENT",REGISTER_DATA_ENHANCEMENT:"REGISTER_DATA_ENHANCEMENT",REGISTER_TABLE_COLUMN:"REGISTER_TABLE_COLUMN",REGISTER_DATA_PROVIDER:"REGISTER_DATA_PROVIDER"};function m(e,t){switch(t.type){case p.REGISTER_TOP_NAV_LINK:return{...e,topNavLinks:g(e.topNavLinks,t.payload)};case p.REGISTER_ROUTE:return{...e,routes:g(e.routes,t.payload)};case p.REGISTER_COMPONENT:{let{slot:n}=t.payload,r=g(e.components[n]||[],t.payload);return r.sort((e,t)=>(e.order||100)-(t.order||100)),{...e,components:{...e.components,[n]:r}}}case p.REGISTER_DATA_ENHANCEMENT:{let{dataSource:n}=t.payload,r=g(e.dataEnhancements[n]||[],t.payload);return r.sort((e,t)=>{var n,r,o,i;let s=null!==(o=e.priority)&&void 0!==o?o:100,l=null!==(i=t.priority)&&void 0!==i?i:100;return s!==l?s-l:(null===(n=t.dependencies)||void 0===n?void 0:n.includes(e.id))?-1:(null===(r=e.dependencies)||void 0===r?void 0:r.includes(t.id))?1:0}),{...e,dataEnhancements:{...e.dataEnhancements,[n]:r}}}case p.REGISTER_TABLE_COLUMN:{let{table:n}=t.payload,r=g(e.tableColumns[n]||[],t.payload);return r.sort((e,t)=>{var n,r,o,i;return(null!==(o=null===(n=e.header)||void 0===n?void 0:n.order)&&void 0!==o?o:100)-(null!==(i=null===(r=t.header)||void 0===r?void 0:r.order)&&void 0!==i?i:100)}),{...e,tableColumns:{...e.tableColumns,[n]:r}}}case p.REGISTER_DATA_PROVIDER:return{...e,dataProviders:{...e.dataProviders,[t.payload.id]:t.payload}};default:return e}}function g(e,t){let n=e.findIndex(e=>e.id===t.id);if(-1===n)return[...e,t];let r=[...e];return r[n]=t,r}let v=new Map;async function b(){try{let e=await l.x.get("/api/plugins");if(!e.ok)return console.warn("[SkyDashboardPlugin] Failed to fetch plugin manifest:",e.status,e.statusText),[];let t=await e.json();if(!t||!Array.isArray(t.plugins))return[];return console.log("Plugin manifest:",t.plugins),t.plugins}catch(e){return console.warn("[SkyDashboardPlugin] Error fetching plugin manifest:",e),[]}}function y(e){if(!e||"string"!=typeof e||e.startsWith("/")||!e.startsWith("http://")&&!e.startsWith("https://"))return e;try{let t=new URL(e);return t.username="",t.password="",t.toString()}catch(t){return console.warn("[SkyDashboardPlugin] Failed to normalize URL:",e,t),e}}function w(e){let{children:t}=e,[l,g]=(0,o.useReducer)(m,f),w=(0,i.useRouter)(),x=(0,o.useRef)(w);(0,o.useEffect)(()=>{x.current=w},[w]),(0,o.useEffect)(()=>(window.__pluginRouterRef=x,()=>{window.__pluginRouterRef===x&&delete window.__pluginRouterRef}),[]),(0,o.useEffect)(()=>(window.__pluginStateRef={current:l},()=>{window.__pluginStateRef&&delete window.__pluginStateRef}),[l]),(0,o.useEffect)(()=>{!function(){if(!window.history)return;let e=window.history.pushState,t=window.history.replaceState;window.history.pushState=function(t,n,r){let o=r;r&&"string"==typeof r&&(o=y(r));try{return e.call(this,t,n,o)}catch(r){if("SecurityError"===r.name&&o&&"string"==typeof o)try{let r=new URL(o,window.location.href),i=r.pathname+r.search+r.hash;return e.call(this,t,n,i)}catch(e){}throw r}},window.history.replaceState=function(e,n,r){let o=r;r&&"string"==typeof r&&(o=y(r));try{return t.call(this,e,n,o)}catch(r){if("SecurityError"===r.name&&o&&"string"==typeof o)try{let r=new URL(o,window.location.href),i=r.pathname+r.search+r.hash;return t.call(this,e,n,i)}catch(e){}throw r}}}();let e=!1,t={registerTopNavLink(e){var t,n;let r=e&&e.id&&e.label&&e.href?{id:String(e.id),label:String(e.label),href:String(e.href),order:Number.isFinite(e.order)?e.order:0,group:e.group?String(e.group):null,target:"_blank"===e.target?"_blank":"_self",rel:null!==(t=e.rel)&&void 0!==t?t:"_blank"===e.target||/^https?:\/\//.test(String(e.href))?"noopener noreferrer":void 0,external:null!==(n=e.external)&&void 0!==n?n:/^(https?:)?\/\//.test(String(e.href))||"_blank"===e.target,badge:"string"==typeof e.badge?e.badge:null,icon:"string"==typeof e.icon||o.isValidElement(e.icon)?e.icon:null,description:"string"==typeof e.description?e.description:void 0}:(console.warn("[SkyDashboardPlugin] Invalid top nav link registration:",e),null);return r?(g({type:p.REGISTER_TOP_NAV_LINK,payload:r}),r.id):null},registerRoute(e){let t=function(e){if(!e||"object"!=typeof e||!e.id||!e.path||"function"!=typeof e.mount)return console.warn("[SkyDashboardPlugin] Invalid route registration:",e),null;let t=String(e.path),n=t.startsWith("/")?t:"/".concat(t);return{id:String(e.id),path:n,title:"string"==typeof e.title?e.title:void 0,description:"string"==typeof e.description?e.description:void 0,mount:e.mount,unmount:"function"==typeof e.unmount?e.unmount:void 0,context:e.context&&"object"==typeof e.context?e.context:void 0}}(e);return t?(g({type:p.REGISTER_ROUTE,payload:t}),t.id):null},registerComponent(e){let t=e&&"object"==typeof e&&e.id&&e.slot&&"function"==typeof e.component?{id:String(e.id),slot:String(e.slot),component:e.component,order:Number.isFinite(e.order)?e.order:100,conditions:e.conditions&&"object"==typeof e.conditions?{pages:Array.isArray(e.conditions.pages)?e.conditions.pages.map(String):void 0}:void 0}:(console.warn("[SkyDashboardPlugin] Invalid component registration:",e),null);return t?(g({type:p.REGISTER_COMPONENT,payload:t}),t.id):null},registerDataEnhancement(e){let t=e&&"object"==typeof e&&e.id&&e.dataSource&&"function"==typeof e.enhance?{id:String(e.id),dataSource:String(e.dataSource),enhance:e.enhance,priority:Number.isFinite(e.priority)?e.priority:100,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(String):void 0,fields:Array.isArray(e.fields)?e.fields.map(String):void 0}:(console.warn("[SkyDashboardPlugin] Invalid data enhancement registration:",e),null);if(!t)return null;let n=E(t.dataSource);if(t.fields&&t.fields.length>0){let e=[];n.forEach(n=>{if(n.fields&&n.fields.length>0){let r=t.fields.filter(e=>n.fields.includes(e));r.length>0&&e.push({plugin:n.id,fields:r})}}),e.length>0&&console.warn("[SkyDashboardPlugin] Field conflicts detected for ".concat(t.id,":"),e)}return g({type:p.REGISTER_DATA_ENHANCEMENT,payload:t}),t.id},registerTableColumn(e){let t=e&&"object"==typeof e&&e.id&&e.table&&e.header&&"object"==typeof e.header&&e.header.label&&e.cell&&"object"==typeof e.cell&&"function"==typeof e.cell.render?{id:String(e.id),table:String(e.table),header:{label:String(e.header.label),sortKey:e.header.sortKey?String(e.header.sortKey):void 0,className:e.header.className?String(e.header.className):void 0,order:Number.isFinite(e.header.order)?e.header.order:100},cell:{render:e.cell.render,className:e.cell.className?String(e.cell.className):void 0},conditions:e.conditions&&"object"==typeof e.conditions?{showWhen:"function"==typeof e.conditions.showWhen?e.conditions.showWhen:void 0}:void 0}:(console.warn("[SkyDashboardPlugin] Invalid table column registration:",e),null);return t?(g({type:p.REGISTER_TABLE_COLUMN,payload:t}),t.id):null},getContext:()=>({basePath:s.GW,apiEndpoint:s.f4,dashboardCache:a.ZP,cachePreloader:c.ZP,grafanaUtils:{checkGrafanaAvailability:u.TO,getGrafanaUrl:u.ki},gpuUtils:{canonicalizeGpuName:h.y,CANONICAL_GPU_NAMES:h.H},normalizeUrl:y,navigate:e=>{var t;let n=null===(t=window.__pluginRouterRef)||void 0===t?void 0:t.current;n?n.push(e):window.location.href=e},getNavLinks:()=>{let e=window.__pluginStateRef;if(!(null==e?void 0:e.current))return{ungrouped:[],groups:{}};let t=[...e.current.topNavLinks||[]].sort((e,t)=>e.order-t.order);return{ungrouped:t.filter(e=>!e.group),groups:t.filter(e=>e.group).reduce((e,t)=>{let n=t.group;return e[n]||(e[n]=[]),e[n].push(t),e},{})}},getPluginRoutes:()=>{var e;let t=window.__pluginStateRef;return(null==t?void 0:null===(e=t.current)||void 0===e?void 0:e.routes)||[]},getSlotComponents:e=>{let t=window.__pluginStateRef;return(null==t?void 0:t.current)&&e&&t.current.components[e]||[]}}),getComponents:()=>n(90484),registerDataProvider(e){if(!(null==e?void 0:e.id))return console.warn("[SkyDashboardPlugin] Invalid data provider: missing id",e),null;let t={id:String(e.id),name:e.name||e.id,useHook:e.useHook};return g({type:p.REGISTER_DATA_PROVIDER,payload:t}),console.log("[SkyDashboardPlugin] Registered data provider:",e.id),e.id}};return window.SkyDashboardPluginAPI=t,window.dispatchEvent(new CustomEvent("skydashboard:plugins-ready",{detail:t})),(async()=>{let t=await b();e||t.forEach(t=>{let n=t&&"object"==typeof t&&t.js_extension_path?(console.log("Extracting JS extension path:",t.js_extension_path),t.js_extension_path):null;n&&!e&&function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(e){if(!e||"string"!=typeof e)return null;if(/^https?:\/\//.test(e))return e;try{return new URL(e,window.location.origin).toString()}catch(t){return console.warn("[SkyDashboardPlugin] Failed to resolve plugin script path:",e,t),null}}(e);if(!n)return;if(v.has(n))return v.get(n);console.log("Loading plugin script:",n);let r=new Promise(e=>{let r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=n,t&&(r.dataset.requiresEarlyInit="true"),r.onload=()=>e(),r.onerror=t=>{console.warn("[SkyDashboardPlugin] Failed to load plugin script:",n,t),e()},document.head.appendChild(r)});v.set(n,r)}(n,!0===t.requires_early_init)})})(),()=>{e=!0,window.SkyDashboardPluginAPI===t&&delete window.SkyDashboardPluginAPI}},[g]);let k=(0,o.useMemo)(()=>l,[l]);return(0,r.jsx)(d.Provider,{value:k,children:t})}function x(){return(0,o.useContext)(d)}function k(){let{topNavLinks:e}=x();return(0,o.useMemo)(()=>{let t=[...e].sort((e,t)=>e.order-t.order);return{ungrouped:t.filter(e=>!e.group),groups:t.filter(e=>e.group).reduce((e,t)=>{let n=t.group;return e[n]||(e[n]=[]),e[n].push(t),e},{})}},[e])}function S(){let{routes:e}=x();return e}function C(e){let t=S();return(0,o.useMemo)(()=>e&&[...t].sort((e,t)=>t.path.length-e.path.length).find(t=>e===t.path||e.startsWith(t.path+"/"))||null,[e,t])}function O(e){let{components:t}=x();return(0,o.useMemo)(()=>{if(!e)return[];let n=t[e]||[],r=window.location.pathname;return n.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||!t.pages||e.conditions.pages.some(e=>r.includes(e))})},[e,t])}function E(e){if(window.__pluginStateRef){var t;let n=window.__pluginStateRef.current;return(null==n?void 0:null===(t=n.dataEnhancements)||void 0===t?void 0:t[e])||[]}return[]}function P(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{tableColumns:n}=x();return(0,o.useMemo)(()=>e?(n[e]||[]).filter(e=>{var n;return null===(n=e.conditions)||void 0===n||!n.showWhen||e.conditions.showWhen(t)}):[],[e,n,t])}function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=P(e,n);return(0,o.useMemo)(()=>{let e=r?i.map(e=>r(e)):i.map(e=>({id:e.id,order:e.header.order,isPlugin:!0,pluginColumn:e})),o=new Set(e.map(e=>e.id));return[...t,...e].sort((e,t)=>e.order-t.order).filter(e=>!(!e.isPlugin&&o.has(e.id))&&(!e.conditional||!!n.shouldShowColumn&&"function"==typeof n.shouldShowColumn&&n.shouldShowColumn(e.id)))},[t,i,r,n])}},10410:function(e,t,n){"use strict";n.d(t,{M:function(){return i}});var r=n(23800),o=n(6378);async function i(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(0,r.A_)(t);if(0===i.length)return e;let s={dashboardCache:n.dashboardCache||o.ZP,getOriginalData:()=>Promise.resolve(e),rawData:n.rawData||null,...n},l=e;for(let e of i){let t=l;try{let n=await e.enhance(t,s);if(!Array.isArray(n)){console.error("[Plugin] Data enhancement ".concat(e.id," did not return an array. Skipping."));continue}n.length!==t.length&&console.warn("[Plugin] Data enhancement ".concat(e.id," changed array length from ").concat(t.length," to ").concat(n.length,". This is not recommended.")),l=n}catch(t){console.error("[Plugin] Data enhancement ".concat(e.id," failed:"),t)}}return l}},33907:function(e,t,n){"use strict";n.d(t,{H:function(){return r},y:function(){return o}});let r=["GB300","GB200","B300","B200","B100","GH200","H200","H100-MEGA","H100","A100","A10G","A10","A16","A30","A40","RTX6000-Ada","L40S","L40","L4","A6000","A5000","A4000","V100","P100","P40","P4000","P4","T4g","T4","K80","M60"];function o(e){if(!e)return"Unknown";let t=e.trim();if(!t)return"Unknown";for(let e of r)if(RegExp("\\b".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\b"),"i").test(t))return e;return t.toUpperCase().replace(/^NVIDIA[\s-]*/i,"").replace(/^GEFORCE[\s-]*/i,"").replace(/RTX[\s-]/i,"RTX").replace(/-SXM[\d]*/,"").replace(/-PCIE/,"").trim()||"Unknown"}},17853:function(e,t,n){"use strict";n.d(t,{JP:function(){return l},TO:function(){return i},ki:function(){return s}});let r=null,o=null,i=async()=>null!==r?r:o||(o=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),t=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return 200==t.status}catch(e){return console.debug("Grafana availability check failed:",e),r=!1,!1}finally{o=null}})()),s=()=>"".concat(window.location.origin,"/grafana"),l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=s();return"".concat(t).concat(e)}},30017:function(e,t,n){"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;let{isSSH:n,isSlurm:r,cloud:o}=t,i=null;i=n||"SSH"===o?"ssh":r||(null==o?void 0:o.toLowerCase())==="slurm"?"slurm":"Kubernetes"===o?"kubernetes":e.startsWith("ssh-")?"ssh":"kubernetes";let s=e;return"ssh"===i&&(s=e.replace(/^ssh-/,"")),"".concat(i,"/").concat(s)}function o(e,t){return e&&t?r(t,{cloud:e}):null}n.d(t,{G:function(){return r},y:function(){return o}})},36501:function(){},77663:function(e){!function(){var t={229:function(e){var t,n,r,o=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var a=[],c=!1,u=-1;function h(){c&&r&&(c=!1,r.length?a=r.concat(a):u=-1,a.length&&d())}function d(){if(!c){var e=l(h);c=!0;for(var t=a.length;t;){for(r=a,a=[];++u<t;)r&&r[u].run();u=-1,t=a.length}r=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}o.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];a.push(new f(e,t)),1!==a.length||c||l(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=p,o.addListener=p,o.once=p,o.off=p,o.removeListener=p,o.removeAllListeners=p,o.emit=p,o.prependListener=p,o.prependOnceListener=p,o.listeners=function(e){return[]},o.binding=function(e){throw Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw Error("process.chdir is not supported")},o.umask=function(){return 0}}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}},s=!0;try{t[e](i,i.exports,r),s=!1}finally{s&&delete n[e]}return i.exports}r.ab="//";var o=r(229);e.exports=o}()},5152:function(e,t,n){e.exports=n(19606)},25675:function(e,t,n){e.exports=n(7e4)},41664:function(e,t,n){e.exports=n(24116)},11163:function(e,t,n){e.exports=n(26036)},92703:function(e,t,n){"use strict";var r=n(50414);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,s){if(s!==r){var l=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},45697:function(e,t,n){e.exports=n(92703)()},50414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},23941:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});var l=s(n(67294)),a=n(67294);t.default=function(e){var t=r({cardStyles:{back:{},front:{}},cardZIndex:"auto",containerStyle:{},flipDirection:"horizontal",flipSpeedBackToFront:.6,flipSpeedFrontToBack:.6,infinite:!1,isFlipped:!1},e),n=t.cardStyles,o=n.back,i=n.front,s=t.cardZIndex,c=t.containerStyle,u=t.containerClassName,h=t.flipDirection,d=t.flipSpeedFrontToBack,f=t.flipSpeedBackToFront,p=t.infinite,m=t.isFlipped,g=(0,a.useState)(m),v=g[0],b=g[1],y=(0,a.useState)(0),w=y[0],x=y[1];(0,a.useEffect)(function(){m!==v&&(b(m),x(function(e){return e+180}))},[m]);var k=(0,a.useMemo)(function(){var e="react-card-flip";return u&&(e+=" ".concat(u)),e},[u]),S=function(t){if(2!==e.children.length)throw Error("Component ReactCardFlip requires 2 children to function");return e.children[t]},C="rotateY(".concat(p?w:m?180:0,"deg)"),O="rotateY(".concat(p?w+180:m?0:-180,"deg)"),E="rotateX(".concat(p?w:m?180:0,"deg)"),P="rotateX(".concat(p?w+180:m?0:-180,"deg)"),T={back:r({WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",height:"100%",left:"0",position:m?"relative":"absolute",top:"0",transform:"horizontal"===h?O:P,transformStyle:"preserve-3d",transition:"".concat(d,"s"),width:"100%",zIndex:m?"2":"1"},o),container:{zIndex:"".concat(s)},flipper:{height:"100%",perspective:"1000px",position:"relative",width:"100%"},front:r({WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",height:"100%",left:"0",position:m?"absolute":"relative",top:"0",transform:"horizontal"===h?C:E,transformStyle:"preserve-3d",transition:"".concat(f,"s"),width:"100%",zIndex:"2"},i)};return l.createElement("div",{className:k,style:r(r({},T.container),c)},l.createElement("div",{className:"react-card-flipper",style:T.flipper},l.createElement("div",{className:"react-card-front",style:T.front},S(0)),l.createElement("div",{className:"react-card-back",style:T.back},S(1))))}},6223:function(e,t,n){"use strict";n.d(t,{Z:function(){return K}});var r,o,i,s,l,a,c,u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function h(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}"function"==typeof SuppressedError&&SuppressedError;var d=n(67294),f="right-scroll-bar-position",p="width-before-scroll-bar";function m(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var g="undefined"!=typeof window?d.useLayoutEffect:d.useEffect,v=new WeakMap,b=(void 0===o&&(o={}),(void 0===i&&(i=function(e){return e}),s=[],l=!1,a={read:function(){if(l)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:null},useMedium:function(e){var t=i(e,l);return s.push(t),function(){s=s.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(l=!0;s.length;){var t=s;s=[],t.forEach(e)}s={push:function(t){return e(t)},filter:function(){return s}}},assignMedium:function(e){l=!0;var t=[];if(s.length){var n=s;s=[],n.forEach(e),t=s}var r=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(r)};o(),s={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),s}}}}).options=u({async:!0,ssr:!1},o),a),y=function(){},w=d.forwardRef(function(e,t){var n,r,o,i,s=d.useRef(null),l=d.useState({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:y}),a=l[0],c=l[1],f=e.forwardProps,p=e.children,w=e.className,x=e.removeScrollBar,k=e.enabled,S=e.shards,C=e.sideCar,O=e.noRelative,E=e.noIsolation,P=e.inert,T=e.allowPinchZoom,M=e.as,A=e.gapMode,R=h(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=(n=[s,t],r=function(e){return n.forEach(function(t){return m(t,e)})},(o=(0,d.useState)(function(){return{value:null,callback:r,facade:{get current(){return o.value},set current(value){var e=o.value;e!==value&&(o.value=value,o.callback(value,e))}}}})[0]).callback=r,i=o.facade,g(function(){var e=v.get(i);if(e){var t=new Set(e),r=new Set(n),o=i.current;t.forEach(function(e){r.has(e)||m(e,null)}),r.forEach(function(e){t.has(e)||m(e,o)})}v.set(i,n)},[n]),i),D=u(u({},R),a);return d.createElement(d.Fragment,null,k&&d.createElement(C,{sideCar:b,removeScrollBar:x,shards:S,noRelative:O,noIsolation:E,inert:P,setCallbacks:c,allowPinchZoom:!!T,lockRef:s,gapMode:A}),f?d.cloneElement(d.Children.only(p),u(u({},D),{ref:_})):d.createElement(void 0===M?"div":M,u({},D,{className:w,ref:_}),p))});w.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},w.classNames={fullWidth:p,zeroRight:f};var x=function(e){var t=e.sideCar,n=h(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 d.createElement(r,u({},n))};x.isSideCarExport=!0;var k=function(){var e=0,t=null;return{add:function(o){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=r||n.nc;return t&&e.setAttribute("nonce",t),e}())){var i,s;(i=t).styleSheet?i.styleSheet.cssText=o:i.appendChild(document.createTextNode(o)),s=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(s)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},S=function(){var e=k();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},C=function(){var e=S();return function(t){return e(t.styles,t.dynamic),null}},O={left:0,top:0,right:0,gap:0},E=function(e){return parseInt(e||"",10)||0},P=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[E(n),E(r),E(o)]},T=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return O;var t=P(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])}},M=C(),A="data-scroll-locked",R=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,l=e.gap;return void 0===n&&(n="margin"),"\n  .".concat("with-scroll-bars-hidden"," {\n   overflow: hidden ").concat(r,";\n   padding-right: ").concat(l,"px ").concat(r,";\n  }\n  body[").concat(A,"] {\n    overflow: hidden ").concat(r,";\n    overscroll-behavior: contain;\n    ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n    padding-left: ".concat(o,"px;\n    padding-top: ").concat(i,"px;\n    padding-right: ").concat(s,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(l,"px ").concat(r,";\n    "),"padding"===n&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),"\n  }\n  \n  .").concat(f," {\n    right: ").concat(l,"px ").concat(r,";\n  }\n  \n  .").concat(p," {\n    margin-right: ").concat(l,"px ").concat(r,";\n  }\n  \n  .").concat(f," .").concat(f," {\n    right: 0 ").concat(r,";\n  }\n  \n  .").concat(p," .").concat(p," {\n    margin-right: 0 ").concat(r,";\n  }\n  \n  body[").concat(A,"] {\n    ").concat("--removed-body-scroll-bar-size",": ").concat(l,"px;\n  }\n")},_=function(){var e=parseInt(document.body.getAttribute(A)||"0",10);return isFinite(e)?e:0},D=function(){d.useEffect(function(){return document.body.setAttribute(A,(_()+1).toString()),function(){var e=_()-1;e<=0?document.body.removeAttribute(A):document.body.setAttribute(A,e.toString())}},[])},N=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;D();var i=d.useMemo(function(){return T(o)},[o]);return d.createElement(M,{styles:R(i,!t,o,n?"":"!important")})},L=!1;if("undefined"!=typeof window)try{var I=Object.defineProperty({},"passive",{get:function(){return L=!0,!0}});window.addEventListener("test",I,I),window.removeEventListener("test",I,I)}catch(e){L=!1}var j=!!L&&{passive:!1},B=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&"TEXTAREA"!==e.tagName&&"visible"===n[t])},W=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),F(e,r)){var o=$(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},F=function(e,t){return"v"===e?B(t,"overflowY"):B(t,"overflowX")},$=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},z=function(e,t,n,r,o){var i,s=(i=window.getComputedStyle(t).direction,"h"===e&&"rtl"===i?-1:1),l=s*r,a=n.target,c=t.contains(a),u=!1,h=l>0,d=0,f=0;do{if(!a)break;var p=$(e,a),m=p[0],g=p[1]-p[2]-s*m;(m||g)&&F(e,a)&&(d+=g,f+=m);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return h&&(o&&1>Math.abs(d)||!o&&l>d)?u=!0:!h&&(o&&1>Math.abs(f)||!o&&-l>f)&&(u=!0),u},H=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},q=function(e){return[e.deltaX,e.deltaY]},V=function(e){return e&&"current"in e?e.current:e},U=0,G=[],X=(c=function(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(U++)[0],i=d.useState(C)[0],s=d.useRef(e);d.useEffect(function(){s.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=(function(e,t,n){if(n||2==arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(V),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var o,i=H(e),l=n.current,a="deltaX"in e?e.deltaX:l[0]-i[0],c="deltaY"in e?e.deltaY:l[1]-i[1],u=e.target,h=Math.abs(a)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===h&&"range"===u.type)return!1;var d=W(h,u);if(!d)return!0;if(d?o=h:(o="v"===h?"h":"v",d=W(h,u)),!d)return!1;if(!r.current&&"changedTouches"in e&&(a||c)&&(r.current=o),!o)return!0;var f=r.current||o;return z(f,t,e,"h"===f?a:c,!0)},[]),a=d.useCallback(function(e){if(G.length&&G[G.length-1]===i){var n="deltaY"in e?q(e):H(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta)[0]===n[0]&&r[1]===n[1]})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var o=(s.current.shards||[]).map(V).filter(Boolean).filter(function(t){return t.contains(e.target)});(o.length>0?l(e,o[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=d.useCallback(function(e,n,r,o){var i={name:e,delta:n,target:r,should:o,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(i),setTimeout(function(){t.current=t.current.filter(function(e){return e!==i})},1)},[]),u=d.useCallback(function(e){n.current=H(e),r.current=void 0},[]),h=d.useCallback(function(t){c(t.type,q(t),t.target,l(t,e.lockRef.current))},[]),f=d.useCallback(function(t){c(t.type,H(t),t.target,l(t,e.lockRef.current))},[]);d.useEffect(function(){return G.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",a,j),document.addEventListener("touchmove",a,j),document.addEventListener("touchstart",u,j),function(){G=G.filter(function(e){return e!==i}),document.removeEventListener("wheel",a,j),document.removeEventListener("touchmove",a,j),document.removeEventListener("touchstart",u,j)}},[]);var p=e.removeScrollBar,m=e.inert;return d.createElement(d.Fragment,null,m?d.createElement(i,{styles:"\n  .block-interactivity-".concat(o," {pointer-events: none;}\n  .allow-interactivity-").concat(o," {pointer-events: all;}\n")}):null,p?d.createElement(N,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},b.useMedium(c),x),Q=d.forwardRef(function(e,t){return d.createElement(w,u({},e,{ref:t,sideCar:X}))});Q.classNames=w.classNames;var K=Q},83:function(e,t,n){"use strict";/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var r=n(67294),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,s=r.useEffect,l=r.useLayoutEffect,a=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return l(function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})},[e,n,t]),s(function(){return c(o)&&u({inst:o}),e(function(){c(o)&&u({inst:o})})},[e]),a(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},61688:function(e,t,n){"use strict";e.exports=n(83)},87462:function(e,t,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}n.d(t,{Z:function(){return r}})},63366:function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}n.d(t,{Z:function(){return r}})},36206:function(e,t,n){"use strict";function r(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}n.d(t,{M:function(){return r}})},28771:function(e,t,n){"use strict";n.d(t,{F:function(){return i},e:function(){return s}});var r=n(67294);function o(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function i(...e){return t=>{let n=!1,r=e.map(e=>{let r=o(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():o(e[t],null)}}}}function s(...e){return r.useCallback(i(...e),e)}},25360:function(e,t,n){"use strict";n.d(t,{b:function(){return s},k:function(){return i}});var r=n(67294),o=n(85893);function i(e,t){let n=r.createContext(t),i=e=>{let{children:t,...i}=e,s=r.useMemo(()=>i,Object.values(i));return(0,o.jsx)(n.Provider,{value:s,children:t})};return i.displayName=e+"Provider",[i,function(o){let i=r.useContext(n);if(i)return i;if(void 0!==t)return t;throw Error(`\`${o}\` must be used within \`${e}\``)}]}function s(e,t=[]){let n=[],i=()=>{let t=n.map(e=>r.createContext(e));return function(n){let o=n?.[e]||t;return r.useMemo(()=>({[`__scope${e}`]:{...n,[e]:o}}),[n,o])}};return i.scopeName=e,[function(t,i){let s=r.createContext(i),l=n.length;n=[...n,i];let a=t=>{let{scope:n,children:i,...a}=t,c=n?.[e]?.[l]||s,u=r.useMemo(()=>a,Object.values(a));return(0,o.jsx)(c.Provider,{value:u,children:i})};return a.displayName=t+"Provider",[a,function(n,o){let a=o?.[e]?.[l]||s,c=r.useContext(a);if(c)return c;if(void 0!==i)return i;throw Error(`\`${n}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let o=n.reduce((t,{useScope:n,scopeName:r})=>{let o=n(e)[`__scope${r}`];return{...t,...o}},{});return r.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}(i,...t)]}},46063:function(e,t,n){"use strict";n.d(t,{XB:function(){return d}});var r,o=n(67294),i=n(36206),s=n(75320),l=n(28771),a=n(79698),c=n(85893),u="dismissableLayer.update",h=o.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),d=o.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:v,onDismiss:b,...y}=e,w=o.useContext(h),[x,k]=o.useState(null),S=x?.ownerDocument??globalThis?.document,[,C]=o.useState({}),O=(0,l.e)(t,e=>k(e)),E=Array.from(w.layers),[P]=[...w.layersWithOutsidePointerEventsDisabled].slice(-1),T=E.indexOf(P),M=x?E.indexOf(x):-1,A=w.layersWithOutsidePointerEventsDisabled.size>0,R=M>=T,_=function(e,t=globalThis?.document){let n=(0,a.W)(e),r=o.useRef(!1),i=o.useRef(()=>{});return o.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){p("dismissableLayer.pointerDownOutside",n,o,{discrete:!0})},o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=r,t.addEventListener("click",i.current,{once:!0})):r()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{let t=e.target,n=[...w.branches].some(e=>e.contains(t));!R||n||(m?.(e),v?.(e),e.defaultPrevented||b?.())},S),D=function(e,t=globalThis?.document){let n=(0,a.W)(e),r=o.useRef(!1);return o.useEffect(()=>{let e=e=>{e.target&&!r.current&&p("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{let t=e.target;[...w.branches].some(e=>e.contains(t))||(g?.(e),v?.(e),e.defaultPrevented||b?.())},S);return!function(e,t=globalThis?.document){let n=(0,a.W)(e);o.useEffect(()=>{let e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{M!==w.layers.size-1||(d?.(e),!e.defaultPrevented&&b&&(e.preventDefault(),b()))},S),o.useEffect(()=>{if(x)return n&&(0===w.layersWithOutsidePointerEventsDisabled.size&&(r=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),w.layersWithOutsidePointerEventsDisabled.add(x)),w.layers.add(x),f(),()=>{n&&1===w.layersWithOutsidePointerEventsDisabled.size&&(S.body.style.pointerEvents=r)}},[x,S,n,w]),o.useEffect(()=>()=>{x&&(w.layers.delete(x),w.layersWithOutsidePointerEventsDisabled.delete(x),f())},[x,w]),o.useEffect(()=>{let e=()=>C({});return document.addEventListener(u,e),()=>document.removeEventListener(u,e)},[]),(0,c.jsx)(s.WV.div,{...y,ref:O,style:{pointerEvents:A?R?"auto":"none":void 0,...e.style},onFocusCapture:(0,i.M)(e.onFocusCapture,D.onFocusCapture),onBlurCapture:(0,i.M)(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:(0,i.M)(e.onPointerDownCapture,_.onPointerDownCapture)})});function f(){let e=new CustomEvent(u);document.dispatchEvent(e)}function p(e,t,n,{discrete:r}){let o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?(0,s.jH)(o,i):o.dispatchEvent(i)}d.displayName="DismissableLayer",o.forwardRef((e,t)=>{let n=o.useContext(h),r=o.useRef(null),i=(0,l.e)(t,r);return o.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,c.jsx)(s.WV.div,{...e,ref:i})}).displayName="DismissableLayerBranch"},27552:function(e,t,n){"use strict";n.d(t,{EW:function(){return i}});var r=n(67294),o=0;function i(){r.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??s()),document.body.insertAdjacentElement("beforeend",e[1]??s()),o++,()=>{1===o&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),o--}},[])}function s(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}},95420:function(e,t,n){"use strict";let r;n.d(t,{M:function(){return d}});var o=n(67294),i=n(28771),s=n(75320),l=n(79698),a=n(85893),c="focusScope.autoFocusOnMount",u="focusScope.autoFocusOnUnmount",h={bubbles:!1,cancelable:!0},d=o.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:d,onUnmountAutoFocus:v,...b}=e,[y,w]=o.useState(null),x=(0,l.W)(d),k=(0,l.W)(v),S=o.useRef(null),C=(0,i.e)(t,e=>w(e)),O=o.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;o.useEffect(()=>{if(r){let e=function(e){if(O.paused||!y)return;let t=e.target;y.contains(t)?S.current=t:m(S.current,{select:!0})},t=function(e){if(O.paused||!y)return;let t=e.relatedTarget;null===t||y.contains(t)||m(S.current,{select:!0})};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&m(y)});return y&&n.observe(y,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[r,y,O.paused]),o.useEffect(()=>{if(y){g.add(O);let e=document.activeElement;if(!y.contains(e)){let t=new CustomEvent(c,h);y.addEventListener(c,x),y.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(m(r,{select:t}),document.activeElement!==n)return}(f(y).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&m(y))}return()=>{y.removeEventListener(c,x),setTimeout(()=>{let t=new CustomEvent(u,h);y.addEventListener(u,k),y.dispatchEvent(t),t.defaultPrevented||m(e??document.body,{select:!0}),y.removeEventListener(u,k),g.remove(O)},0)}}},[y,x,k,O]);let E=o.useCallback(e=>{if(!n&&!r||O.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){let t=e.currentTarget,[r,i]=function(e){let t=f(e);return[p(t,e),p(t.reverse(),e)]}(t);r&&i?e.shiftKey||o!==i?e.shiftKey&&o===r&&(e.preventDefault(),n&&m(i,{select:!0})):(e.preventDefault(),n&&m(r,{select:!0})):o===t&&e.preventDefault()}},[n,r,O.paused]);return(0,a.jsx)(s.WV.div,{tabIndex:-1,...b,ref:C,onKeyDown:E})});function f(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function p(e,t){for(let n of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n,{upTo:t}))return n}function m(e,{select:t=!1}={}){if(e&&e.focus){var n;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(n=e)instanceof HTMLInputElement&&"select"in n&&t&&e.select()}}d.displayName="FocusScope";var g=(r=[],{add(e){let t=r[0];e!==t&&t?.pause(),(r=v(r,e)).unshift(e)},remove(e){r=v(r,e),r[0]?.resume()}});function v(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}},91276:function(e,t,n){"use strict";n.d(t,{M:function(){return a}});var r,o=n(67294),i=n(9981),s=(r||(r=n.t(o,2)))[" useId ".trim().toString()]||(()=>void 0),l=0;function a(e){let[t,n]=o.useState(s());return(0,i.b)(()=>{e||n(e=>e??String(l++))},[e]),e||(t?`radix-${t}`:"")}},42651:function(e,t,n){"use strict";n.d(t,{h:function(){return a}});var r=n(67294),o=n(73935),i=n(75320),s=n(9981),l=n(85893),a=r.forwardRef((e,t)=>{let{container:n,...a}=e,[c,u]=r.useState(!1);(0,s.b)(()=>u(!0),[]);let h=n||c&&globalThis?.document?.body;return h?o.createPortal((0,l.jsx)(i.WV.div,{...a,ref:t}),h):null});a.displayName="Portal"},75320:function(e,t,n){"use strict";n.d(t,{WV:function(){return l},jH:function(){return a}});var r=n(67294),o=n(73935),i=n(88426),s=n(85893),l=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,i.Z8)(`Primitive.${t}`),o=r.forwardRef((e,r)=>{let{asChild:o,...i}=e,l=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(l,{...i,ref:r})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function a(e,t){e&&o.flushSync(()=>e.dispatchEvent(t))}},88426:function(e,t,n){"use strict";n.d(t,{Z8:function(){return s},g7:function(){return l}});var r=n(67294),o=n(28771),i=n(85893);function s(e){let t=function(e){let t=r.forwardRef((e,t)=>{let{children:n,...i}=e;if(r.isValidElement(n)){let e,s;let l=(e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?n.props.ref:n.props.ref||n.ref,a=function(e,t){let n={...t};for(let r in t){let o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{let t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(i,n.props);return n.type!==r.Fragment&&(a.ref=t?(0,o.F)(t,l):l),r.cloneElement(n,a)}return r.Children.count(n)>1?r.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}(e),n=r.forwardRef((e,n)=>{let{children:o,...s}=e,l=r.Children.toArray(o),a=l.find(c);if(a){let e=a.props.children,o=l.map(t=>t!==a?t:r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null);return(0,i.jsx)(t,{...s,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,o):null})}return(0,i.jsx)(t,{...s,ref:n,children:o})});return n.displayName=`${e}.Slot`,n}var l=s("Slot"),a=Symbol("radix.slottable");function c(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===a}},79698:function(e,t,n){"use strict";n.d(t,{W:function(){return o}});var r=n(67294);function o(e){let t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...e)=>t.current?.(...e),[])}},77342:function(e,t,n){"use strict";n.d(t,{T:function(){return l}});var r,o=n(67294),i=n(9981),s=(r||(r=n.t(o,2)))[" useInsertionEffect ".trim().toString()]||i.b;function l({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,l,a]=function({defaultProp:e,onChange:t}){let[n,r]=o.useState(e),i=o.useRef(n),l=o.useRef(t);return s(()=>{l.current=t},[t]),o.useEffect(()=>{i.current!==n&&(l.current?.(n),i.current=n)},[n,i]),[n,r,l]}({defaultProp:t,onChange:n}),c=void 0!==e,u=c?e:i;{let t=o.useRef(void 0!==e);o.useEffect(()=>{let e=t.current;if(e!==c){let t=c?"controlled":"uncontrolled";console.warn(`${r} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,r])}return[u,o.useCallback(t=>{if(c){let n="function"==typeof t?t(e):t;n!==e&&a.current?.(n)}else l(t)},[c,e,l,a])]}Symbol("RADIX:SYNC_STATE")},9981:function(e,t,n){"use strict";n.d(t,{b:function(){return o}});var r=n(67294),o=globalThis?.document?r.useLayoutEffect:()=>{}},12003:function(e,t,n){"use strict";n.d(t,{j:function(){return s}});var r=n(90512);let o=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=r.W,s=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return i(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:s,defaultVariants:l}=t,a=Object.keys(s).map(e=>{let t=null==n?void 0:n[e],r=null==l?void 0:l[e];if(null===t)return null;let i=o(t)||o(r);return s[e][i]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return i(e,a,null==t?void 0:null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...o}=t;return Object.entries(o).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...l,...c}[t]):({...l,...c})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}},90512:function(e,t,n){"use strict";function r(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=function e(t){var n,r,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t){if(Array.isArray(t)){var i=t.length;for(n=0;n<i;n++)t[n]&&(r=e(t[n]))&&(o&&(o+=" "),o+=r)}else for(r in t)t[r]&&(o&&(o+=" "),o+=r)}return o}(e))&&(r&&(r+=" "),r+=t);return r}n.d(t,{W:function(){return r}}),t.Z=r},68588:function(e,t,n){"use strict";n.d(t,{M:function(){return r}});let r="data-"+(0,n(93193).D)("framerAppearId")},2445:function(e,t,n){"use strict";function r(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}n.d(t,{H:function(){return r}})},9442:function(e,t,n){"use strict";n.d(t,{featureDefinitions:function(){return o}});let r={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},o={};for(let e in r)o[e]={isEnabled:t=>r[e].some(e=>!!t[e])}},96728:function(e,t,n){"use strict";n.d(t,{j:function(){return i}});var r=n(59354);let o={};function i(e,{layout:t,layoutId:n}){return r.G.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!o[e]||"opacity"===e)}},93193:function(e,t,n){"use strict";n.d(t,{D:function(){return r}});let r=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase()},62627:function(e,t,n){"use strict";n.d(t,{q:function(){return o}});let r=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function o(e){if("string"!=typeof e||e.includes("-"));else if(r.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}},41069:function(e,t,n){"use strict";n.d(t,{r:function(){return c}});var r=n(59354),o=n(21219);let i=(e,t)=>t&&"number"==typeof e?t.transform(e):e;var s=n(20354);let l={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},a=r._.length;function c(e,t,n){let{style:c,vars:u,transformOrigin:h}=e,d=!1,f=!1;for(let e in t){let n=t[e];if(r.G.has(e)){d=!0;continue}if((0,o.f)(e)){u[e]=n;continue}{let t=i(n,s.j[e]);e.startsWith("origin")?(f=!0,h[e]=t):c[e]=t}}if(!t.transform&&(d||n?c.transform=function(e,t,n){let o="",c=!0;for(let u=0;u<a;u++){let a=r._[u],h=e[a];if(void 0===h)continue;let d=!0;if(!(d="number"==typeof h?h===(a.startsWith("scale")?1:0):0===parseFloat(h))||n){let e=i(h,s.j[a]);if(!d){c=!1;let t=l[a]||a;o+=`${t}(${e}) `}n&&(t[a]=e)}}return o=o.trim(),n?o=n(t,c?"":o):c&&(o="none"),o}(t,e.transform,n):c.transform&&(c.transform="none")),f){let{originX:e="50%",originY:t="50%",originZ:n=0}=h;c.transformOrigin=`${e} ${t} ${n}`}}},50189:function(e,t,n){"use strict";n.d(t,{U:function(){return i}});var r=n(32558),o=n(96728);function i(e,t,n){let{style:i}=e,s={};for(let l in i)((0,r.i)(i[l])||t.style&&(0,r.i)(t.style[l])||(0,o.j)(l,e)||n?.getValue(l)?.liveStyle!==void 0)&&(s[l]=i[l]);return s}},42617:function(e,t,n){"use strict";n.d(t,{i:function(){return l}});var r=n(41069),o=n(37259);let i={offset:"stroke-dashoffset",array:"stroke-dasharray"},s={offset:"strokeDashoffset",array:"strokeDasharray"};function l(e,{attrX:t,attrY:n,attrScale:l,pathLength:a,pathSpacing:c=1,pathOffset:u=0,...h},d,f,p){if((0,r.r)(e,h,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:m,style:g}=e;m.transform&&(g.transform=m.transform,delete m.transform),(g.transform||m.transformOrigin)&&(g.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),g.transform&&(g.transformBox=p?.transformBox??"fill-box",delete m.transformBox),void 0!==t&&(m.x=t),void 0!==n&&(m.y=n),void 0!==l&&(m.scale=l),void 0!==a&&function(e,t,n=1,r=0,l=!0){e.pathLength=1;let a=l?i:s;e[a.offset]=o.px.transform(-r);let c=o.px.transform(t),u=o.px.transform(n);e[a.array]=`${c} ${u}`}(m,a,c,u,!1)}},79854:function(e,t,n){"use strict";n.d(t,{a:function(){return r}});let r=e=>"string"==typeof e&&"svg"===e.toLowerCase()},16832:function(e,t,n){"use strict";n.d(t,{U:function(){return s}});var r=n(32558),o=n(59354),i=n(50189);function s(e,t,n){let s=(0,i.U)(e,t,n);for(let n in e)((0,r.i)(e[n])||(0,r.i)(t[n]))&&(s[-1!==o._.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]);return s}},7504:function(e,t,n){"use strict";n.d(t,{G:function(){return s},M:function(){return l}});var r=n(2445),o=n(97732),i=n(22963);function s(e){return(0,r.H)(e.animate)||i.V.some(t=>(0,o.$)(e[t]))}function l(e){return!!(s(e)||e.variants)}},97732:function(e,t,n){"use strict";function r(e){return"string"==typeof e||Array.isArray(e)}n.d(t,{$:function(){return r}})},79432:function(e,t,n){"use strict";function r(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function o(e,t,n,o){if("function"==typeof t){let[i,s]=r(o);t=t(void 0!==n?n:e.custom,i,s)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,s]=r(o);t=t(void 0!==n?n:e.custom,i,s)}return t}n.d(t,{o:function(){return o}})},22963:function(e,t,n){"use strict";n.d(t,{V:function(){return o},e:function(){return r}});let r=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],o=["initial",...r]},11741:function(e,t,n){"use strict";n.d(t,{j:function(){return r}});let r="undefined"!=typeof window},21219:function(e,t,n){"use strict";n.d(t,{f:function(){return o},t:function(){return s}});let r=e=>t=>"string"==typeof t&&t.startsWith(e),o=r("--"),i=r("var(--"),s=e=>!!i(e)&&l.test(e.split("/*")[0].trim()),l=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu},93674:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(42218);let o=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];var i=n(57275);function s(e,t){let n=!1,s=!0,l={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,c=o.reduce((e,n)=>(e[n]=function(e,t){let n=new Set,r=new Set,o=!1,s=!1,l=new WeakSet,a={delta:0,timestamp:0,isProcessing:!1},c=0;function u(t){l.has(t)&&(h.schedule(t),e()),c++,t(a)}let h={schedule:(e,t=!1,i=!1)=>{let s=i&&o?n:r;return t&&l.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),l.delete(e)},process:e=>{if(a=e,o){s=!0;return}o=!0,[n,r]=[r,n],n.forEach(u),t&&i.f.value&&i.f.value.frameloop[t].push(c),c=0,n.clear(),o=!1,s&&(s=!1,h.process(e))}};return h}(a,t?n:void 0),e),{}),{setup:u,read:h,resolveKeyframes:d,preUpdate:f,update:p,preRender:m,render:g,postRender:v}=c,b=()=>{let o=r.c.useManualTiming?l.timestamp:performance.now();n=!1,r.c.useManualTiming||(l.delta=s?1e3/60:Math.max(Math.min(o-l.timestamp,40),1)),l.timestamp=o,l.isProcessing=!0,u.process(l),h.process(l),d.process(l),f.process(l),p.process(l),m.process(l),g.process(l),v.process(l),l.isProcessing=!1,n&&t&&(s=!1,e(b))},y=()=>{n=!0,s=!0,l.isProcessing||e(b)};return{schedule:o.reduce((e,t)=>{let r=c[t];return e[t]=(e,t=!1,o=!1)=>(n||y(),r.schedule(e,t,o)),e},{}),cancel:e=>{for(let t=0;t<o.length;t++)c[o[t]].cancel(e)},state:l,steps:c}}},59354:function(e,t,n){"use strict";n.d(t,{G:function(){return o},_:function(){return r}});let r=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],o=new Set(r)},57275:function(e,t,n){"use strict";n.d(t,{f:function(){return r}});let r={value:null,addProjectionMetrics:null}},77596:function(e,t,n){"use strict";function r(e){return"object"==typeof e&&null!==e&&"offsetHeight"in e}n.d(t,{R:function(){return r}})},20354:function(e,t,n){"use strict";n.d(t,{j:function(){return l}});var r=n(57958);let o={...r.Rx,transform:Math.round};var i=n(37259);let s={rotate:i.RW,rotateX:i.RW,rotateY:i.RW,rotateZ:i.RW,scale:r.bA,scaleX:r.bA,scaleY:r.bA,scaleZ:r.bA,skew:i.RW,skewX:i.RW,skewY:i.RW,distance:i.px,translateX:i.px,translateY:i.px,translateZ:i.px,x:i.px,y:i.px,z:i.px,perspective:i.px,transformPerspective:i.px,opacity:r.Fq,originX:i.$C,originY:i.$C,originZ:i.px},l={borderWidth:i.px,borderTopWidth:i.px,borderRightWidth:i.px,borderBottomWidth:i.px,borderLeftWidth:i.px,borderRadius:i.px,radius:i.px,borderTopLeftRadius:i.px,borderTopRightRadius:i.px,borderBottomRightRadius:i.px,borderBottomLeftRadius:i.px,width:i.px,maxWidth:i.px,height:i.px,maxHeight:i.px,top:i.px,right:i.px,bottom:i.px,left:i.px,padding:i.px,paddingTop:i.px,paddingRight:i.px,paddingBottom:i.px,paddingLeft:i.px,margin:i.px,marginTop:i.px,marginRight:i.px,marginBottom:i.px,marginLeft:i.px,backgroundPositionX:i.px,backgroundPositionY:i.px,...s,zIndex:o,fillOpacity:r.Fq,strokeOpacity:r.Fq,numOctaves:o}},57958:function(e,t,n){"use strict";n.d(t,{Fq:function(){return i},Rx:function(){return o},bA:function(){return s}});var r=n(488);let o={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},i={...o,transform:e=>(0,r.u)(0,1,e)},s={...o,default:1}},37259:function(e,t,n){"use strict";n.d(t,{$C:function(){return c},RW:function(){return o},aQ:function(){return i},px:function(){return s},vh:function(){return l},vw:function(){return a}});let r=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),o=r("deg"),i=r("%"),s=r("px"),l=r("vh"),a=r("vw"),c={...i,parse:e=>i.parse(e)/100,transform:e=>i.transform(100*e)}},32558:function(e,t,n){"use strict";n.d(t,{i:function(){return r}});let r=e=>!!(e&&e.getVelocity)},488:function(e,t,n){"use strict";n.d(t,{u:function(){return r}});let r=(e,t,n)=>n>t?t:n<e?e:n},42218:function(e,t,n){"use strict";n.d(t,{c:function(){return r}});let r={}}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[774,179],function(){return t(91118),t(26036)}),_N_E=e.O()}]);