@mmmbuto/nexuscli 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8605,7 +8605,7 @@ l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
8605
8605
  `},d]}}const Zxe=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Xxe=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Yxe=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Qxe=[...Xxe,...Yxe],Jxe=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),tH=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),nH=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),ewe=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),twe=tH.concat(nH).sort().reverse();function nwe(e){const t=Zxe(e),n=twe,a="and or not only",r="[\\w-]+",i="("+r+"|@\\{"+r+"\\})",o=[],c=[],l=function(w){return{className:"string",begin:"~?"+w+".*?"+w}},d=function(w,C,z){return{className:w,begin:C,relevance:z}},u={$pattern:/[a-z-]+/,keyword:a,attribute:Jxe.join(" ")},h={begin:"\\(",end:"\\)",contains:c,keywords:u,relevance:0};c.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,h,d("variable","@@?"+r,10),d("variable","@\\{"+r+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const p=c.concat({begin:/\{/,end:/\}/,contains:o}),y={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(c)},k={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ewe.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:c}}]},M={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:c,relevance:0}},S={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:p}},v={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,y,d("keyword","all\\b"),d("variable","@\\{"+r+"\\}"),{begin:"\\b("+Qxe.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,d("selector-tag",i,0),d("selector-id","#"+i),d("selector-class","\\."+i,0),d("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+tH.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+nH.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:p},{begin:"!important"},t.FUNCTION_DISPATCH]},g={begin:r+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[v]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,M,S,g,k,v,y,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function awe(e){const t="\\[=*\\[",n="\\]=*\\]",a={begin:t,end:n,contains:["self"]},r=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[a],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:r.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:r}].concat(r)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[a],relevance:5}])}}function rwe(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},a={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},r={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,a,r,i,o]}}function iwe(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},a={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},c=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,c,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=e.inherit(d,{contains:[]}),p=e.inherit(u,{contains:[]});d.contains.push(p),u.contains.push(h);let y=[n,l];return[d,u,h,p].forEach(v=>{v.contains=v.contains.concat(y)}),y=y.concat(d,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:y},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:y}]}]},n,i,d,u,{className:"quote",begin:"^>\\s+",contains:y,end:"$"},r,a,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function owe(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,c={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:c,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function swe(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],a=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},o={begin:/->\{/,end:/\}/},c={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[c]},d={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,i,l],h=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],p=(M,S,v="\\1")=>{const g=v==="\\1"?v:t.concat(v,S);return t.concat(t.concat("(?:",M,")"),S,/(?:\\.|[^\\\/])*?/,g,/(?:\\.|[^\\\/])*?/,v,a)},y=(M,S,v)=>t.concat(t.concat("(?:",M,")"),S,/(?:\\.|[^\\\/])*?/,v,a),k=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},d,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:p("s|tr|y",t.either(...h,{capture:!0}))},{begin:p("s|tr|y","\\(","\\)")},{begin:p("s|tr|y","\\[","\\]")},{begin:p("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:y("(?:m|qr)?",/\//,/\//)},{begin:y("m|qr",t.either(...h,{capture:!0}),/\1/)},{begin:y("m|qr",/\(/,/\)/)},{begin:y("m|qr",/\[/,/\]/)},{begin:y("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,c]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,c,d]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=k,o.contains=k,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:k}}function cwe(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,a=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),r=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+a},c={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),h={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(J,re)=>{re.data._beginMatch=J[1]||J[2]},"on:end":(J,re)=>{re.data._beginMatch!==J[1]&&re.ignoreMatch()}},p=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),y=`[
8606
8606
  ]`,k={scope:"string",variants:[u,d,h,p]},M={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},S=["false","null","true"],v=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],g=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],C={keyword:v,literal:(J=>{const re=[];return J.forEach(H=>{re.push(H),H.toLowerCase()===H?re.push(H.toUpperCase()):re.push(H.toLowerCase())}),re})(S),built_in:g},z=J=>J.map(re=>re.replace(/\|\d+$/,"")),N={variants:[{match:[/new/,t.concat(y,"+"),t.concat("(?!",z(g).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},E=t.concat(a,"\\b(?!\\()"),D={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),E],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class\b)/)),E],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},B={scope:"attr",match:t.concat(a,t.lookahead(":"),t.lookahead(/(?!::)/))},$={relevance:0,begin:/\(/,end:/\)/,keywords:C,contains:[B,o,D,e.C_BLOCK_COMMENT_MODE,k,M,N]},F={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",z(v).join("\\b|"),"|",z(g).join("\\b|"),"\\b)"),a,t.concat(y,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[$]};$.contains.push(F);const U=[B,D,e.C_BLOCK_COMMENT_MODE,k,M,N],de={begin:t.concat(/#\[\s*\\?/,t.either(r,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:S,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:S,keyword:["new","array"]},contains:["self",...U]},...U,{scope:"meta",variants:[{match:r},{match:i}]}]};return{case_insensitive:!1,keywords:C,contains:[de,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},c,{scope:"variable.language",match:/\$this\b/},o,F,D,{match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},N,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:C,contains:["self",de,o,D,e.C_BLOCK_COMMENT_MODE,k,M]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},k,M]}}function lwe(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function dwe(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function uwe(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},u={begin:/\{\{/,relevance:0},h={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,d]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},p="[0-9](_?[0-9])*",y=`(\\b(${p}))?\\.(${p})|\\b(${p})\\.`,k=`\\b|${a.join("|")}`,M={className:"number",relevance:0,variants:[{begin:`(\\b(${p})|(${y}))[eE][+-]?(${p})[jJ]?(?=${k})`},{begin:`(${y})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${k})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${k})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${k})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${k})`},{begin:`\\b(${p})[jJ](?=${k})`}]},S={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},v={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",l,M,h,e.HASH_COMMENT_MODE]}]};return d.contains=[h,M,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[l,M,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,S,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[v]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[M,v,h]}]}}function hwe(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function pwe(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[r,a]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[i,a]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function ywe(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=t.concat(a,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},c={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},d=[e.COMMENT("#","$",{contains:[c]}),e.COMMENT("^=begin","^=end",{contains:[c],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},h={className:"string",contains:[e.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,u]})]}]},p="[1-9](_?[0-9])*|0",y="[0-9](_?[0-9])*",k={className:"number",relevance:0,variants:[{begin:`\\b(${p})(\\.(${y}))?([eE][+-]?(${y})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},M={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},N=[h,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:o},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[M]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:n}],relevance:0},k,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,d),relevance:0}].concat(l,d);u.contains=N,M.contains=N;const $=[{begin:/^\s*=>/,starts:{end:"$",contains:N}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:N}}];return d.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat($).concat(d).concat(N)}}function fwe(e){const t=e.regex,n=/(r#)?/,a=t.concat(n,e.UNDERSCORE_IDENT_RE),r=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,r,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",c=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:u,keyword:c,literal:l,built_in:d},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,a],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,a],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,a,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:u}},{className:"punctuation",begin:"->"},i]}}const mwe=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),kwe=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],gwe=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],vwe=[...kwe,...gwe],Mwe=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),xwe=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),wwe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),bwe=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _we(e){const t=mwe(e),n=wwe,a=xwe,r="@[a-z-]+",i="and or not only",c={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+vwe.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+a.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},c,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+bwe.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,c,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Mwe.join(" ")},contains:[{begin:r,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},c,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function Swe(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Lwe(e){const t=e.regex,n=e.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],c=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],p=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],y=u,k=[...d,...l].filter(z=>!u.includes(z)),M={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},S={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},v={match:t.concat(/\b/,t.either(...y),/\s*\(/),relevance:0,keywords:{built_in:y}};function g(z){return t.concat(/\b/,t.either(...z.map(N=>N.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:g(p),relevance:0};function C(z,{exceptions:N,when:E}={}){const D=E;return N=N||[],z.map(B=>B.match(/\|\d+$/)||N.includes(B)?B:D(B)?`${B}|0`:B)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:C(k,{when:z=>z.length<3}),literal:i,type:c,built_in:h},contains:[{scope:"type",match:g(o)},w,v,M,a,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,S]}}function aH(e){return e?typeof e=="string"?e:e.source:null}function Ys(e){return He("(?=",e,")")}function He(...e){return e.map(n=>aH(n)).join("")}function Nwe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Rt(...e){return"("+(Nwe(e).capture?"":"?:")+e.map(a=>aH(a)).join("|")+")"}const Uz=e=>He(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Cwe=["Protocol","Type"].map(Uz),XO=["init","self"].map(Uz),Iwe=["Any","Self"],BA=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],YO=["false","nil","true"],Awe=["assignment","associativity","higherThan","left","lowerThan","none","right"],Ewe=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],QO=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],rH=Rt(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),iH=Rt(rH,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),HA=He(rH,iH,"*"),oH=Rt(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),JC=Rt(oH,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Wn=He(oH,JC,"*"),Bl=He(/[A-Z]/,JC,"*"),Twe=["attached","autoclosure",He(/convention\(/,Rt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",He(/objc\(/,Wn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],zwe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function $we(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,n],r={match:[/\./,Rt(...Cwe,...XO)],className:{2:"keyword"}},i={match:He(/\./,Rt(...BA)),relevance:0},o=BA.filter(Le=>typeof Le=="string").concat(["_|0"]),c=BA.filter(Le=>typeof Le!="string").concat(Iwe).map(Uz),l={variants:[{className:"keyword",match:Rt(...c,...XO)}]},d={$pattern:Rt(/\b\w+/,/#\w+/),keyword:o.concat(Ewe),literal:YO},u=[r,i,l],h={match:He(/\./,Rt(...QO)),relevance:0},p={className:"built_in",match:He(/\b/,Rt(...QO),/(?=\()/)},y=[h,p],k={match:/->/,relevance:0},M={className:"operator",relevance:0,variants:[{match:HA},{match:`\\.(\\.|${iH})+`}]},S=[k,M],v="([0-9]_*)+",g="([0-9a-fA-F]_*)+",w={className:"number",relevance:0,variants:[{match:`\\b(${v})(\\.(${v}))?([eE][+-]?(${v}))?\\b`},{match:`\\b0x(${g})(\\.(${g}))?([pP][+-]?(${v}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},C=(Le="")=>({className:"subst",variants:[{match:He(/\\/,Le,/[0\\tnr"']/)},{match:He(/\\/,Le,/u\{[0-9a-fA-F]{1,8}\}/)}]}),z=(Le="")=>({className:"subst",match:He(/\\/,Le,/[\t ]*(?:[\r\n]|\r\n)/)}),N=(Le="")=>({className:"subst",label:"interpol",begin:He(/\\/,Le,/\(/),end:/\)/}),E=(Le="")=>({begin:He(Le,/"""/),end:He(/"""/,Le),contains:[C(Le),z(Le),N(Le)]}),D=(Le="")=>({begin:He(Le,/"/),end:He(/"/,Le),contains:[C(Le),N(Le)]}),B={className:"string",variants:[E(),E("#"),E("##"),E("###"),D(),D("#"),D("##"),D("###")]},$=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],F={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:$},U=Le=>{const St=He(Le,/\//),fe=He(/\//,Le);return{begin:St,end:fe,contains:[...$,{scope:"comment",begin:`#(?!.*${fe})`,end:/$/}]}},de={scope:"regexp",variants:[U("###"),U("##"),U("#"),F]},J={match:He(/`/,Wn,/`/)},re={className:"variable",match:/\$\d+/},H={className:"variable",match:`\\$${JC}+`},K=[J,re,H],P={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:zwe,contains:[...S,w,B]}]}},G={scope:"keyword",match:He(/@/,Rt(...Twe),Ys(Rt(/\(/,/\s+/)))},L={scope:"meta",match:He(/@/,Wn)},ie=[P,G,L],se={match:Ys(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:He(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,JC,"+")},{className:"type",match:Bl,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:He(/\s+&\s+/,Ys(Bl)),relevance:0}]},T={begin:/</,end:/>/,keywords:d,contains:[...a,...u,...ie,k,se]};se.contains.push(T);const ge={match:He(Wn,/\s*:/),keywords:"_|0",relevance:0},be={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",ge,...a,de,...u,...y,...S,w,B,...K,...ie,se]},_e={begin:/</,end:/>/,keywords:"repeat each",contains:[...a,se]},Fe={begin:Rt(Ys(He(Wn,/\s*:/)),Ys(He(Wn,/\s+/,Wn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Wn}]},ae={begin:/\(/,end:/\)/,keywords:d,contains:[Fe,...a,...u,...S,w,B,...ie,se,be],endsParent:!0,illegal:/["']/},we={match:[/(func|macro)/,/\s+/,Rt(J.match,Wn,HA)],className:{1:"keyword",3:"title.function"},contains:[_e,ae,t],illegal:[/\[/,/%/]},Ae={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[_e,ae,t],illegal:/\[|%/},Ee={match:[/operator/,/\s+/,HA],className:{1:"keyword",3:"title"}},Ge={begin:[/precedencegroup/,/\s+/,Bl],className:{1:"keyword",3:"title"},contains:[se],keywords:[...Awe,...YO],end:/}/},We={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},lt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Be={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Wn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[_e,...u,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:Bl},...u],relevance:0}]};for(const Le of B.variants){const St=Le.contains.find(Jt=>Jt.label==="interpol");St.keywords=d;const fe=[...u,...y,...S,w,B,...K];St.contains=[...fe,{begin:/\(/,end:/\)/,contains:["self",...fe]}]}return{name:"Swift",keywords:d,contains:[...a,we,Ae,We,lt,Be,Ee,Ge,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0},de,...u,...y,...S,w,B,...K,...ie,se,be]}}const eI="[A-Za-z$_][0-9A-Za-z$_]*",sH=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],cH=["true","false","null","undefined","NaN","Infinity"],lH=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],dH=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],uH=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],hH=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],pH=[].concat(uH,lH,dH);function Rwe(e){const t=e.regex,n=(P,{after:G})=>{const L="</"+P[0].slice(1);return P.input.indexOf(L,G)!==-1},a=eI,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,G)=>{const L=P[0].length+P.index,ie=P.input[L];if(ie==="<"||ie===","){G.ignoreMatch();return}ie===">"&&(n(P,{after:L})||G.ignoreMatch());let se;const T=P.input.substring(L);if(se=T.match(/^\s*=/)){G.ignoreMatch();return}if((se=T.match(/^\s+extends\s+/))&&se.index===0){G.ignoreMatch();return}}},c={$pattern:eI,keyword:sH,literal:cH,built_in:pH,"variable.language":hH},l="[0-9](_?[0-9])*",d=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},k={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"css"}},M={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,p]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:a+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,k,M,S,{match:/\$\d+/},h];p.contains=w.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(w)});const C=[].concat(g,p.contains),z=C.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(C)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:z},E={variants:[{match:[/class/,/\s+/,a,/\s+/,/extends/,/\s+/,t.concat(a,"(",t.concat(/\./,a),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,a],scope:{1:"keyword",3:"title.class"}}]},D={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...lH,...dH]}},B={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(P){return t.concat("(?!",P.join("|"),")")}const de={match:t.concat(/\b/,U([...uH,"super","import"].map(P=>`${P}\\s*\\(`)),a,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},J={begin:t.concat(/\./,t.lookahead(t.concat(a,/(?![0-9A-Za-z$_(])/))),end:a,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},re={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},H="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(H)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:z,CLASS_REFERENCE:D},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),B,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,k,M,S,g,{match:/\$\d+/},h,D,{scope:"attr",match:a+t.lookahead(":"),relevance:0},K,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:H,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:z}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:a,className:"title.function"})]},{match:/\.\.\./,relevance:0},J,{match:"\\$"+a,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},de,F,E,re,{match:/\$[(.]/}]}}function Owe(e){const t=e.regex,n=Rwe(e),a=eI,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:eI,keyword:sH.concat(l),literal:cH,built_in:pH.concat(r),"variable.language":hH},u={className:"meta",begin:"@"+a},h=(M,S,v)=>{const g=M.contains.findIndex(w=>w.label===S);if(g===-1)throw new Error("can not find mode to replace");M.contains.splice(g,1,v)};Object.assign(n.keywords,d),n.exports.PARAMS_CONTAINS.push(u);const p=n.contains.find(M=>M.scope==="attr"),y=Object.assign({},p,{match:t.concat(a,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,p,y]),n.contains=n.contains.concat([u,i,o,y]),h(n,"shebang",e.SHEBANG()),h(n,"use_strict",c);const k=n.contains.find(M=>M.label==="func.def");return k.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Dwe(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},a={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,c=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,r),/ *#/)},{begin:t.concat(/# */,c,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(i,r),/ +/,t.either(o,c),/ *#/)}]},d={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},h=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),p=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,a,l,d,u,h,p,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[p]}]}}function Pwe(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),a=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},c={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:a},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,o,r,e.QUOTE_STRING_MODE,l,d,c]}}function qwe(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:a,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,c,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,c]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Fwe(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},c=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),p={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},y={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},k={begin:/\{/,end:/\}/,contains:[y],illegal:"\\n",relevance:0},M={begin:"\\[",end:"\\]",contains:[y],illegal:"\\n",relevance:0},S=[a,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},p,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},k,M,i,o],v=[...S];return v.pop(),v.push(c),y.contains=v,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:S}}const Bwe={arduino:wxe,bash:bxe,c:_xe,cpp:Sxe,csharp:Lxe,css:Rxe,diff:Oxe,go:Dxe,graphql:Pxe,ini:qxe,java:Fxe,javascript:Uxe,json:Gxe,kotlin:Kxe,less:nwe,lua:awe,makefile:rwe,markdown:iwe,objectivec:owe,perl:swe,php:cwe,"php-template":lwe,plaintext:dwe,python:uwe,"python-repl":hwe,r:pwe,ruby:ywe,rust:fwe,scss:_we,shell:Swe,sql:Lwe,swift:$we,typescript:Owe,vbnet:Dwe,wasm:Pwe,xml:qwe,yaml:Fwe};function yH(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],a=typeof n;(a==="object"||a==="function")&&!Object.isFrozen(n)&&yH(n)}),e}class JO{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function fH(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Va(e,...t){const n=Object.create(null);for(const a in e)n[a]=e[a];return t.forEach(function(a){for(const r in a)n[r]=a[r]}),n}const Hwe="</span>",eD=e=>!!e.scope,jwe=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((a,r)=>`${a}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`};class Vwe{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=fH(t)}openNode(t){if(!eD(t))return;const n=jwe(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){eD(t)&&(this.buffer+=Hwe)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const tD=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Gz{constructor(){this.rootNode=tD(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=tD({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(a=>this._walk(t,a)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{Gz._collapse(n)}))}}class Uwe extends Gz{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const a=t.root;n&&(a.scope=`language:${n}`),this.add(a)}toHTML(){return new Vwe(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Hc(e){return e?typeof e=="string"?e:e.source:null}function mH(e){return U0("(?=",e,")")}function Gwe(e){return U0("(?:",e,")*")}function Wwe(e){return U0("(?:",e,")?")}function U0(...e){return e.map(n=>Hc(n)).join("")}function Kwe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Wz(...e){return"("+(Kwe(e).capture?"":"?:")+e.map(a=>Hc(a)).join("|")+")"}function kH(e){return new RegExp(e.toString()+"|").exec("").length-1}function Zwe(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Xwe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Kz(e,{joinWith:t}){let n=0;return e.map(a=>{n+=1;const r=n;let i=Hc(a),o="";for(;i.length>0;){const c=Xwe.exec(i);if(!c){o+=i;break}o+=i.substring(0,c.index),i=i.substring(c.index+c[0].length),c[0][0]==="\\"&&c[1]?o+="\\"+String(Number(c[1])+r):(o+=c[0],c[0]==="("&&n++)}return o}).map(a=>`(${a})`).join(t)}const Ywe=/\b\B/,gH="[a-zA-Z]\\w*",Zz="[a-zA-Z_]\\w*",vH="\\b\\d+(\\.\\d+)?",MH="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",xH="\\b(0b[01]+)",Qwe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Jwe=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=U0(t,/.*\b/,e.binary,/\b.*/)),Va({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,a)=>{n.index!==0&&a.ignoreMatch()}},e)},jc={begin:"\\\\[\\s\\S]",relevance:0},ebe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[jc]},tbe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[jc]},nbe={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},DI=function(e,t,n={}){const a=Va({scope:"comment",begin:e,end:t,contains:[]},n);a.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const r=Wz("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return a.contains.push({begin:U0(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a},abe=DI("//","$"),rbe=DI("/\\*","\\*/"),ibe=DI("#","$"),obe={scope:"number",begin:vH,relevance:0},sbe={scope:"number",begin:MH,relevance:0},cbe={scope:"number",begin:xH,relevance:0},lbe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[jc,{begin:/\[/,end:/\]/,relevance:0,contains:[jc]}]},dbe={scope:"title",begin:gH,relevance:0},ube={scope:"title",begin:Zz,relevance:0},hbe={begin:"\\.\\s*"+Zz,relevance:0},pbe=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var Hl=Object.freeze({__proto__:null,APOS_STRING_MODE:ebe,BACKSLASH_ESCAPE:jc,BINARY_NUMBER_MODE:cbe,BINARY_NUMBER_RE:xH,COMMENT:DI,C_BLOCK_COMMENT_MODE:rbe,C_LINE_COMMENT_MODE:abe,C_NUMBER_MODE:sbe,C_NUMBER_RE:MH,END_SAME_AS_BEGIN:pbe,HASH_COMMENT_MODE:ibe,IDENT_RE:gH,MATCH_NOTHING_RE:Ywe,METHOD_GUARD:hbe,NUMBER_MODE:obe,NUMBER_RE:vH,PHRASAL_WORDS_MODE:nbe,QUOTE_STRING_MODE:tbe,REGEXP_MODE:lbe,RE_STARTERS_RE:Qwe,SHEBANG:Jwe,TITLE_MODE:dbe,UNDERSCORE_IDENT_RE:Zz,UNDERSCORE_TITLE_MODE:ube});function ybe(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function fbe(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function mbe(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=ybe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function kbe(e,t){Array.isArray(e.illegal)&&(e.illegal=Wz(...e.illegal))}function gbe(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function vbe(e,t){e.relevance===void 0&&(e.relevance=1)}const Mbe=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(a=>{delete e[a]}),e.keywords=n.keywords,e.begin=U0(n.beforeMatch,mH(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},xbe=["of","and","for","in","not","or","if","then","parent","list","value"],wbe="keyword";function wH(e,t,n=wbe){const a=Object.create(null);return typeof e=="string"?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach(function(i){Object.assign(a,wH(e[i],t,i))}),a;function r(i,o){t&&(o=o.map(c=>c.toLowerCase())),o.forEach(function(c){const l=c.split("|");a[l[0]]=[i,bbe(l[0],l[1])]})}}function bbe(e,t){return t?Number(t):_be(e)?0:1}function _be(e){return xbe.includes(e.toLowerCase())}const nD={},z0=e=>{console.error(e)},aD=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Z0=(e,t)=>{nD[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),nD[`${e}/${t}`]=!0)},tI=new Error;function bH(e,t,{key:n}){let a=0;const r=e[n],i={},o={};for(let c=1;c<=t.length;c++)o[c+a]=r[c],i[c+a]=!0,a+=kH(t[c-1]);e[n]=o,e[n]._emit=i,e[n]._multi=!0}function Sbe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw z0("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),tI;if(typeof e.beginScope!="object"||e.beginScope===null)throw z0("beginScope must be object"),tI;bH(e,e.begin,{key:"beginScope"}),e.begin=Kz(e.begin,{joinWith:""})}}function Lbe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw z0("skip, excludeEnd, returnEnd not compatible with endScope: {}"),tI;if(typeof e.endScope!="object"||e.endScope===null)throw z0("endScope must be object"),tI;bH(e,e.end,{key:"endScope"}),e.end=Kz(e.end,{joinWith:""})}}function Nbe(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Cbe(e){Nbe(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Sbe(e),Lbe(e)}function Ibe(e){function t(o,c){return new RegExp(Hc(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(c?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(c,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,c]),this.matchAt+=kH(c)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const c=this.regexes.map(l=>l[1]);this.matcherRe=t(Kz(c,{joinWith:"|"}),!0),this.lastIndex=0}exec(c){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(c);if(!l)return null;const d=l.findIndex((h,p)=>p>0&&h!==void 0),u=this.matchIndexes[d];return l.splice(0,d),Object.assign(l,u)}}class a{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(c){if(this.multiRegexes[c])return this.multiRegexes[c];const l=new n;return this.rules.slice(c).forEach(([d,u])=>l.addRule(d,u)),l.compile(),this.multiRegexes[c]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(c,l){this.rules.push([c,l]),l.type==="begin"&&this.count++}exec(c){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let d=l.exec(c);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,d=u.exec(c)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function r(o){const c=new a;return o.contains.forEach(l=>c.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&c.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&c.addRule(o.illegal,{type:"illegal"}),c}function i(o,c){const l=o;if(o.isCompiled)return l;[fbe,gbe,Cbe,Mbe].forEach(u=>u(o,c)),e.compilerExtensions.forEach(u=>u(o,c)),o.__beforeBegin=null,[mbe,kbe,vbe].forEach(u=>u(o,c)),o.isCompiled=!0;let d=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),d=o.keywords.$pattern,delete o.keywords.$pattern),d=d||/\w+/,o.keywords&&(o.keywords=wH(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(d,!0),c&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=Hc(l.end)||"",o.endsWithParent&&c.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+c.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return Abe(u==="self"?o:u)})),o.contains.forEach(function(u){i(u,l)}),o.starts&&i(o.starts,c),l.matcher=r(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Va(e.classNameAliases||{}),i(e)}function _H(e){return e?e.endsWithParent||_H(e.starts):!1}function Abe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Va(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:_H(e)?Va(e,{starts:e.starts?Va(e.starts):null}):Object.isFrozen(e)?Va(e):e}var Ebe="11.11.1";class Tbe extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const jA=fH,rD=Va,iD=Symbol("nomatch"),zbe=7,SH=function(e){const t=Object.create(null),n=Object.create(null),a=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Uwe};function l(H){return c.noHighlightRe.test(H)}function d(H){let K=H.className+" ";K+=H.parentNode?H.parentNode.className:"";const P=c.languageDetectRe.exec(K);if(P){const G=D(P[1]);return G||(aD(i.replace("{}",P[1])),aD("Falling back to no-highlight mode for this block.",H)),G?P[1]:"no-highlight"}return K.split(/\s+/).find(G=>l(G)||D(G))}function u(H,K,P){let G="",L="";typeof K=="object"?(G=H,P=K.ignoreIllegals,L=K.language):(Z0("10.7.0","highlight(lang, code, ...args) has been deprecated."),Z0("10.7.0",`Please use highlight(code, options) instead.
8607
8607
  https://github.com/highlightjs/highlight.js/issues/2277`),L=H,G=K),P===void 0&&(P=!0);const ie={code:G,language:L};J("before:highlight",ie);const se=ie.result?ie.result:h(ie.language,ie.code,P);return se.code=ie.code,J("after:highlight",se),se}function h(H,K,P,G){const L=Object.create(null);function ie(O,j){return O.keywords[j]}function se(){if(!fe.keywords){dt.addText(Pe);return}let O=0;fe.keywordPatternRe.lastIndex=0;let j=fe.keywordPatternRe.exec(Pe),ee="";for(;j;){ee+=Pe.substring(O,j.index);const le=Be.case_insensitive?j[0].toLowerCase():j[0],Me=ie(fe,le);if(Me){const[tt,Ln]=Me;if(dt.addText(ee),ee="",L[le]=(L[le]||0)+1,L[le]<=zbe&&(Ca+=Ln),tt.startsWith("_"))ee+=j[0];else{const en=Be.classNameAliases[tt]||tt;be(j[0],en)}}else ee+=j[0];O=fe.keywordPatternRe.lastIndex,j=fe.keywordPatternRe.exec(Pe)}ee+=Pe.substring(O),dt.addText(ee)}function T(){if(Pe==="")return;let O=null;if(typeof fe.subLanguage=="string"){if(!t[fe.subLanguage]){dt.addText(Pe);return}O=h(fe.subLanguage,Pe,!0,Jt[fe.subLanguage]),Jt[fe.subLanguage]=O._top}else O=y(Pe,fe.subLanguage.length?fe.subLanguage:null);fe.relevance>0&&(Ca+=O.relevance),dt.__addSublanguage(O._emitter,O.language)}function ge(){fe.subLanguage!=null?T():se(),Pe=""}function be(O,j){O!==""&&(dt.startScope(j),dt.addText(O),dt.endScope())}function _e(O,j){let ee=1;const le=j.length-1;for(;ee<=le;){if(!O._emit[ee]){ee++;continue}const Me=Be.classNameAliases[O[ee]]||O[ee],tt=j[ee];Me?be(tt,Me):(Pe=tt,se(),Pe=""),ee++}}function Fe(O,j){return O.scope&&typeof O.scope=="string"&&dt.openNode(Be.classNameAliases[O.scope]||O.scope),O.beginScope&&(O.beginScope._wrap?(be(Pe,Be.classNameAliases[O.beginScope._wrap]||O.beginScope._wrap),Pe=""):O.beginScope._multi&&(_e(O.beginScope,j),Pe="")),fe=Object.create(O,{parent:{value:fe}}),fe}function ae(O,j,ee){let le=Zwe(O.endRe,ee);if(le){if(O["on:end"]){const Me=new JO(O);O["on:end"](j,Me),Me.isMatchIgnored&&(le=!1)}if(le){for(;O.endsParent&&O.parent;)O=O.parent;return O}}if(O.endsWithParent)return ae(O.parent,j,ee)}function we(O){return fe.matcher.regexIndex===0?(Pe+=O[0],1):(dr=!0,0)}function Ae(O){const j=O[0],ee=O.rule,le=new JO(ee),Me=[ee.__beforeBegin,ee["on:begin"]];for(const tt of Me)if(tt&&(tt(O,le),le.isMatchIgnored))return we(j);return ee.skip?Pe+=j:(ee.excludeBegin&&(Pe+=j),ge(),!ee.returnBegin&&!ee.excludeBegin&&(Pe=j)),Fe(ee,O),ee.returnBegin?0:j.length}function Ee(O){const j=O[0],ee=K.substring(O.index),le=ae(fe,O,ee);if(!le)return iD;const Me=fe;fe.endScope&&fe.endScope._wrap?(ge(),be(j,fe.endScope._wrap)):fe.endScope&&fe.endScope._multi?(ge(),_e(fe.endScope,O)):Me.skip?Pe+=j:(Me.returnEnd||Me.excludeEnd||(Pe+=j),ge(),Me.excludeEnd&&(Pe=j));do fe.scope&&dt.closeNode(),!fe.skip&&!fe.subLanguage&&(Ca+=fe.relevance),fe=fe.parent;while(fe!==le.parent);return le.starts&&Fe(le.starts,O),Me.returnEnd?0:j.length}function Ge(){const O=[];for(let j=fe;j!==Be;j=j.parent)j.scope&&O.unshift(j.scope);O.forEach(j=>dt.openNode(j))}let We={};function lt(O,j){const ee=j&&j[0];if(Pe+=O,ee==null)return ge(),0;if(We.type==="begin"&&j.type==="end"&&We.index===j.index&&ee===""){if(Pe+=K.slice(j.index,j.index+1),!r){const le=new Error(`0 width match regex (${H})`);throw le.languageName=H,le.badRule=We.rule,le}return 1}if(We=j,j.type==="begin")return Ae(j);if(j.type==="illegal"&&!P){const le=new Error('Illegal lexeme "'+ee+'" for mode "'+(fe.scope||"<unnamed>")+'"');throw le.mode=fe,le}else if(j.type==="end"){const le=Ee(j);if(le!==iD)return le}if(j.type==="illegal"&&ee==="")return Pe+=`
8608
- `,1;if(Ia>1e5&&Ia>j.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=ee,ee.length}const Be=D(H);if(!Be)throw z0(i.replace("{}",H)),new Error('Unknown language: "'+H+'"');const Le=Ibe(Be);let St="",fe=G||Le;const Jt={},dt=new c.__emitter(c);Ge();let Pe="",Ca=0,fn=0,Ia=0,dr=!1;try{if(Be.__emitTokens)Be.__emitTokens(K,dt);else{for(fe.matcher.considerAll();;){Ia++,dr?dr=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=fn;const O=fe.matcher.exec(K);if(!O)break;const j=K.substring(fn,O.index),ee=lt(j,O);fn=O.index+ee}lt(K.substring(fn))}return dt.finalize(),St=dt.toHTML(),{language:H,value:St,relevance:Ca,illegal:!1,_emitter:dt,_top:fe}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:H,value:jA(K),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:fn,context:K.slice(fn-100,fn+100),mode:O.mode,resultSoFar:St},_emitter:dt};if(r)return{language:H,value:jA(K),illegal:!1,relevance:0,errorRaised:O,_emitter:dt,_top:fe};throw O}}function p(H){const K={value:jA(H),illegal:!1,relevance:0,_top:o,_emitter:new c.__emitter(c)};return K._emitter.addText(H),K}function y(H,K){K=K||c.languages||Object.keys(t);const P=p(H),G=K.filter(D).filter($).map(ge=>h(ge,H,!1));G.unshift(P);const L=G.sort((ge,be)=>{if(ge.relevance!==be.relevance)return be.relevance-ge.relevance;if(ge.language&&be.language){if(D(ge.language).supersetOf===be.language)return 1;if(D(be.language).supersetOf===ge.language)return-1}return 0}),[ie,se]=L,T=ie;return T.secondBest=se,T}function k(H,K,P){const G=K&&n[K]||P;H.classList.add("hljs"),H.classList.add(`language-${G}`)}function M(H){let K=null;const P=d(H);if(l(P))return;if(J("before:highlightElement",{el:H,language:P}),H.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",H);return}if(H.children.length>0&&(c.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(H)),c.throwUnescapedHTML))throw new Tbe("One of your code blocks includes unescaped HTML.",H.innerHTML);K=H;const G=K.textContent,L=P?u(G,{language:P,ignoreIllegals:!0}):y(G);H.innerHTML=L.value,H.dataset.highlighted="yes",k(H,P,L.language),H.result={language:L.language,re:L.relevance,relevance:L.relevance},L.secondBest&&(H.secondBest={language:L.secondBest.language,relevance:L.secondBest.relevance}),J("after:highlightElement",{el:H,result:L,text:G})}function S(H){c=rD(c,H)}const v=()=>{C(),Z0("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function g(){C(),Z0("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function C(){function H(){C()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",H,!1),w=!0;return}document.querySelectorAll(c.cssSelector).forEach(M)}function z(H,K){let P=null;try{P=K(e)}catch(G){if(z0("Language definition for '{}' could not be registered.".replace("{}",H)),r)z0(G);else throw G;P=o}P.name||(P.name=H),t[H]=P,P.rawDefinition=K.bind(null,e),P.aliases&&B(P.aliases,{languageName:H})}function N(H){delete t[H];for(const K of Object.keys(n))n[K]===H&&delete n[K]}function E(){return Object.keys(t)}function D(H){return H=(H||"").toLowerCase(),t[H]||t[n[H]]}function B(H,{languageName:K}){typeof H=="string"&&(H=[H]),H.forEach(P=>{n[P.toLowerCase()]=K})}function $(H){const K=D(H);return K&&!K.disableAutodetect}function F(H){H["before:highlightBlock"]&&!H["before:highlightElement"]&&(H["before:highlightElement"]=K=>{H["before:highlightBlock"](Object.assign({block:K.el},K))}),H["after:highlightBlock"]&&!H["after:highlightElement"]&&(H["after:highlightElement"]=K=>{H["after:highlightBlock"](Object.assign({block:K.el},K))})}function U(H){F(H),a.push(H)}function de(H){const K=a.indexOf(H);K!==-1&&a.splice(K,1)}function J(H,K){const P=H;a.forEach(function(G){G[P]&&G[P](K)})}function re(H){return Z0("10.7.0","highlightBlock will be removed entirely in v12.0"),Z0("10.7.0","Please use highlightElement now."),M(H)}Object.assign(e,{highlight:u,highlightAuto:y,highlightAll:C,highlightElement:M,highlightBlock:re,configure:S,initHighlighting:v,initHighlightingOnLoad:g,registerLanguage:z,unregisterLanguage:N,listLanguages:E,getLanguage:D,registerAliases:B,autoDetection:$,inherit:rD,addPlugin:U,removePlugin:de}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=Ebe,e.regex={concat:U0,lookahead:mH,either:Wz,optional:Wwe,anyNumberOfTimes:Gwe};for(const H in Hl)typeof Hl[H]=="object"&&yH(Hl[H]);return Object.assign(e,Hl),e},As=SH({});As.newInstance=()=>SH({});var $be=As;As.HighlightJS=As;As.default=As;const Rbe=oI($be),oD={},Obe="hljs-";function Dbe(e){const t=Rbe.newInstance();return e&&i(e),{highlight:n,highlightAuto:a,listLanguages:r,register:i,registerAlias:o,registered:c};function n(l,d,u){const h=u||oD,p=typeof h.prefix=="string"?h.prefix:Obe;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:Pbe,classPrefix:p});const y=t.highlight(d,{ignoreIllegals:!0,language:l});if(y.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:y.errorRaised});const k=y._emitter.root,M=k.data;return M.language=y.language,M.relevance=y.relevance,k}function a(l,d){const h=(d||oD).subset||r();let p=-1,y=0,k;for(;++p<h.length;){const M=h[p];if(!t.getLanguage(M))continue;const S=n(M,l,d);S.data&&S.data.relevance!==void 0&&S.data.relevance>y&&(y=S.data.relevance,k=S)}return k||{type:"root",children:[],data:{language:void 0,relevance:y}}}function r(){return t.listLanguages()}function i(l,d){if(typeof l=="string")t.registerLanguage(l,d);else{let u;for(u in l)Object.hasOwn(l,u)&&t.registerLanguage(u,l[u])}}function o(l,d){if(typeof l=="string")t.registerAliases(typeof d=="string"?d:[...d],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const h=l[u];t.registerAliases(typeof h=="string"?h:[...h],{languageName:u})}}}function c(l){return!!t.getLanguage(l)}}class Pbe{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],a=n.children[n.children.length-1];a&&a.type==="text"?a.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const a=this.stack[this.stack.length-1],r=t.root.children;n?a.children.push({type:"element",tagName:"span",properties:{className:[n]},children:r}):a.children.push(...r)}openNode(t){const n=this,a=t.split(".").map(function(o,c){return c?o+"_".repeat(c):n.options.classPrefix+o}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:a},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const qbe={};function Fbe(e){const t=e||qbe,n=t.aliases,a=t.detect||!1,r=t.languages||Bwe,i=t.plainText,o=t.prefix,c=t.subset;let l="hljs";const d=Dbe(r);if(n&&d.registerAlias(n),o){const u=o.indexOf("-");l=u===-1?o:o.slice(0,u)}return function(u,h){II(u,"element",function(p,y,k){if(p.tagName!=="code"||!k||k.type!=="element"||k.tagName!=="pre")return;const M=Bbe(p);if(M===!1||!M&&!a||M&&i&&i.includes(M))return;Array.isArray(p.properties.className)||(p.properties.className=[]),p.properties.className.includes(l)||p.properties.className.unshift(l);const S=WB(p,{whitespace:"pre"});let v;try{v=M?d.highlight(M,S,{prefix:o}):d.highlightAuto(S,{prefix:o,subset:c})}catch(g){const w=g;if(M&&/Unknown language/.test(w.message)){h.message("Cannot highlight as `"+M+"`, it’s not registered",{ancestors:[k,p],cause:w,place:p.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw w}!M&&v.data&&v.data.language&&p.properties.className.push("language-"+v.data.language),v.children.length>0&&(p.children=v.children)})}}function Bbe(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let a;for(;++n<t.length;){const r=String(t[n]);if(r==="no-highlight"||r==="nohighlight")return!1;!a&&r.slice(0,5)==="lang-"&&(a=r.slice(5)),!a&&r.slice(0,9)==="language-"&&(a=r.slice(9))}return a}const sD=/[#.]/g;function Hbe(e,t){const n=e||"",a={};let r=0,i,o;for(;r<n.length;){sD.lastIndex=r;const c=sD.exec(n),l=n.slice(r,c?c.index:n.length);l&&(i?i==="#"?a.id=l:Array.isArray(a.className)?a.className.push(l):a.className=[l]:o=l,r+=l.length),c&&(i=c[0],r++)}return{type:"element",tagName:o||t||"div",properties:a,children:[]}}function LH(e,t,n){const a=n?Gbe(n):void 0;function r(i,o,...c){let l;if(i==null){l={type:"root",children:[]};const d=o;c.unshift(d)}else{l=Hbe(i,t);const d=l.tagName.toLowerCase(),u=a?a.get(d):void 0;if(l.tagName=u||d,jbe(o))c.unshift(o);else for(const[h,p]of Object.entries(o))Vbe(e,l.properties,h,p)}for(const d of c)lT(l.children,d);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return r}function jbe(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const a of n){const r=t[a];if(r&&typeof r=="object"){if(!Array.isArray(r))return!0;const i=r;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Vbe(e,t,n,a){const r=Xq(e,n);let i;if(a!=null){if(typeof a=="number"){if(Number.isNaN(a))return;i=a}else typeof a=="boolean"?i=a:typeof a=="string"?r.spaceSeparated?i=fR(a):r.commaSeparated?i=dR(a):r.commaOrSpaceSeparated?i=fR(dR(a).join(" ")):i=cD(r,r.property,a):Array.isArray(a)?i=[...a]:i=r.property==="style"?Ube(a):String(a);if(Array.isArray(i)){const o=[];for(const c of i)o.push(cD(r,r.property,c));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function lT(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)lT(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?lT(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function cD(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Dc(n)===Dc(t)))return!0}return n}function Ube(e){const t=[];for(const[n,a]of Object.entries(e))t.push([n,a].join(": "));return t.join("; ")}function Gbe(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Wbe=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Kbe=LH(Yq,"div"),Zbe=LH(bI,"g",Wbe),VA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Xbe(e,t){return NH(e,{})||{type:"root",children:[]}}function NH(e,t){const n=Ybe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function Ybe(e,t){switch(e.nodeType){case 1:return t_e(e,t);case 3:return Jbe(e);case 8:return e_e(e);case 9:return lD(e,t);case 10:return Qbe();case 11:return lD(e,t);default:return}}function lD(e,t){return{type:"root",children:CH(e,t)}}function Qbe(){return{type:"doctype"}}function Jbe(e){return{type:"text",value:e.nodeValue||""}}function e_e(e){return{type:"comment",value:e.nodeValue||""}}function t_e(e,t){const n=e.namespaceURI,a=n===VA.svg?Zbe:Kbe,r=n===VA.html?e.tagName.toLowerCase():e.tagName,i=n===VA.html&&r==="template"?e.content:e,o=e.getAttributeNames(),c={};let l=-1;for(;++l<o.length;)c[o[l]]=e.getAttribute(o[l])||"";return a(r,c,CH(i,t))}function CH(e,t){const n=e.childNodes,a=[];let r=-1;for(;++r<n.length;){const i=NH(n[r],t);i!==void 0&&a.push(i)}return a}new DOMParser;function n_e(e,t){const n=a_e(e);return Xbe(n)}function a_e(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const r_e={},i_e=[];function o_e(e){const t=e||r_e;return function(n,a){vz(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:i_e,c=o.includes("language-math"),l=o.includes("math-display"),d=o.includes("math-inline");let u=l;if(!c&&!l&&!d)return;let h=i[i.length-1],p=r;if(r.tagName==="code"&&c&&h&&h.type==="element"&&h.tagName==="pre"&&(p=h,h=i[i.length-2],u=!0),!h)return;const y=WB(p,{whitespace:"pre"});let k;try{k=HO.renderToString(y,{...t,displayMode:u,throwOnError:!0})}catch(S){const v=S,g=v.name.toLowerCase();a.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:v,place:r.position,ruleId:g,source:"rehype-katex"});try{k=HO.renderToString(y,{...t,displayMode:u,strict:"ignore",throwOnError:!1})}catch{k=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(S)},children:[{type:"text",value:y}]}]}}typeof k=="string"&&(k=n_e(k).children);const M=h.children.indexOf(p);return h.children.splice(M,1,...k),_F})}}function s_e({content:e=""}){return e?_.jsx("div",{className:"markdown-container",children:_.jsx(Fge,{remarkPlugins:[Q9e,cxe],rehypePlugins:[Fbe,o_e],components:{code({node:t,inline:n,className:a,children:r,...i}){const o=/language-(\w+)/.exec(a||""),c=o?o[1]:"text";return n?_.jsx("code",{className:"markdown-inline-code",...i,children:r}):_.jsxs("pre",{className:"markdown-code-block",children:[_.jsx("div",{className:"markdown-code-header",children:_.jsx("span",{className:"markdown-code-language",children:c})}),_.jsx("code",{className:a,...i,children:r})]})},img({node:t,src:n,alt:a,...r}){return _.jsxs("div",{className:"markdown-image-wrapper",children:[_.jsx("img",{src:n,alt:a,className:"markdown-image",...r}),a&&_.jsx("span",{className:"markdown-image-caption",children:a})]})},a({node:t,href:n,children:a,...r}){return _.jsx("a",{href:n,className:"markdown-link",target:"_blank",rel:"noopener noreferrer",...r,children:a})},table({node:t,children:n,...a}){return _.jsx("div",{className:"markdown-table-wrapper",children:_.jsx("table",{className:"markdown-table",...a,children:n})})},blockquote({node:t,children:n,...a}){return _.jsx("blockquote",{className:"markdown-blockquote",...a,children:n})},h1({node:t,children:n,...a}){return _.jsx("h1",{className:"markdown-h1",...a,children:n})},h2({node:t,children:n,...a}){return _.jsx("h2",{className:"markdown-h2",...a,children:n})},h3({node:t,children:n,...a}){return _.jsx("h3",{className:"markdown-h3",...a,children:n})},ul({node:t,children:n,...a}){return _.jsx("ul",{className:"markdown-ul",...a,children:n})},ol({node:t,children:n,...a}){return _.jsx("ol",{className:"markdown-ol",...a,children:n})},li({node:t,children:n,...a}){return _.jsx("li",{className:"markdown-li",...a,children:n})},p({node:t,children:n,...a}){return _.jsx("p",{className:"markdown-p",...a,children:n})}},children:e})}):_.jsx("div",{className:"markdown-empty",children:"No content"})}function c_e({message:e,streaming:t=!1}){const{user:n}=sr(),{id:a,role:r,content:i,created_at:o,metadata:c,status:l}=e,d=new Date(o).toLocaleTimeString("it-IT",{hour:"2-digit",minute:"2-digit",hour12:!1}),u=r==="user"?(n==null?void 0:n.username)||"You":"NexusAI";return _.jsxs("div",{className:`message ${r}-message`,children:[_.jsxs("div",{className:"message-header",children:[_.jsx("span",{className:"avatar",children:r==="user"?"👤":"🤖"}),_.jsx("span",{className:"sender",children:u}),_.jsx("span",{className:"timestamp",children:d})]}),r==="assistant"&&l&&_.jsx(Hq,{status:l,metadata:c}),_.jsx("div",{className:"message-content",children:_.jsx(s_e,{content:i})}),t&&_.jsxs("div",{className:"streaming-indicator",children:[_.jsx("span",{className:"dot"}),_.jsx("span",{className:"dot"}),_.jsx("span",{className:"dot"})]}),r==="assistant"&&(l==null?void 0:l.state)==="completed"&&_.jsx(u3e,{message:e})]})}function l_e({selectedModel:e,onSelectModel:t,thinkMode:n="think",onThinkModeChange:a,reasoningLevel:r="high",onReasoningLevelChange:i}){var $;const[o,c]=V.useState(!1),[l,d]=V.useState(""),[u,h]=V.useState({}),[p,y]=V.useState(!0);V.useEffect(()=>{(async()=>{try{const de=await(await fetch("/api/v1/models")).json();h(de),y(!1)}catch(U){console.error("Failed to fetch models:",U),y(!1)}})()},[]);const M=Object.values(u).flatMap(F=>F.models||[]).find(F=>F.id===e),S=M?u[M.category]:u.claude||{icon:"Terminal"},v=Object.entries(u).map(([F,U])=>({key:F,...U,models:(U.models||[]).filter(de=>de.name.toLowerCase().includes(l.toLowerCase())||de.label.toLowerCase().includes(l.toLowerCase()))})).filter(F=>F.models&&F.models.length>0),g=(F,U)=>{if(!U){alert("This CLI tool is coming soon!");return}t(F),c(!1),d("")},w=(M==null?void 0:M.label)||(p?"Loading...":"Select"),C=w.length>15?w.substring(0,15):w,z=M==null?void 0:M.category,N=z?u[z]:null,E=(($=N==null?void 0:N.thinkModes)==null?void 0:$.length)>0,D=M==null?void 0:M.reasoningEfforts,B=e==null?void 0:e.startsWith("deepseek-");return _.jsxs("div",{className:"model-selector",children:[_.jsxs("div",{className:"model-selector-trigger",onClick:()=>!p&&c(!o),children:[_.jsx("span",{className:"model-icon",children:_.jsx(Ie,{name:(S==null?void 0:S.icon)||"Terminal",size:18})}),_.jsx("span",{className:"model-label",children:C}),_.jsx(Ie,{name:"ChevronDown",size:14})]}),E&&!B&&a&&_.jsxs("button",{className:`think-toggle ${n==="think"?"active":""}`,onClick:F=>{F.stopPropagation(),a(n==="think"?"no-think":"think")},title:n==="think"?"Extended Thinking ON":"Extended Thinking OFF",children:[_.jsx(Ie,{name:n==="think"?"Brain":"Zap",size:16}),_.jsx("span",{className:"toggle-label",children:n==="think"?"Think":"Fast"})]}),D&&i&&_.jsxs("div",{className:"reasoning-wrapper",children:[_.jsx(Ie,{name:"Cpu",size:14}),_.jsx("select",{className:"reasoning-select",value:r,onChange:F=>{F.stopPropagation(),i(F.target.value)},onClick:F=>F.stopPropagation(),children:D.map(F=>_.jsx("option",{value:F,children:F==="xhigh"?"X-High":F.charAt(0).toUpperCase()+F.slice(1)},F))})]}),o&&_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"model-dropdown",children:[_.jsx("div",{className:"model-search",children:_.jsx("input",{type:"text",placeholder:"Cerca CLI e modelli...",value:l,onChange:F=>d(F.target.value),autoFocus:!0})}),v.map(F=>_.jsxs("div",{className:"model-category",children:[_.jsxs("div",{className:"category-header",children:[_.jsx("span",{className:"category-icon",children:_.jsx(Ie,{name:F.icon,size:20})}),_.jsx("span",{className:"category-name",children:F.name}),!F.enabled&&_.jsx("span",{className:"coming-soon",children:F.disabledReason||"Coming Soon"})]}),_.jsx("div",{className:"model-list",children:F.models.map(U=>_.jsxs("div",{className:`model-item ${e===U.id?"selected":""} ${F.enabled?"":"disabled"}`,onClick:()=>g(U.id,F.enabled),children:[_.jsx("span",{className:"model-label",children:U.name}),e===U.id&&_.jsx("span",{className:"checkmark",children:_.jsx(Ie,{name:"Check",size:18})})]},U.id))})]},F.key))]}),_.jsx("div",{className:"model-dropdown-overlay",onClick:()=>c(!1)})]})]})}function d_e({onClose:e}){const{user:t,logout:n}=sr(),a=()=>{n(),e()};return _.jsx("div",{className:"user-menu",children:_.jsxs("button",{className:"user-menu-item logout",onClick:a,children:[_.jsx("span",{className:"menu-icon",children:_.jsx(Ie,{name:"LogOut",size:18})}),_.jsx("span",{children:"Disconnetti"})]})})}function u_e({items:e,align:t="right"}){const[n,a]=V.useState(!1),r=V.useRef(null);V.useEffect(()=>{if(!n)return;const o=c=>{r.current&&!r.current.contains(c.target)&&a(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[n]);const i=o=>{a(!1),o.onClick&&o.onClick()};return _.jsxs("div",{className:"dropdown-menu-container",ref:r,children:[_.jsx("button",{className:"dropdown-trigger",onClick:o=>{o.stopPropagation(),a(!n)},title:"Actions",children:_.jsx(Ie,{name:"MoreVertical",size:16})}),n&&_.jsx("div",{className:`dropdown-menu ${t}`,children:e.map((o,c)=>_.jsxs("button",{className:`dropdown-item ${o.danger?"danger":""}`,onClick:l=>{l.stopPropagation(),i(o)},children:[o.icon&&_.jsx(Ie,{name:o.icon,size:16}),_.jsx("span",{children:o.label})]},c))})]})}function h_e({isOpen:e,onConfirm:t,onCancel:n,title:a="Delete conversation?"}){return V.useEffect(()=>{const r=i=>{i.key==="Escape"&&n()};if(e)return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n]),e?_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"delete-modal-overlay",onClick:n}),_.jsxs("div",{className:"delete-modal",children:[_.jsxs("div",{className:"delete-modal-header",children:[_.jsx(Ie,{name:"AlertTriangle",size:24,className:"delete-modal-icon"}),_.jsx("h3",{className:"delete-modal-title",children:a})]}),_.jsx("p",{className:"delete-modal-message",children:"This action cannot be undone. This will permanently delete the conversation and all its messages."}),_.jsxs("div",{className:"delete-modal-actions",children:[_.jsx("button",{className:"delete-modal-btn cancel-btn",onClick:n,children:"Cancel"}),_.jsxs("button",{className:"delete-modal-btn confirm-btn",onClick:t,children:[_.jsx(Ie,{name:"Trash2",size:16}),"Delete"]})]})]})]}):null}const Oa={data:null,timestamp:0,workspace:null,TTL:3e4};function p_e({isOpen:e,onClose:t,currentConversationId:n,onSelectConversation:a,onNewConversation:r,currentWorkspace:i,onWorkspaceChange:o,sessions:c}){var _e,Fe;const{t:l}=iz(),{token:d,user:u}=sr(),[h,p]=V.useState({today:[],yesterday:[],last7days:[],last30days:[],older:[]}),[y,k]=V.useState(""),[M,S]=V.useState(!1),[v,g]=V.useState(null),[w,C]=V.useState(""),[z,N]=V.useState(!1),[E,D]=V.useState(null),[B,$]=V.useState(!1),[F,U]=V.useState(!1),de=ae=>{const we=(ae||"").toLowerCase();return we.includes("codex")||we.includes("openai")?{icon:"Code2",color:"#00D26A",className:"codex",label:"Codex"}:we.includes("gemini")||we.includes("google")?{icon:"Sparkles",color:"#4285F4",className:"gemini",label:"Gemini"}:{icon:"Terminal",color:"#FF6B35",className:"claude",label:"Claude"}};V.useEffect(()=>{if(console.log("[Sidebar] useEffect triggered - sessions:",c?"has data":"null","isOpen:",e,"token:",!!d),c){console.log("[Sidebar] Using sessions prop:",Object.keys(c).map(Ee=>{var Ge;return`${Ee}:${((Ge=c[Ee])==null?void 0:Ge.length)||0}`}).join(", ")),p(c),$(!1),U(!0);return}if(!d){console.log("[Sidebar] Waiting for token...");return}if(!e&&F){console.log("[Sidebar] Sidebar closed, skipping fetch");return}const ae=Date.now();if(Oa.data&&Oa.workspace===i&&ae-Oa.timestamp<Oa.TTL){p(Oa.data);return}(async()=>{$(!0);try{const Ee=i?`/api/v1/conversations?groupBy=date&workspace=${encodeURIComponent(i)}`:"/api/v1/conversations?groupBy=date",We=await(await fetch(Ee,{headers:{Authorization:`Bearer ${d}`}})).json();Oa.data=We,Oa.timestamp=Date.now(),Oa.workspace=i,p(We),U(!0)}catch(Ee){console.error("Failed to load conversations:",Ee)}finally{$(!1)}})()},[d,e,c,i,F]);const J=ae=>!ae||!Array.isArray(ae)?[]:y?ae.filter(we=>we.title.toLowerCase().includes(y.toLowerCase())):ae,re=ae=>{a(ae),window.innerWidth<768&&t()},H=ae=>{g(ae.id),C(ae.title)},K=async ae=>{if(!ae||ae==="null"){console.warn("[Sidebar] Attempted to save title with null conversationId"),g(null);return}try{await fetch(`/api/v1/conversations/${ae}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify({title:w})}),p(we=>{const Ae={...we};return Object.keys(Ae).forEach(Ee=>{Ae[Ee]=Ae[Ee].map(Ge=>Ge.id===ae?{...Ge,title:w}:Ge)}),Ae}),g(null)}catch(we){console.error("Failed to update title:",we)}},P=()=>{g(null),C("")},G=ae=>{D(ae),N(!0)},L=async()=>{if(E)try{await fetch(`/api/v1/sessions/${E}`,{method:"DELETE",headers:{Authorization:`Bearer ${d}`}}),p(ae=>{const we={...ae};return Object.keys(we).forEach(Ae=>{we[Ae]=we[Ae].filter(Ee=>Ee.id!==E)}),we}),E===n&&r(),N(!1),D(null)}catch(ae){console.error("Failed to delete conversation:",ae),N(!1),D(null)}},ie=()=>{N(!1),D(null)},se=async(ae,we)=>{try{const Ae=await fetch(`/api/v1/conversations/${ae}/pin`,{method:"POST",headers:{Authorization:`Bearer ${d}`}}),{pinned:Ee}=await Ae.json();p(Ge=>{const We={...Ge};return Object.keys(We).forEach(lt=>{We[lt]=We[lt].map(Be=>Be.id===ae?{...Be,metadata:{...Be.metadata,pinned:Ee}}:Be)}),We})}catch(Ae){console.error("Failed to toggle pin:",Ae)}},T=ae=>{var Be;const we=ae.id===n,Ae=(Be=ae.metadata)==null?void 0:Be.pinned,Ee=v===ae.id,Ge=de(ae.engine),We=ae.title||"Untitled Conversation";We.trim()===""&&console.warn("[Sidebar] Empty title for conversation:",ae.id);const lt=[{label:"Rename",icon:"Pencil",onClick:()=>H(ae)},{label:Ae?"Unpin":"Pin",icon:"Pin",onClick:Le=>{se(ae.id)}},{label:"Delete",icon:"Trash2",danger:!0,onClick:()=>G(ae.id)}];return _.jsx("div",{className:`conversation-item ${we?"active":""}`,onClick:()=>!Ee&&re(ae.id),role:"listitem","aria-label":ae.title,tabIndex:0,children:Ee?_.jsx("input",{type:"text",value:w,onChange:Le=>C(Le.target.value),onKeyDown:Le=>{Le.key==="Enter"&&K(ae.id),Le.key==="Escape"&&P()},onBlur:()=>K(ae.id),autoFocus:!0,className:"conversation-title-edit"}):_.jsxs(_.Fragment,{children:[_.jsx(Ie,{name:Ge.icon,size:18,className:`conversation-icon ${Ge.className}`,style:{color:Ge.color},title:Ge.label}),_.jsxs("div",{className:"conversation-title-wrapper",children:[_.jsx("span",{className:"conversation-title",children:We}),_.jsx("div",{className:"fade-gradient","aria-hidden":"true"})]}),_.jsx("div",{className:"conversation-actions",children:_.jsx(u_e,{items:lt,align:"right"})})]})},ae.id)},ge=()=>{const ae=[...h.today,...h.yesterday,...h.last7days,...h.last30days,...h.older];return J(ae.filter(we=>{var Ae;return(Ae=we.metadata)==null?void 0:Ae.pinned}))},be=(ae,we,Ae=!1)=>{let Ee=J(we);return Ae&&(Ee=Ee.filter(Ge=>{var We;return!((We=Ge.metadata)!=null&&We.pinned)})),Ee.length===0?null:_.jsxs("div",{className:"conversation-group",children:[_.jsx("div",{className:"group-title",children:ae}),Ee.map(T)]})};return _.jsxs(_.Fragment,{children:[e&&_.jsx("div",{className:"sidebar-overlay",onClick:t}),_.jsxs("div",{className:`sidebar ${e?"open":""}`,children:[_.jsxs("div",{className:"sidebar-search",children:[_.jsx("span",{className:"search-icon",children:_.jsx(Ie,{name:"Search",size:18})}),_.jsx("input",{type:"text",placeholder:l("sidebar.searchPlaceholder"),value:y,onChange:ae=>k(ae.target.value)})]}),_.jsxs("div",{className:"conversation-list",children:[B&&_.jsx("div",{className:"loading-indicator",children:_.jsx("div",{className:"loading-spinner"})}),!B&&ge().length>0&&_.jsxs("div",{className:"conversation-group pinned-group",children:[_.jsxs("div",{className:"group-title",children:[_.jsx(Ie,{name:"Pin",size:14}),_.jsx("span",{children:"Pinned"})]}),ge().map(T)]}),!B&&be("Oggi",h.today,!0),!B&&be("Ieri",h.yesterday,!0),!B&&be("Ultimi 7 giorni",h.last7days,!0),!B&&be("Ultimi 30 giorni",h.last30days,!0),!B&&be("Più vecchi",h.older,!0),!B&&Object.values(h).every(ae=>ae.length===0)&&_.jsx("div",{className:"empty-state",children:_.jsx("p",{children:"Nessuna conversazione trovata"})})]}),_.jsxs("div",{className:"sidebar-footer",children:[_.jsxs("div",{className:"user-profile",onClick:()=>S(!M),children:[_.jsx("div",{className:"user-avatar",children:((Fe=(_e=u==null?void 0:u.username)==null?void 0:_e[0])==null?void 0:Fe.toUpperCase())||"?"}),_.jsx("span",{className:"user-name",children:(u==null?void 0:u.username)||"Guest"})]}),M&&_.jsx(d_e,{onClose:()=>S(!1)})]}),_.jsx(h_e,{isOpen:z,onConfirm:L,onCancel:ie,title:"Delete conversation?"})]})]})}function y_e({onFileAttached:e}){const{token:t}=sr(),[n,a]=V.useState(!1),[r,i]=V.useState(!1),o=V.useRef(null),c=async p=>{if(!(!p||!t)){i(!0);try{const y=new FormData;y.append("file",p);const k=await fetch("/api/v1/upload",{method:"POST",headers:{Authorization:`Bearer ${t}`},body:y});if(!k.ok){const S=await k.json();throw new Error(S.error||"Upload failed")}const M=await k.json();console.log("[AttachMenu] File uploaded:",M.file),e&&e(M.file)}catch(y){console.error("[AttachMenu] Upload error:",y),alert(`Upload failed: ${y.message}`)}finally{i(!1),a(!1)}}},l=p=>{var k;const y=(k=p.target.files)==null?void 0:k[0];y&&c(y),o.current&&(o.current.value="")},d=p=>{o.current&&(o.current.accept=p,o.current.click())},u=()=>{d(".txt,.md,.pdf,.doc,.docx,.xls,.xlsx,.csv,.json,.xml,.html,.css,.js,.ts,.py,.java,.c,.cpp,.h,.rb,.php,.go,.rs,.sh,.log,.yaml,.yml,.toml,.sql")},h=()=>{d("image/*")};return _.jsxs("div",{className:"attach-menu-container",children:[_.jsx("input",{ref:o,type:"file",style:{display:"none"},onChange:l}),_.jsx("button",{type:"button",className:"icon-btn",onClick:()=>a(!n),disabled:r,title:"Attach File","aria-label":"Attach file or image","aria-expanded":n,children:r?_.jsx(Ie,{name:"Loader",size:20,className:"spinning"}):_.jsx(Ie,{name:"Paperclip",size:20})}),n&&_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"attach-overlay",onClick:()=>a(!1)}),_.jsxs("div",{className:"attach-dropdown",children:[_.jsxs("button",{className:"attach-option",onClick:u,children:[_.jsx(Ie,{name:"File",size:16}),_.jsx("span",{children:"Invia file"})]}),_.jsxs("button",{className:"attach-option",onClick:h,children:[_.jsx(Ie,{name:"Image",size:16}),_.jsx("span",{children:"Invia immagine"})]})]})]})]})}function f_e({summary:e}){if(!e)return null;const[t,n]=V.useState(!1),{summary_short:a,summary_long:r,key_decisions:i=[],tools_used:o=[],files_modified:c=[]}=e;return _.jsxs("div",{className:"context-summary",children:[_.jsxs("div",{className:"summary-header",onClick:()=>n(!t),children:[_.jsxs("div",{className:"summary-title",children:[_.jsx(Ie,{name:"BookOpenText",size:18}),_.jsx("span",{children:"Context Summary"})]}),_.jsx("button",{className:"summary-toggle",type:"button","aria-label":t?"Collapse summary":"Expand summary",children:_.jsx(Ie,{name:t?"ChevronUp":"ChevronDown",size:16})})]}),_.jsxs("div",{className:"summary-content",children:[_.jsx("p",{className:"summary-short",children:a||"No summary available."}),t&&_.jsxs(_.Fragment,{children:[r&&_.jsx("p",{className:"summary-long",children:r}),i.length>0&&_.jsxs("div",{className:"summary-section",children:[_.jsx("h4",{children:"Key Decisions"}),_.jsx("ul",{children:i.map((l,d)=>_.jsx("li",{children:l},d))})]}),o.length>0&&_.jsxs("div",{className:"summary-section",children:[_.jsx("h4",{children:"Tools Used"}),_.jsx("div",{className:"summary-tags",children:o.map((l,d)=>_.jsx("span",{className:"tag",children:l},d))})]}),c.length>0&&_.jsxs("div",{className:"summary-section",children:[_.jsx("h4",{children:"Files Modified"}),_.jsx("div",{className:"summary-tags",children:c.map((l,d)=>_.jsx("span",{className:"tag",children:l},d))})]})]})]})]})}function m_e(){const{t:e}=iz(),{token:t}=sr(),[n,a]=V.useState([]),[r,i]=V.useState([]),[o,c]=V.useState(""),[l,d]=V.useState(null),[u,h]=V.useState("New Chat"),[p,y]=V.useState(!1),[k,M]=V.useState(!1),[S,v]=V.useState("claude-sonnet-4-5-20250929"),[g,w]=V.useState(null),[C,z]=V.useState("high"),[N,E]=V.useState("think"),[D,B]=V.useState({}),[$,F]=V.useState(!1),[U,de]=V.useState(""),[J,re]=V.useState(""),[H,K]=V.useState([]),[P,G]=V.useState(null),[L,ie]=V.useState(null),[se,T]=V.useState(null),[ge,be]=V.useState({hasMore:!1,oldestTimestamp:null}),[_e,Fe]=V.useState(!1),[ae,we]=V.useState([]),Ae=V.useRef(null),Ee=V.useRef(null),Ge=V.useCallback(te=>{c(he=>he+(he?" ":"")+te)},[]),We=V.useCallback(te=>{console.error("[STT]",te)},[]),{isListening:lt,isSupported:Be,transcript:Le,interimTranscript:St,toggleListening:fe,resetTranscript:Jt,provider:dt}=AU({language:"it-IT",onResult:Ge,onError:We}),Pe=te=>!te||te==="/"?te:te.replace(/\/+$/,""),Ca=()=>{var te;(te=Ae.current)==null||te.scrollIntoView({behavior:"smooth"})};V.useEffect(()=>{Ca()},[n]),V.useEffect(()=>{Ee.current&&(Ee.current.style.height="auto",Ee.current.style.height=Ee.current.scrollHeight+"px")},[o]),V.useEffect(()=>{(async()=>{const he=localStorage.getItem("nexuscli_workspace");if(he){const pe=Pe(he);console.log("[Chat] Restored workspace from localStorage:",pe),de(pe),re(pe),pe!==he&&localStorage.setItem("nexuscli_workspace",pe);return}try{const Se=await(await fetch("/api/v1/workspace")).json(),je=Se.current||Se.home;console.log("[Chat] Loaded workspace from backend:",je),de(je),re(je),localStorage.setItem("nexuscli_workspace",je)}catch(pe){console.error("Failed to fetch workspace:",pe),console.warn("[Chat] Backend not available, workspace not set")}})()},[]);const fn=(te,he)=>te?Object.values(he).some(pe=>(pe.models||[]).some(Se=>Se.id===te)):!1;V.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/v1/models")).json();B(pe)}catch(he){console.error("Failed to fetch models:",he)}})()},[]),V.useEffect(()=>{if(!g)return;if(fn(g,D)){console.log("[Chat] Applying preferred model from config:",g),v(g),w(null);return}Object.keys(D).length>0&&(console.warn("[Chat] Preferred model not available, keeping current:",g),w(null))},[D,g]),V.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/v1/config")).json();pe.defaultModel&&(fn(pe.defaultModel,D)?(console.log("[Chat] Auto-selecting default model:",pe.defaultModel),v(pe.defaultModel)):w(pe.defaultModel))}catch(he){console.error("Failed to fetch config:",he)}})()},[]);const Ia=te=>{var he;for(const[pe,Se]of Object.entries(D)){const je=(he=Se.models)==null?void 0:he.find(Cn=>Cn.id===te);if(je)return{model:je,cli:Se,cliKey:pe,endpoint:Se.endpoint||"/api/v1/chat"}}return{model:null,cli:null,cliKey:"claude-code",endpoint:"/api/v1/chat"}},dr=te=>{const{cliKey:he}=Ia(te);return{"claude-code":"/api/v1/chat/interrupt",gemini:"/api/v1/gemini/interrupt",codex:"/api/v1/codex/interrupt"}[he]||"/api/v1/chat/interrupt"},O=async()=>{const te=l;if(!te){console.warn("[Chat] No active session to interrupt");return}const he=dr(S);console.log(`[Chat] Interrupting session ${te} via ${he}`);try{const Se=await(await fetch(he,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({sessionId:te})})).json();Se.success?(console.log(`[Chat] Session interrupted via ${Se.method}`),M(!1),i([]),a(je=>[...je,{id:`system-${Date.now()}`,role:"system",content:"⏹️ Generation stopped by user",created_at:Date.now()}])):console.warn(`[Chat] Interrupt failed: ${Se.reason}`)}catch(pe){console.error("[Chat] Interrupt request failed:",pe)}},j=te=>{if(!te)return"New Chat";const he=te.replace(/\s+/g," ").trim();if(he.length<=50)return he;const pe=he.substring(0,50),Se=pe.lastIndexOf(" ");return Se>20?pe.substring(0,Se)+"...":pe+"..."},ee=async()=>{if(!(!t||!J))try{const te=J.replace(/\//g,"__"),pe=await(await fetch(`/api/v1/workspaces/${te}/sessions?groupBy=date`,{headers:{Authorization:`Bearer ${t}`}})).json();G(pe),console.log("[Chat] Sessions refreshed")}catch(te){console.error("[Chat] Failed to refresh sessions:",te)}},le=async(te,he)=>{if(!te||!he)return;const pe=j(he);try{await fetch(`/api/v1/conversations/${te}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({title:pe})}),h(pe),console.log("[Chat] Auto-renamed to:",pe),await ee()}catch(Se){console.error("[Chat] Auto-rename failed:",Se)}};V.useEffect(()=>{if(!t)return;(async()=>{try{const pe=await(await fetch("/api/v1/workspaces",{headers:{Authorization:`Bearer ${t}`}})).json();console.log("[Chat] Workspaces API response:",pe);let Se=pe.workspaces||[];const je=localStorage.getItem("nexuscli_workspace")||J;je&&(Se.some(Ea=>Ea.workspace_path===je)||(console.log("[Chat] Adding current workspace to list:",je),Se=[{workspace_path:je,session_count:0,last_activity:Date.now()},...Se]));const Cn=localStorage.getItem("nexuscli_deprecated_workspaces"),hr=Cn?JSON.parse(Cn):[];Se=Se.filter(pr=>!hr.includes(pr.workspace_path)),console.log("[Chat] Filtered deprecated workspaces:",hr),K(Se),console.log("[Chat] Workspaces state set to:",Se)}catch(he){console.error("Failed to load workspaces:",he)}})()},[t,J]),V.useEffect(()=>{(async()=>{if(!(!t||!J))try{const he=J.replace(/\//g,"__");console.log("[Chat] Mounting workspace:",J),await fetch(`/api/v1/workspaces/${he}/mount`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});const Se=await(await fetch(`/api/v1/workspaces/${he}/sessions?groupBy=date`,{headers:{Authorization:`Bearer ${t}`}})).json();G(Se)}catch(he){console.error("Failed to load workspace sessions:",he)}})()},[t,J]);const Me=async(te,{loadMore:he=!1,before:pe}={})=>{var Se,je,Cn,hr,pr,Ea;if(t)try{if(J){const qs=J.replace(/\//g,"__");await fetch(`/api/v1/workspaces/${qs}/mount`,{method:"POST",headers:{Authorization:`Bearer ${t}`}})}let tn=`/api/v1/sessions/${te}/messages?limit=30`;pe&&(tn+=`&before=${pe}`);const ca=await(await fetch(tn,{headers:{Authorization:`Bearer ${t}`}})).json(),rl=ca.messages||[];he?a(qs=>[...rl,...qs]):(d(((Se=ca.session)==null?void 0:Se.conversation_id)||((je=ca.session)==null?void 0:je.id)||te),T(((Cn=ca.session)==null?void 0:Cn.id)||te),h(((hr=ca.session)==null?void 0:hr.title)||"Session"),a(rl),i([])),be({hasMore:((pr=ca.pagination)==null?void 0:pr.hasMore)||!1,oldestTimestamp:((Ea=ca.pagination)==null?void 0:Ea.oldestTimestamp)||null})}catch(tn){console.error("Failed to load session messages:",tn)}},tt=async te=>{if(t)try{const pe=await(await fetch(`/api/v1/sessions/${te}/summary`,{headers:{Authorization:`Bearer ${t}`}})).json();ie(pe.summary||null)}catch(he){console.error("Failed to load session summary:",he)}},Ln=async()=>{!se||_e||!ge.hasMore||(Fe(!0),await Me(se,{loadMore:!0,before:ge.oldestTimestamp}),Fe(!1))},en=async te=>{const he=l,pe=!he;let Se=te;ae.length>0&&(Se=`${ae.map(Ps=>`[Attached: ${Ps.path}]`).join(`
8608
+ `,1;if(Ia>1e5&&Ia>j.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=ee,ee.length}const Be=D(H);if(!Be)throw z0(i.replace("{}",H)),new Error('Unknown language: "'+H+'"');const Le=Ibe(Be);let St="",fe=G||Le;const Jt={},dt=new c.__emitter(c);Ge();let Pe="",Ca=0,fn=0,Ia=0,dr=!1;try{if(Be.__emitTokens)Be.__emitTokens(K,dt);else{for(fe.matcher.considerAll();;){Ia++,dr?dr=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=fn;const O=fe.matcher.exec(K);if(!O)break;const j=K.substring(fn,O.index),ee=lt(j,O);fn=O.index+ee}lt(K.substring(fn))}return dt.finalize(),St=dt.toHTML(),{language:H,value:St,relevance:Ca,illegal:!1,_emitter:dt,_top:fe}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:H,value:jA(K),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:fn,context:K.slice(fn-100,fn+100),mode:O.mode,resultSoFar:St},_emitter:dt};if(r)return{language:H,value:jA(K),illegal:!1,relevance:0,errorRaised:O,_emitter:dt,_top:fe};throw O}}function p(H){const K={value:jA(H),illegal:!1,relevance:0,_top:o,_emitter:new c.__emitter(c)};return K._emitter.addText(H),K}function y(H,K){K=K||c.languages||Object.keys(t);const P=p(H),G=K.filter(D).filter($).map(ge=>h(ge,H,!1));G.unshift(P);const L=G.sort((ge,be)=>{if(ge.relevance!==be.relevance)return be.relevance-ge.relevance;if(ge.language&&be.language){if(D(ge.language).supersetOf===be.language)return 1;if(D(be.language).supersetOf===ge.language)return-1}return 0}),[ie,se]=L,T=ie;return T.secondBest=se,T}function k(H,K,P){const G=K&&n[K]||P;H.classList.add("hljs"),H.classList.add(`language-${G}`)}function M(H){let K=null;const P=d(H);if(l(P))return;if(J("before:highlightElement",{el:H,language:P}),H.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",H);return}if(H.children.length>0&&(c.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(H)),c.throwUnescapedHTML))throw new Tbe("One of your code blocks includes unescaped HTML.",H.innerHTML);K=H;const G=K.textContent,L=P?u(G,{language:P,ignoreIllegals:!0}):y(G);H.innerHTML=L.value,H.dataset.highlighted="yes",k(H,P,L.language),H.result={language:L.language,re:L.relevance,relevance:L.relevance},L.secondBest&&(H.secondBest={language:L.secondBest.language,relevance:L.secondBest.relevance}),J("after:highlightElement",{el:H,result:L,text:G})}function S(H){c=rD(c,H)}const v=()=>{C(),Z0("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function g(){C(),Z0("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function C(){function H(){C()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",H,!1),w=!0;return}document.querySelectorAll(c.cssSelector).forEach(M)}function z(H,K){let P=null;try{P=K(e)}catch(G){if(z0("Language definition for '{}' could not be registered.".replace("{}",H)),r)z0(G);else throw G;P=o}P.name||(P.name=H),t[H]=P,P.rawDefinition=K.bind(null,e),P.aliases&&B(P.aliases,{languageName:H})}function N(H){delete t[H];for(const K of Object.keys(n))n[K]===H&&delete n[K]}function E(){return Object.keys(t)}function D(H){return H=(H||"").toLowerCase(),t[H]||t[n[H]]}function B(H,{languageName:K}){typeof H=="string"&&(H=[H]),H.forEach(P=>{n[P.toLowerCase()]=K})}function $(H){const K=D(H);return K&&!K.disableAutodetect}function F(H){H["before:highlightBlock"]&&!H["before:highlightElement"]&&(H["before:highlightElement"]=K=>{H["before:highlightBlock"](Object.assign({block:K.el},K))}),H["after:highlightBlock"]&&!H["after:highlightElement"]&&(H["after:highlightElement"]=K=>{H["after:highlightBlock"](Object.assign({block:K.el},K))})}function U(H){F(H),a.push(H)}function de(H){const K=a.indexOf(H);K!==-1&&a.splice(K,1)}function J(H,K){const P=H;a.forEach(function(G){G[P]&&G[P](K)})}function re(H){return Z0("10.7.0","highlightBlock will be removed entirely in v12.0"),Z0("10.7.0","Please use highlightElement now."),M(H)}Object.assign(e,{highlight:u,highlightAuto:y,highlightAll:C,highlightElement:M,highlightBlock:re,configure:S,initHighlighting:v,initHighlightingOnLoad:g,registerLanguage:z,unregisterLanguage:N,listLanguages:E,getLanguage:D,registerAliases:B,autoDetection:$,inherit:rD,addPlugin:U,removePlugin:de}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=Ebe,e.regex={concat:U0,lookahead:mH,either:Wz,optional:Wwe,anyNumberOfTimes:Gwe};for(const H in Hl)typeof Hl[H]=="object"&&yH(Hl[H]);return Object.assign(e,Hl),e},As=SH({});As.newInstance=()=>SH({});var $be=As;As.HighlightJS=As;As.default=As;const Rbe=oI($be),oD={},Obe="hljs-";function Dbe(e){const t=Rbe.newInstance();return e&&i(e),{highlight:n,highlightAuto:a,listLanguages:r,register:i,registerAlias:o,registered:c};function n(l,d,u){const h=u||oD,p=typeof h.prefix=="string"?h.prefix:Obe;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:Pbe,classPrefix:p});const y=t.highlight(d,{ignoreIllegals:!0,language:l});if(y.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:y.errorRaised});const k=y._emitter.root,M=k.data;return M.language=y.language,M.relevance=y.relevance,k}function a(l,d){const h=(d||oD).subset||r();let p=-1,y=0,k;for(;++p<h.length;){const M=h[p];if(!t.getLanguage(M))continue;const S=n(M,l,d);S.data&&S.data.relevance!==void 0&&S.data.relevance>y&&(y=S.data.relevance,k=S)}return k||{type:"root",children:[],data:{language:void 0,relevance:y}}}function r(){return t.listLanguages()}function i(l,d){if(typeof l=="string")t.registerLanguage(l,d);else{let u;for(u in l)Object.hasOwn(l,u)&&t.registerLanguage(u,l[u])}}function o(l,d){if(typeof l=="string")t.registerAliases(typeof d=="string"?d:[...d],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const h=l[u];t.registerAliases(typeof h=="string"?h:[...h],{languageName:u})}}}function c(l){return!!t.getLanguage(l)}}class Pbe{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],a=n.children[n.children.length-1];a&&a.type==="text"?a.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const a=this.stack[this.stack.length-1],r=t.root.children;n?a.children.push({type:"element",tagName:"span",properties:{className:[n]},children:r}):a.children.push(...r)}openNode(t){const n=this,a=t.split(".").map(function(o,c){return c?o+"_".repeat(c):n.options.classPrefix+o}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:a},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const qbe={};function Fbe(e){const t=e||qbe,n=t.aliases,a=t.detect||!1,r=t.languages||Bwe,i=t.plainText,o=t.prefix,c=t.subset;let l="hljs";const d=Dbe(r);if(n&&d.registerAlias(n),o){const u=o.indexOf("-");l=u===-1?o:o.slice(0,u)}return function(u,h){II(u,"element",function(p,y,k){if(p.tagName!=="code"||!k||k.type!=="element"||k.tagName!=="pre")return;const M=Bbe(p);if(M===!1||!M&&!a||M&&i&&i.includes(M))return;Array.isArray(p.properties.className)||(p.properties.className=[]),p.properties.className.includes(l)||p.properties.className.unshift(l);const S=WB(p,{whitespace:"pre"});let v;try{v=M?d.highlight(M,S,{prefix:o}):d.highlightAuto(S,{prefix:o,subset:c})}catch(g){const w=g;if(M&&/Unknown language/.test(w.message)){h.message("Cannot highlight as `"+M+"`, it’s not registered",{ancestors:[k,p],cause:w,place:p.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw w}!M&&v.data&&v.data.language&&p.properties.className.push("language-"+v.data.language),v.children.length>0&&(p.children=v.children)})}}function Bbe(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let a;for(;++n<t.length;){const r=String(t[n]);if(r==="no-highlight"||r==="nohighlight")return!1;!a&&r.slice(0,5)==="lang-"&&(a=r.slice(5)),!a&&r.slice(0,9)==="language-"&&(a=r.slice(9))}return a}const sD=/[#.]/g;function Hbe(e,t){const n=e||"",a={};let r=0,i,o;for(;r<n.length;){sD.lastIndex=r;const c=sD.exec(n),l=n.slice(r,c?c.index:n.length);l&&(i?i==="#"?a.id=l:Array.isArray(a.className)?a.className.push(l):a.className=[l]:o=l,r+=l.length),c&&(i=c[0],r++)}return{type:"element",tagName:o||t||"div",properties:a,children:[]}}function LH(e,t,n){const a=n?Gbe(n):void 0;function r(i,o,...c){let l;if(i==null){l={type:"root",children:[]};const d=o;c.unshift(d)}else{l=Hbe(i,t);const d=l.tagName.toLowerCase(),u=a?a.get(d):void 0;if(l.tagName=u||d,jbe(o))c.unshift(o);else for(const[h,p]of Object.entries(o))Vbe(e,l.properties,h,p)}for(const d of c)lT(l.children,d);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return r}function jbe(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const a of n){const r=t[a];if(r&&typeof r=="object"){if(!Array.isArray(r))return!0;const i=r;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Vbe(e,t,n,a){const r=Xq(e,n);let i;if(a!=null){if(typeof a=="number"){if(Number.isNaN(a))return;i=a}else typeof a=="boolean"?i=a:typeof a=="string"?r.spaceSeparated?i=fR(a):r.commaSeparated?i=dR(a):r.commaOrSpaceSeparated?i=fR(dR(a).join(" ")):i=cD(r,r.property,a):Array.isArray(a)?i=[...a]:i=r.property==="style"?Ube(a):String(a);if(Array.isArray(i)){const o=[];for(const c of i)o.push(cD(r,r.property,c));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function lT(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)lT(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?lT(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function cD(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Dc(n)===Dc(t)))return!0}return n}function Ube(e){const t=[];for(const[n,a]of Object.entries(e))t.push([n,a].join(": "));return t.join("; ")}function Gbe(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Wbe=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Kbe=LH(Yq,"div"),Zbe=LH(bI,"g",Wbe),VA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Xbe(e,t){return NH(e,{})||{type:"root",children:[]}}function NH(e,t){const n=Ybe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function Ybe(e,t){switch(e.nodeType){case 1:return t_e(e,t);case 3:return Jbe(e);case 8:return e_e(e);case 9:return lD(e,t);case 10:return Qbe();case 11:return lD(e,t);default:return}}function lD(e,t){return{type:"root",children:CH(e,t)}}function Qbe(){return{type:"doctype"}}function Jbe(e){return{type:"text",value:e.nodeValue||""}}function e_e(e){return{type:"comment",value:e.nodeValue||""}}function t_e(e,t){const n=e.namespaceURI,a=n===VA.svg?Zbe:Kbe,r=n===VA.html?e.tagName.toLowerCase():e.tagName,i=n===VA.html&&r==="template"?e.content:e,o=e.getAttributeNames(),c={};let l=-1;for(;++l<o.length;)c[o[l]]=e.getAttribute(o[l])||"";return a(r,c,CH(i,t))}function CH(e,t){const n=e.childNodes,a=[];let r=-1;for(;++r<n.length;){const i=NH(n[r],t);i!==void 0&&a.push(i)}return a}new DOMParser;function n_e(e,t){const n=a_e(e);return Xbe(n)}function a_e(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const r_e={},i_e=[];function o_e(e){const t=e||r_e;return function(n,a){vz(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:i_e,c=o.includes("language-math"),l=o.includes("math-display"),d=o.includes("math-inline");let u=l;if(!c&&!l&&!d)return;let h=i[i.length-1],p=r;if(r.tagName==="code"&&c&&h&&h.type==="element"&&h.tagName==="pre"&&(p=h,h=i[i.length-2],u=!0),!h)return;const y=WB(p,{whitespace:"pre"});let k;try{k=HO.renderToString(y,{...t,displayMode:u,throwOnError:!0})}catch(S){const v=S,g=v.name.toLowerCase();a.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:v,place:r.position,ruleId:g,source:"rehype-katex"});try{k=HO.renderToString(y,{...t,displayMode:u,strict:"ignore",throwOnError:!1})}catch{k=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(S)},children:[{type:"text",value:y}]}]}}typeof k=="string"&&(k=n_e(k).children);const M=h.children.indexOf(p);return h.children.splice(M,1,...k),_F})}}function s_e({content:e=""}){return e?_.jsx("div",{className:"markdown-container",children:_.jsx(Fge,{remarkPlugins:[Q9e,cxe],rehypePlugins:[Fbe,o_e],components:{code({node:t,inline:n,className:a,children:r,...i}){const o=/language-(\w+)/.exec(a||""),c=o?o[1]:"text";return n?_.jsx("code",{className:"markdown-inline-code",...i,children:r}):_.jsxs("pre",{className:"markdown-code-block",children:[_.jsx("div",{className:"markdown-code-header",children:_.jsx("span",{className:"markdown-code-language",children:c})}),_.jsx("code",{className:a,...i,children:r})]})},img({node:t,src:n,alt:a,...r}){return _.jsxs("div",{className:"markdown-image-wrapper",children:[_.jsx("img",{src:n,alt:a,className:"markdown-image",...r}),a&&_.jsx("span",{className:"markdown-image-caption",children:a})]})},a({node:t,href:n,children:a,...r}){return _.jsx("a",{href:n,className:"markdown-link",target:"_blank",rel:"noopener noreferrer",...r,children:a})},table({node:t,children:n,...a}){return _.jsx("div",{className:"markdown-table-wrapper",children:_.jsx("table",{className:"markdown-table",...a,children:n})})},blockquote({node:t,children:n,...a}){return _.jsx("blockquote",{className:"markdown-blockquote",...a,children:n})},h1({node:t,children:n,...a}){return _.jsx("h1",{className:"markdown-h1",...a,children:n})},h2({node:t,children:n,...a}){return _.jsx("h2",{className:"markdown-h2",...a,children:n})},h3({node:t,children:n,...a}){return _.jsx("h3",{className:"markdown-h3",...a,children:n})},ul({node:t,children:n,...a}){return _.jsx("ul",{className:"markdown-ul",...a,children:n})},ol({node:t,children:n,...a}){return _.jsx("ol",{className:"markdown-ol",...a,children:n})},li({node:t,children:n,...a}){return _.jsx("li",{className:"markdown-li",...a,children:n})},p({node:t,children:n,...a}){return _.jsx("p",{className:"markdown-p",...a,children:n})}},children:e})}):_.jsx("div",{className:"markdown-empty",children:"No content"})}function c_e({message:e,streaming:t=!1}){const{user:n}=sr(),{id:a,role:r,content:i,created_at:o,metadata:c,status:l}=e,d=new Date(o).toLocaleTimeString("it-IT",{hour:"2-digit",minute:"2-digit",hour12:!1}),u=r==="user"?(n==null?void 0:n.username)||"You":"NexusAI";return _.jsxs("div",{className:`message ${r}-message`,children:[_.jsxs("div",{className:"message-header",children:[_.jsx("span",{className:"avatar",children:r==="user"?"👤":"🤖"}),_.jsx("span",{className:"sender",children:u}),_.jsx("span",{className:"timestamp",children:d})]}),r==="assistant"&&l&&_.jsx(Hq,{status:l,metadata:c}),_.jsx("div",{className:"message-content",children:_.jsx(s_e,{content:i})}),t&&_.jsxs("div",{className:"streaming-indicator",children:[_.jsx("span",{className:"dot"}),_.jsx("span",{className:"dot"}),_.jsx("span",{className:"dot"})]}),r==="assistant"&&(l==null?void 0:l.state)==="completed"&&_.jsx(u3e,{message:e})]})}function l_e({selectedModel:e,onSelectModel:t,thinkMode:n="think",onThinkModeChange:a,reasoningLevel:r="high",onReasoningLevelChange:i}){var $;const[o,c]=V.useState(!1),[l,d]=V.useState(""),[u,h]=V.useState({}),[p,y]=V.useState(!0);V.useEffect(()=>{(async()=>{try{const de=await(await fetch("/api/v1/models")).json();h(de),y(!1)}catch(U){console.error("Failed to fetch models:",U),y(!1)}})()},[]);const M=Object.values(u).flatMap(F=>F.models||[]).find(F=>F.id===e),S=M?u[M.category]:u.claude||{icon:"Terminal"},v=Object.entries(u).map(([F,U])=>({key:F,...U,models:(U.models||[]).filter(de=>de.name.toLowerCase().includes(l.toLowerCase())||de.label.toLowerCase().includes(l.toLowerCase()))})).filter(F=>F.models&&F.models.length>0),g=(F,U)=>{if(!U){alert("This CLI tool is coming soon!");return}t(F),c(!1),d("")},w=(M==null?void 0:M.label)||(p?"Loading...":"Select"),C=w.length>15?w.substring(0,15):w,z=M==null?void 0:M.category,N=z?u[z]:null,E=(($=N==null?void 0:N.thinkModes)==null?void 0:$.length)>0,D=M==null?void 0:M.reasoningEfforts,B=e==null?void 0:e.startsWith("deepseek-");return _.jsxs("div",{className:"model-selector",children:[_.jsxs("div",{className:"model-selector-trigger",onClick:()=>!p&&c(!o),children:[_.jsx("span",{className:"model-icon",children:_.jsx(Ie,{name:(S==null?void 0:S.icon)||"Terminal",size:18})}),_.jsx("span",{className:"model-label",children:C}),_.jsx(Ie,{name:"ChevronDown",size:14})]}),E&&!B&&a&&_.jsxs("button",{className:`think-toggle ${n==="think"?"active":""}`,onClick:F=>{F.stopPropagation(),a(n==="think"?"no-think":"think")},title:n==="think"?"Extended Thinking ON":"Extended Thinking OFF",children:[_.jsx(Ie,{name:n==="think"?"Brain":"Zap",size:16}),_.jsx("span",{className:"toggle-label",children:n==="think"?"Think":"Fast"})]}),D&&i&&_.jsxs("div",{className:"reasoning-wrapper",children:[_.jsx(Ie,{name:"Cpu",size:14}),_.jsx("select",{className:"reasoning-select",value:r,onChange:F=>{F.stopPropagation(),i(F.target.value)},onClick:F=>F.stopPropagation(),children:D.map(F=>_.jsx("option",{value:F,children:F==="xhigh"?"X-High":F.charAt(0).toUpperCase()+F.slice(1)},F))})]}),o&&_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"model-dropdown",children:[_.jsx("div",{className:"model-search",children:_.jsx("input",{type:"text",placeholder:"Cerca CLI e modelli...",value:l,onChange:F=>d(F.target.value),autoFocus:!0})}),v.map(F=>_.jsxs("div",{className:"model-category",children:[_.jsxs("div",{className:"category-header",children:[_.jsx("span",{className:"category-icon",children:_.jsx(Ie,{name:F.icon,size:20})}),_.jsx("span",{className:"category-name",children:F.name}),!F.enabled&&_.jsx("span",{className:"coming-soon",children:F.disabledReason||"Coming Soon"})]}),_.jsx("div",{className:"model-list",children:F.models.map(U=>_.jsxs("div",{className:`model-item ${e===U.id?"selected":""} ${F.enabled?"":"disabled"}`,onClick:()=>g(U.id,F.enabled),children:[_.jsx("span",{className:"model-label",children:U.name}),e===U.id&&_.jsx("span",{className:"checkmark",children:_.jsx(Ie,{name:"Check",size:18})})]},U.id))})]},F.key))]}),_.jsx("div",{className:"model-dropdown-overlay",onClick:()=>c(!1)})]})]})}function d_e({onClose:e}){const{user:t,logout:n}=sr(),a=()=>{n(),e()};return _.jsx("div",{className:"user-menu",children:_.jsxs("button",{className:"user-menu-item logout",onClick:a,children:[_.jsx("span",{className:"menu-icon",children:_.jsx(Ie,{name:"LogOut",size:18})}),_.jsx("span",{children:"Disconnetti"})]})})}function u_e({items:e,align:t="right"}){const[n,a]=V.useState(!1),r=V.useRef(null);V.useEffect(()=>{if(!n)return;const o=c=>{r.current&&!r.current.contains(c.target)&&a(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[n]);const i=o=>{a(!1),o.onClick&&o.onClick()};return _.jsxs("div",{className:"dropdown-menu-container",ref:r,children:[_.jsx("button",{className:"dropdown-trigger",onClick:o=>{o.stopPropagation(),a(!n)},title:"Actions",children:_.jsx(Ie,{name:"MoreVertical",size:16})}),n&&_.jsx("div",{className:`dropdown-menu ${t}`,children:e.map((o,c)=>_.jsxs("button",{className:`dropdown-item ${o.danger?"danger":""}`,onClick:l=>{l.stopPropagation(),i(o)},children:[o.icon&&_.jsx(Ie,{name:o.icon,size:16}),_.jsx("span",{children:o.label})]},c))})]})}function h_e({isOpen:e,onConfirm:t,onCancel:n,title:a="Delete conversation?"}){return V.useEffect(()=>{const r=i=>{i.key==="Escape"&&n()};if(e)return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n]),e?_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"delete-modal-overlay",onClick:n}),_.jsxs("div",{className:"delete-modal",children:[_.jsxs("div",{className:"delete-modal-header",children:[_.jsx(Ie,{name:"AlertTriangle",size:24,className:"delete-modal-icon"}),_.jsx("h3",{className:"delete-modal-title",children:a})]}),_.jsx("p",{className:"delete-modal-message",children:"This action cannot be undone. This will permanently delete the conversation and all its messages."}),_.jsxs("div",{className:"delete-modal-actions",children:[_.jsx("button",{className:"delete-modal-btn cancel-btn",onClick:n,children:"Cancel"}),_.jsxs("button",{className:"delete-modal-btn confirm-btn",onClick:t,children:[_.jsx(Ie,{name:"Trash2",size:16}),"Delete"]})]})]})]}):null}const Oa={data:null,timestamp:0,workspace:null,TTL:3e4};function p_e({isOpen:e,onClose:t,currentConversationId:n,onSelectConversation:a,onNewConversation:r,currentWorkspace:i,onWorkspaceChange:o,sessions:c}){var _e,Fe;const{t:l}=iz(),{token:d,user:u}=sr(),[h,p]=V.useState({today:[],yesterday:[],last7days:[],last30days:[],older:[]}),[y,k]=V.useState(""),[M,S]=V.useState(!1),[v,g]=V.useState(null),[w,C]=V.useState(""),[z,N]=V.useState(!1),[E,D]=V.useState(null),[B,$]=V.useState(!1),[F,U]=V.useState(!1),de=ae=>{const we=(ae||"").toLowerCase();return we.includes("codex")||we.includes("openai")?{icon:"Code2",color:"#00D26A",className:"codex",label:"Codex"}:we.includes("gemini")||we.includes("google")?{icon:"Sparkles",color:"#4285F4",className:"gemini",label:"Gemini"}:{icon:"Terminal",color:"#FF6B35",className:"claude",label:"Claude"}};V.useEffect(()=>{if(console.log("[Sidebar] useEffect triggered - sessions:",c?"has data":"null","isOpen:",e,"token:",!!d),c){console.log("[Sidebar] Using sessions prop:",Object.keys(c).map(Ee=>{var Ge;return`${Ee}:${((Ge=c[Ee])==null?void 0:Ge.length)||0}`}).join(", ")),p(c),$(!1),U(!0);return}if(!d){console.log("[Sidebar] Waiting for token...");return}if(!e&&F){console.log("[Sidebar] Sidebar closed, skipping fetch");return}const ae=Date.now();if(Oa.data&&Oa.workspace===i&&ae-Oa.timestamp<Oa.TTL){p(Oa.data);return}(async()=>{$(!0);try{const Ee=i?`/api/v1/conversations?groupBy=date&workspace=${encodeURIComponent(i)}`:"/api/v1/conversations?groupBy=date",We=await(await fetch(Ee,{headers:{Authorization:`Bearer ${d}`}})).json();Oa.data=We,Oa.timestamp=Date.now(),Oa.workspace=i,p(We),U(!0)}catch(Ee){console.error("Failed to load conversations:",Ee)}finally{$(!1)}})()},[d,e,c,i,F]);const J=ae=>!ae||!Array.isArray(ae)?[]:y?ae.filter(we=>we.title.toLowerCase().includes(y.toLowerCase())):ae,re=ae=>{a(ae),window.innerWidth<768&&t()},H=ae=>{g(ae.id),C(ae.title)},K=async ae=>{if(!ae||ae==="null"){console.warn("[Sidebar] Attempted to save title with null conversationId"),g(null);return}try{await fetch(`/api/v1/conversations/${ae}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify({title:w})}),p(we=>{const Ae={...we};return Object.keys(Ae).forEach(Ee=>{Ae[Ee]=Ae[Ee].map(Ge=>Ge.id===ae?{...Ge,title:w}:Ge)}),Ae}),g(null)}catch(we){console.error("Failed to update title:",we)}},P=()=>{g(null),C("")},G=ae=>{D(ae),N(!0)},L=async()=>{if(E)try{await fetch(`/api/v1/sessions/${E}`,{method:"DELETE",headers:{Authorization:`Bearer ${d}`}}),p(ae=>{const we={...ae};return Object.keys(we).forEach(Ae=>{we[Ae]=we[Ae].filter(Ee=>Ee.id!==E)}),we}),E===n&&r(),N(!1),D(null)}catch(ae){console.error("Failed to delete conversation:",ae),N(!1),D(null)}},ie=()=>{N(!1),D(null)},se=async(ae,we)=>{try{const Ae=await fetch(`/api/v1/conversations/${ae}/pin`,{method:"POST",headers:{Authorization:`Bearer ${d}`}}),{pinned:Ee}=await Ae.json();p(Ge=>{const We={...Ge};return Object.keys(We).forEach(lt=>{We[lt]=We[lt].map(Be=>Be.id===ae?{...Be,metadata:{...Be.metadata,pinned:Ee}}:Be)}),We})}catch(Ae){console.error("Failed to toggle pin:",Ae)}},T=ae=>{var Be;const we=ae.id===n,Ae=(Be=ae.metadata)==null?void 0:Be.pinned,Ee=v===ae.id,Ge=de(ae.engine),We=ae.title||"Untitled Conversation";We.trim()===""&&console.warn("[Sidebar] Empty title for conversation:",ae.id);const lt=[{label:"Rename",icon:"Pencil",onClick:()=>H(ae)},{label:Ae?"Unpin":"Pin",icon:"Pin",onClick:Le=>{se(ae.id)}},{label:"Delete",icon:"Trash2",danger:!0,onClick:()=>G(ae.id)}];return _.jsx("div",{className:`conversation-item ${we?"active":""}`,onClick:()=>!Ee&&re(ae.id),role:"listitem","aria-label":ae.title,tabIndex:0,children:Ee?_.jsx("input",{type:"text",value:w,onChange:Le=>C(Le.target.value),onKeyDown:Le=>{Le.key==="Enter"&&K(ae.id),Le.key==="Escape"&&P()},onBlur:()=>K(ae.id),autoFocus:!0,className:"conversation-title-edit"}):_.jsxs(_.Fragment,{children:[_.jsx(Ie,{name:Ge.icon,size:18,className:`conversation-icon ${Ge.className}`,style:{color:Ge.color},title:Ge.label}),_.jsxs("div",{className:"conversation-title-wrapper",children:[_.jsx("span",{className:"conversation-title",children:We}),_.jsx("div",{className:"fade-gradient","aria-hidden":"true"})]}),_.jsx("div",{className:"conversation-actions",children:_.jsx(u_e,{items:lt,align:"right"})})]})},ae.id)},ge=()=>{const ae=[...h.today,...h.yesterday,...h.last7days,...h.last30days,...h.older];return J(ae.filter(we=>{var Ae;return(Ae=we.metadata)==null?void 0:Ae.pinned}))},be=(ae,we,Ae=!1)=>{let Ee=J(we);return Ae&&(Ee=Ee.filter(Ge=>{var We;return!((We=Ge.metadata)!=null&&We.pinned)})),Ee.length===0?null:_.jsxs("div",{className:"conversation-group",children:[_.jsx("div",{className:"group-title",children:ae}),Ee.map(T)]})};return _.jsxs(_.Fragment,{children:[e&&_.jsx("div",{className:"sidebar-overlay",onClick:t}),_.jsxs("div",{className:`sidebar ${e?"open":""}`,children:[_.jsxs("div",{className:"sidebar-search",children:[_.jsx("span",{className:"search-icon",children:_.jsx(Ie,{name:"Search",size:18})}),_.jsx("input",{type:"text",placeholder:l("sidebar.searchPlaceholder"),value:y,onChange:ae=>k(ae.target.value)})]}),_.jsxs("div",{className:"conversation-list",children:[B&&_.jsx("div",{className:"loading-indicator",children:_.jsx("div",{className:"loading-spinner"})}),!B&&ge().length>0&&_.jsxs("div",{className:"conversation-group pinned-group",children:[_.jsxs("div",{className:"group-title",children:[_.jsx(Ie,{name:"Pin",size:14}),_.jsx("span",{children:"Pinned"})]}),ge().map(T)]}),!B&&be("Oggi",h.today,!0),!B&&be("Ieri",h.yesterday,!0),!B&&be("Ultimi 7 giorni",h.last7days,!0),!B&&be("Ultimi 30 giorni",h.last30days,!0),!B&&be("Più vecchi",h.older,!0),!B&&Object.values(h).every(ae=>ae.length===0)&&_.jsx("div",{className:"empty-state",children:_.jsx("p",{children:"Nessuna conversazione trovata"})})]}),_.jsxs("div",{className:"sidebar-footer",children:[_.jsxs("div",{className:"user-profile",onClick:()=>S(!M),children:[_.jsx("div",{className:"user-avatar",children:((Fe=(_e=u==null?void 0:u.username)==null?void 0:_e[0])==null?void 0:Fe.toUpperCase())||"?"}),_.jsx("span",{className:"user-name",children:(u==null?void 0:u.username)||"Guest"})]}),M&&_.jsx(d_e,{onClose:()=>S(!1)})]}),_.jsx(h_e,{isOpen:z,onConfirm:L,onCancel:ie,title:"Delete conversation?"})]})]})}function y_e({onFileAttached:e}){const{token:t}=sr(),[n,a]=V.useState(!1),[r,i]=V.useState(!1),o=V.useRef(null),c=async p=>{if(!(!p||!t)){i(!0);try{const y=new FormData;y.append("file",p);const k=await fetch("/api/v1/upload",{method:"POST",headers:{Authorization:`Bearer ${t}`},body:y});if(!k.ok){const S=await k.json();throw new Error(S.error||"Upload failed")}const M=await k.json();console.log("[AttachMenu] File uploaded:",M.file),e&&e(M.file)}catch(y){console.error("[AttachMenu] Upload error:",y),alert(`Upload failed: ${y.message}`)}finally{i(!1),a(!1)}}},l=p=>{var k;const y=(k=p.target.files)==null?void 0:k[0];y&&c(y),o.current&&(o.current.value="")},d=p=>{o.current&&(o.current.accept=p,o.current.click())},u=()=>{d(".txt,.md,.pdf,.doc,.docx,.xls,.xlsx,.csv,.json,.xml,.html,.css,.js,.ts,.py,.java,.c,.cpp,.h,.rb,.php,.go,.rs,.sh,.log,.yaml,.yml,.toml,.sql")},h=()=>{d("image/*")};return _.jsxs("div",{className:"attach-menu-container",children:[_.jsx("input",{ref:o,type:"file",style:{display:"none"},onChange:l}),_.jsx("button",{type:"button",className:"icon-btn",onClick:()=>a(!n),disabled:r,title:"Attach File","aria-label":"Attach file or image","aria-expanded":n,children:r?_.jsx(Ie,{name:"Loader",size:20,className:"spinning"}):_.jsx(Ie,{name:"Paperclip",size:20})}),n&&_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"attach-overlay",onClick:()=>a(!1)}),_.jsxs("div",{className:"attach-dropdown",children:[_.jsxs("button",{className:"attach-option",onClick:u,children:[_.jsx(Ie,{name:"File",size:16}),_.jsx("span",{children:"Invia file"})]}),_.jsxs("button",{className:"attach-option",onClick:h,children:[_.jsx(Ie,{name:"Image",size:16}),_.jsx("span",{children:"Invia immagine"})]})]})]})]})}function f_e({summary:e}){if(!e)return null;const[t,n]=V.useState(!1),{summary_short:a,summary_long:r,key_decisions:i=[],tools_used:o=[],files_modified:c=[]}=e;return _.jsxs("div",{className:"context-summary",children:[_.jsxs("div",{className:"summary-header",onClick:()=>n(!t),children:[_.jsxs("div",{className:"summary-title",children:[_.jsx(Ie,{name:"BookOpenText",size:18}),_.jsx("span",{children:"Context Summary"})]}),_.jsx("button",{className:"summary-toggle",type:"button","aria-label":t?"Collapse summary":"Expand summary",children:_.jsx(Ie,{name:t?"ChevronUp":"ChevronDown",size:16})})]}),_.jsxs("div",{className:"summary-content",children:[_.jsx("p",{className:"summary-short",children:a||"No summary available."}),t&&_.jsxs(_.Fragment,{children:[r&&_.jsx("p",{className:"summary-long",children:r}),i.length>0&&_.jsxs("div",{className:"summary-section",children:[_.jsx("h4",{children:"Key Decisions"}),_.jsx("ul",{children:i.map((l,d)=>_.jsx("li",{children:l},d))})]}),o.length>0&&_.jsxs("div",{className:"summary-section",children:[_.jsx("h4",{children:"Tools Used"}),_.jsx("div",{className:"summary-tags",children:o.map((l,d)=>_.jsx("span",{className:"tag",children:l},d))})]}),c.length>0&&_.jsxs("div",{className:"summary-section",children:[_.jsx("h4",{children:"Files Modified"}),_.jsx("div",{className:"summary-tags",children:c.map((l,d)=>_.jsx("span",{className:"tag",children:l},d))})]})]})]})]})}function m_e(){const{t:e}=iz(),{token:t}=sr(),[n,a]=V.useState([]),[r,i]=V.useState([]),[o,c]=V.useState(""),[l,d]=V.useState(null),[u,h]=V.useState("New Chat"),[p,y]=V.useState(!1),[k,M]=V.useState(!1),[S,v]=V.useState("claude-sonnet-4-5-20250929"),[g,w]=V.useState(null),[C,z]=V.useState("high"),[N,E]=V.useState("think"),[D,B]=V.useState({}),[$,F]=V.useState(!1),[U,de]=V.useState(""),[J,re]=V.useState(""),[H,K]=V.useState([]),[P,G]=V.useState(null),[L,ie]=V.useState(null),[se,T]=V.useState(null),[ge,be]=V.useState({hasMore:!1,oldestTimestamp:null}),[_e,Fe]=V.useState(!1),[ae,we]=V.useState([]),Ae=V.useRef(null),Ee=V.useRef(null),Ge=V.useCallback(te=>{c(he=>he+(he?" ":"")+te)},[]),We=V.useCallback(te=>{console.error("[STT]",te)},[]),{isListening:lt,isSupported:Be,transcript:Le,interimTranscript:St,toggleListening:fe,resetTranscript:Jt,provider:dt}=AU({language:"it-IT",onResult:Ge,onError:We}),Pe=te=>!te||te==="/"?te:te.replace(/\/+$/,""),Ca=()=>{var te;(te=Ae.current)==null||te.scrollIntoView({behavior:"smooth"})};V.useEffect(()=>{Ca()},[n]),V.useEffect(()=>{Ee.current&&(Ee.current.style.height="auto",Ee.current.style.height=Ee.current.scrollHeight+"px")},[o]),V.useEffect(()=>{(async()=>{const he=localStorage.getItem("nexuscli_workspace");if(he){const pe=Pe(he);console.log("[Chat] Restored workspace from localStorage:",pe),de(pe),re(pe),pe!==he&&localStorage.setItem("nexuscli_workspace",pe);return}try{const Se=await(await fetch("/api/v1/workspace")).json(),je=Se.current||Se.home;console.log("[Chat] Loaded workspace from backend:",je),de(je),re(je),localStorage.setItem("nexuscli_workspace",je)}catch(pe){console.error("Failed to fetch workspace:",pe),console.warn("[Chat] Backend not available, workspace not set")}})()},[]);const fn=(te,he)=>te?Object.values(he).some(pe=>(pe.models||[]).some(Se=>Se.id===te)):!1;V.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/v1/models")).json();B(pe)}catch(he){console.error("Failed to fetch models:",he)}})()},[]),V.useEffect(()=>{if(!g)return;if(fn(g,D)){console.log("[Chat] Applying preferred model from config:",g),v(g),w(null);return}Object.keys(D).length>0&&(console.warn("[Chat] Preferred model not available, keeping current:",g),w(null))},[D,g]),V.useEffect(()=>{(async()=>{try{const pe=await(await fetch("/api/v1/config")).json();pe.defaultModel&&(fn(pe.defaultModel,D)?(console.log("[Chat] Auto-selecting default model:",pe.defaultModel),v(pe.defaultModel)):w(pe.defaultModel))}catch(he){console.error("Failed to fetch config:",he)}})()},[]);const Ia=te=>{var he;for(const[pe,Se]of Object.entries(D)){const je=(he=Se.models)==null?void 0:he.find(Cn=>Cn.id===te);if(je)return{model:je,cli:Se,cliKey:pe,endpoint:Se.endpoint||"/api/v1/chat"}}return{model:null,cli:null,cliKey:"claude-code",endpoint:"/api/v1/chat"}},dr=te=>{const{cliKey:he}=Ia(te);return{"claude-code":"/api/v1/chat/interrupt",gemini:"/api/v1/gemini/interrupt",codex:"/api/v1/codex/interrupt"}[he]||"/api/v1/chat/interrupt"},O=async()=>{const te=se||l;if(!te){console.warn("[Chat] No active session to interrupt");return}const he=dr(S);console.log(`[Chat] Interrupting session ${te} via ${he}`);try{const Se=await(await fetch(he,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({sessionId:te})})).json();Se.success?(console.log(`[Chat] Session interrupted via ${Se.method}`),M(!1),i([]),a(je=>[...je,{id:`system-${Date.now()}`,role:"system",content:"⏹️ Generation stopped by user",created_at:Date.now()}])):console.warn(`[Chat] Interrupt failed: ${Se.reason}`)}catch(pe){console.error("[Chat] Interrupt request failed:",pe)}},j=te=>{if(!te)return"New Chat";const he=te.replace(/\s+/g," ").trim();if(he.length<=50)return he;const pe=he.substring(0,50),Se=pe.lastIndexOf(" ");return Se>20?pe.substring(0,Se)+"...":pe+"..."},ee=async()=>{if(!(!t||!J))try{const te=J.replace(/\//g,"__"),pe=await(await fetch(`/api/v1/workspaces/${te}/sessions?groupBy=date`,{headers:{Authorization:`Bearer ${t}`}})).json();G(pe),console.log("[Chat] Sessions refreshed")}catch(te){console.error("[Chat] Failed to refresh sessions:",te)}},le=async(te,he)=>{if(!te||!he)return;const pe=j(he);try{await fetch(`/api/v1/conversations/${te}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({title:pe})}),h(pe),console.log("[Chat] Auto-renamed to:",pe),await ee()}catch(Se){console.error("[Chat] Auto-rename failed:",Se)}};V.useEffect(()=>{if(!t)return;(async()=>{try{const pe=await(await fetch("/api/v1/workspaces",{headers:{Authorization:`Bearer ${t}`}})).json();console.log("[Chat] Workspaces API response:",pe);let Se=pe.workspaces||[];const je=localStorage.getItem("nexuscli_workspace")||J;je&&(Se.some(Ea=>Ea.workspace_path===je)||(console.log("[Chat] Adding current workspace to list:",je),Se=[{workspace_path:je,session_count:0,last_activity:Date.now()},...Se]));const Cn=localStorage.getItem("nexuscli_deprecated_workspaces"),hr=Cn?JSON.parse(Cn):[];Se=Se.filter(pr=>!hr.includes(pr.workspace_path)),console.log("[Chat] Filtered deprecated workspaces:",hr),K(Se),console.log("[Chat] Workspaces state set to:",Se)}catch(he){console.error("Failed to load workspaces:",he)}})()},[t,J]),V.useEffect(()=>{(async()=>{if(!(!t||!J))try{const he=J.replace(/\//g,"__");console.log("[Chat] Mounting workspace:",J),await fetch(`/api/v1/workspaces/${he}/mount`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});const Se=await(await fetch(`/api/v1/workspaces/${he}/sessions?groupBy=date`,{headers:{Authorization:`Bearer ${t}`}})).json();G(Se)}catch(he){console.error("Failed to load workspace sessions:",he)}})()},[t,J]);const Me=async(te,{loadMore:he=!1,before:pe}={})=>{var Se,je,Cn,hr,pr,Ea;if(t)try{if(J){const qs=J.replace(/\//g,"__");await fetch(`/api/v1/workspaces/${qs}/mount`,{method:"POST",headers:{Authorization:`Bearer ${t}`}})}let tn=`/api/v1/sessions/${te}/messages?limit=30`;pe&&(tn+=`&before=${pe}`);const ca=await(await fetch(tn,{headers:{Authorization:`Bearer ${t}`}})).json(),rl=ca.messages||[];he?a(qs=>[...rl,...qs]):(d(((Se=ca.session)==null?void 0:Se.conversation_id)||((je=ca.session)==null?void 0:je.id)||te),T(((Cn=ca.session)==null?void 0:Cn.id)||te),h(((hr=ca.session)==null?void 0:hr.title)||"Session"),a(rl),i([])),be({hasMore:((pr=ca.pagination)==null?void 0:pr.hasMore)||!1,oldestTimestamp:((Ea=ca.pagination)==null?void 0:Ea.oldestTimestamp)||null})}catch(tn){console.error("Failed to load session messages:",tn)}},tt=async te=>{if(t)try{const pe=await(await fetch(`/api/v1/sessions/${te}/summary`,{headers:{Authorization:`Bearer ${t}`}})).json();ie(pe.summary||null)}catch(he){console.error("Failed to load session summary:",he)}},Ln=async()=>{!se||_e||!ge.hasMore||(Fe(!0),await Me(se,{loadMore:!0,before:ge.oldestTimestamp}),Fe(!1))},en=async te=>{const he=l,pe=!he;let Se=te;ae.length>0&&(Se=`${ae.map(Ps=>`[Attached: ${Ps.path}]`).join(`
8609
8609
  `)}
8610
8610
 
8611
8611
  ${te}`);const je={id:`user-${Date.now()}`,role:"user",content:Se,created_at:Date.now(),attachments:ae.length>0?[...ae]:void 0};a(tn=>[...tn,je]),i([]),M(!0),we([]);const{endpoint:Cn,cliKey:hr}=Ia(S),pr=hr==="codex";let Ea=null;try{const tn={conversationId:he,workspace:J,message:Se,model:S};pr&&(tn.reasoningEffort=C);const ca=(await fetch(Cn,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(tn)})).body.getReader(),rl=new TextDecoder;for(;;){const{done:qs,value:RH}=await ca.read();if(qs)break;const OH=rl.decode(RH).split(`
@@ -59,7 +59,7 @@
59
59
 
60
60
  <!-- Prevent Scaling on iOS -->
61
61
  <meta name="format-detection" content="telephone=no" />
62
- <script type="module" crossorigin src="/assets/index-BbBoc8w4.js"></script>
62
+ <script type="module" crossorigin src="/assets/index-5BxkfxwN.js"></script>
63
63
  <link rel="stylesheet" crossorigin href="/assets/index-WfmfixF4.css">
64
64
  </head>
65
65
  <body>
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Base CLI Wrapper - Common interrupt logic for all CLI wrappers
3
+ *
4
+ * Provides unified process tracking and interrupt capability for:
5
+ * - ClaudeWrapper (PTY)
6
+ * - GeminiWrapper (PTY)
7
+ * - CodexWrapper (child_process.spawn)
8
+ *
9
+ * @version 0.5.0 - Interrupt Support
10
+ */
11
+
12
+ class BaseCliWrapper {
13
+ constructor() {
14
+ // Map: sessionId → { process, type, startTime }
15
+ this.activeProcesses = new Map();
16
+ }
17
+
18
+ /**
19
+ * Register active process for interrupt capability
20
+ * @param {string} sessionId - Session/conversation ID
21
+ * @param {Object} process - PTY process or child_process
22
+ * @param {string} type - 'pty' or 'spawn'
23
+ */
24
+ registerProcess(sessionId, process, type = 'pty') {
25
+ this.activeProcesses.set(sessionId, {
26
+ process,
27
+ type,
28
+ startTime: Date.now()
29
+ });
30
+ console.log(`[BaseWrapper] Registered ${type} process for session ${sessionId}`);
31
+ }
32
+
33
+ /**
34
+ * Unregister process on completion
35
+ * @param {string} sessionId
36
+ */
37
+ unregisterProcess(sessionId) {
38
+ if (this.activeProcesses.has(sessionId)) {
39
+ this.activeProcesses.delete(sessionId);
40
+ console.log(`[BaseWrapper] Unregistered process for session ${sessionId}`);
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Interrupt running process
46
+ *
47
+ * Strategy:
48
+ * - PTY: Try ESC (0x1B) first, then SIGINT
49
+ * - Spawn: SIGINT directly
50
+ *
51
+ * @param {string} sessionId
52
+ * @returns {{ success: boolean, method?: string, reason?: string }}
53
+ */
54
+ interrupt(sessionId) {
55
+ const entry = this.activeProcesses.get(sessionId);
56
+
57
+ if (!entry) {
58
+ console.log(`[BaseWrapper] No active process for session ${sessionId}`);
59
+ return { success: false, reason: 'no_active_process' };
60
+ }
61
+
62
+ const { process, type } = entry;
63
+
64
+ try {
65
+ if (type === 'pty') {
66
+ // PTY process: Try ESC first (gentler), then SIGINT
67
+ if (typeof process.sendEsc === 'function' && process.sendEsc()) {
68
+ console.log(`[BaseWrapper] Sent ESC to PTY session ${sessionId}`);
69
+ // Don't remove yet - let onExit handle cleanup
70
+ return { success: true, method: 'esc' };
71
+ }
72
+
73
+ // ESC failed or not available, use SIGINT
74
+ if (typeof process.kill === 'function') {
75
+ process.kill('SIGINT');
76
+ console.log(`[BaseWrapper] Sent SIGINT to PTY session ${sessionId}`);
77
+ return { success: true, method: 'sigint' };
78
+ }
79
+ } else if (type === 'spawn') {
80
+ // child_process.spawn: SIGINT directly
81
+ if (typeof process.kill === 'function') {
82
+ process.kill('SIGINT');
83
+ console.log(`[BaseWrapper] Sent SIGINT to spawn session ${sessionId}`);
84
+ return { success: true, method: 'sigint' };
85
+ }
86
+ }
87
+
88
+ return { success: false, reason: 'kill_not_available' };
89
+ } catch (err) {
90
+ console.error(`[BaseWrapper] Interrupt error for session ${sessionId}:`, err.message);
91
+ return { success: false, reason: err.message };
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Check if session has active process
97
+ * @param {string} sessionId
98
+ * @returns {boolean}
99
+ */
100
+ isActive(sessionId) {
101
+ return this.activeProcesses.has(sessionId);
102
+ }
103
+
104
+ /**
105
+ * Get count of active processes
106
+ * @returns {number}
107
+ */
108
+ getActiveCount() {
109
+ return this.activeProcesses.size;
110
+ }
111
+
112
+ /**
113
+ * Get all active session IDs
114
+ * @returns {string[]}
115
+ */
116
+ getActiveSessions() {
117
+ return Array.from(this.activeProcesses.keys());
118
+ }
119
+
120
+ /**
121
+ * Get process info for session
122
+ * @param {string} sessionId
123
+ * @returns {{ type: string, startTime: number, duration: number } | null}
124
+ */
125
+ getProcessInfo(sessionId) {
126
+ const entry = this.activeProcesses.get(sessionId);
127
+ if (!entry) return null;
128
+
129
+ return {
130
+ type: entry.type,
131
+ startTime: entry.startTime,
132
+ duration: Date.now() - entry.startTime
133
+ };
134
+ }
135
+ }
136
+
137
+ module.exports = BaseCliWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmmbuto/nexuscli",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "NexusCLI - TRI CLI Control Plane (Claude/Codex/Gemini)",
5
5
  "main": "lib/server/server.js",
6
6
  "bin": {